@honua/app-platform 0.0.20-alpha.0

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 (840) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +11 -0
  3. package/app/index.d.ts +164 -0
  4. package/app/index.d.ts.map +1 -0
  5. package/app/index.js +424 -0
  6. package/app-controller/controller.d.ts +425 -0
  7. package/app-controller/controller.d.ts.map +1 -0
  8. package/app-controller/controller.js +1173 -0
  9. package/app-controller/index.d.ts +14 -0
  10. package/app-controller/index.d.ts.map +1 -0
  11. package/app-controller/index.js +12 -0
  12. package/app-workspace/index.d.ts +421 -0
  13. package/app-workspace/index.d.ts.map +1 -0
  14. package/app-workspace/index.js +722 -0
  15. package/collaboration/client.d.ts +40 -0
  16. package/collaboration/client.d.ts.map +1 -0
  17. package/collaboration/client.js +299 -0
  18. package/collaboration/errors.d.ts +15 -0
  19. package/collaboration/errors.d.ts.map +1 -0
  20. package/collaboration/errors.js +17 -0
  21. package/collaboration/fixture.d.ts +41 -0
  22. package/collaboration/fixture.d.ts.map +1 -0
  23. package/collaboration/fixture.js +362 -0
  24. package/collaboration/index.d.ts +18 -0
  25. package/collaboration/index.d.ts.map +1 -0
  26. package/collaboration/index.js +14 -0
  27. package/collaboration/types.d.ts +240 -0
  28. package/collaboration/types.d.ts.map +1 -0
  29. package/collaboration/types.js +1 -0
  30. package/contract/analytics-sources.d.ts +149 -0
  31. package/contract/analytics-sources.d.ts.map +1 -0
  32. package/contract/analytics-sources.js +235 -0
  33. package/contract/edit-session.d.ts +203 -0
  34. package/contract/edit-session.d.ts.map +1 -0
  35. package/contract/edit-session.js +760 -0
  36. package/contract/edit-sketch.d.ts +91 -0
  37. package/contract/edit-sketch.d.ts.map +1 -0
  38. package/contract/edit-sketch.js +281 -0
  39. package/contract/index.d.ts +63 -0
  40. package/contract/index.d.ts.map +1 -0
  41. package/contract/index.js +52 -0
  42. package/contract/jobs.d.ts +149 -0
  43. package/contract/jobs.d.ts.map +1 -0
  44. package/contract/jobs.js +40 -0
  45. package/contract/pmtiles.d.ts +162 -0
  46. package/contract/pmtiles.d.ts.map +1 -0
  47. package/contract/pmtiles.js +155 -0
  48. package/contract/source.d.ts +447 -0
  49. package/contract/source.d.ts.map +1 -0
  50. package/contract/source.js +3909 -0
  51. package/contract/spatial-aggregation.d.ts +336 -0
  52. package/contract/spatial-aggregation.d.ts.map +1 -0
  53. package/contract/spatial-aggregation.js +298 -0
  54. package/contract/temporal.d.ts +455 -0
  55. package/contract/temporal.d.ts.map +1 -0
  56. package/contract/temporal.js +146 -0
  57. package/contract/tiles.d.ts +370 -0
  58. package/contract/tiles.d.ts.map +1 -0
  59. package/contract/tiles.js +519 -0
  60. package/contract/types.d.ts +694 -0
  61. package/contract/types.d.ts.map +1 -0
  62. package/contract/types.js +183 -0
  63. package/contract/widget-source.d.ts +205 -0
  64. package/contract/widget-source.d.ts.map +1 -0
  65. package/contract/widget-source.js +1473 -0
  66. package/control-plane/client.d.ts +95 -0
  67. package/control-plane/client.d.ts.map +1 -0
  68. package/control-plane/client.js +374 -0
  69. package/control-plane/index.d.ts +18 -0
  70. package/control-plane/index.d.ts.map +1 -0
  71. package/control-plane/index.js +14 -0
  72. package/control-plane/types.d.ts +233 -0
  73. package/control-plane/types.d.ts.map +1 -0
  74. package/control-plane/types.js +7 -0
  75. package/controls/basemap-style-binding.d.ts +54 -0
  76. package/controls/basemap-style-binding.d.ts.map +1 -0
  77. package/controls/basemap-style-binding.js +199 -0
  78. package/controls/basemap-switcher.d.ts +95 -0
  79. package/controls/basemap-switcher.d.ts.map +1 -0
  80. package/controls/basemap-switcher.js +379 -0
  81. package/controls/element-utils.d.ts +48 -0
  82. package/controls/element-utils.d.ts.map +1 -0
  83. package/controls/element-utils.js +78 -0
  84. package/controls/index.d.ts +33 -0
  85. package/controls/index.d.ts.map +1 -0
  86. package/controls/index.js +30 -0
  87. package/controls/layer-list.d.ts +98 -0
  88. package/controls/layer-list.d.ts.map +1 -0
  89. package/controls/layer-list.js +375 -0
  90. package/controls/legend-derive.d.ts +53 -0
  91. package/controls/legend-derive.d.ts.map +1 -0
  92. package/controls/legend-derive.js +196 -0
  93. package/controls/legend.d.ts +104 -0
  94. package/controls/legend.d.ts.map +1 -0
  95. package/controls/legend.js +381 -0
  96. package/controls/swipe-control.d.ts +80 -0
  97. package/controls/swipe-control.d.ts.map +1 -0
  98. package/controls/swipe-control.js +368 -0
  99. package/controls/types.d.ts +227 -0
  100. package/controls/types.d.ts.map +1 -0
  101. package/controls/types.js +11 -0
  102. package/core/auth/client-credentials-provider.d.ts +51 -0
  103. package/core/auth/client-credentials-provider.d.ts.map +1 -0
  104. package/core/auth/client-credentials-provider.js +115 -0
  105. package/core/auth/credential-store.d.ts +52 -0
  106. package/core/auth/credential-store.d.ts.map +1 -0
  107. package/core/auth/credential-store.js +82 -0
  108. package/core/auth/index.d.ts +23 -0
  109. package/core/auth/index.d.ts.map +1 -0
  110. package/core/auth/index.js +20 -0
  111. package/core/auth/oauth2-provider.d.ts +114 -0
  112. package/core/auth/oauth2-provider.d.ts.map +1 -0
  113. package/core/auth/oauth2-provider.js +408 -0
  114. package/core/auth/pkce.d.ts +25 -0
  115. package/core/auth/pkce.d.ts.map +1 -0
  116. package/core/auth/pkce.js +46 -0
  117. package/core/auth/static-providers.d.ts +20 -0
  118. package/core/auth/static-providers.d.ts.map +1 -0
  119. package/core/auth/static-providers.js +26 -0
  120. package/core/auth/token-endpoint.d.ts +40 -0
  121. package/core/auth/token-endpoint.d.ts.map +1 -0
  122. package/core/auth/token-endpoint.js +133 -0
  123. package/core/auth/types.d.ts +144 -0
  124. package/core/auth/types.d.ts.map +1 -0
  125. package/core/auth/types.js +8 -0
  126. package/core/batch.d.ts +37 -0
  127. package/core/batch.d.ts.map +1 -0
  128. package/core/batch.js +79 -0
  129. package/core/cache-state.d.ts +79 -0
  130. package/core/cache-state.d.ts.map +1 -0
  131. package/core/cache-state.js +87 -0
  132. package/core/client.d.ts +607 -0
  133. package/core/client.d.ts.map +1 -0
  134. package/core/client.js +1716 -0
  135. package/core/compatibility.d.ts +18 -0
  136. package/core/compatibility.d.ts.map +1 -0
  137. package/core/compatibility.js +245 -0
  138. package/core/errors.d.ts +139 -0
  139. package/core/errors.d.ts.map +1 -0
  140. package/core/errors.js +176 -0
  141. package/core/esri-geojson.d.ts +66 -0
  142. package/core/esri-geojson.d.ts.map +1 -0
  143. package/core/esri-geojson.js +363 -0
  144. package/core/geoparquet-sql.d.ts +162 -0
  145. package/core/geoparquet-sql.d.ts.map +1 -0
  146. package/core/geoparquet-sql.js +333 -0
  147. package/core/geoservices.d.ts +34 -0
  148. package/core/geoservices.d.ts.map +1 -0
  149. package/core/geoservices.js +434 -0
  150. package/core/grpc-adapter.d.ts +23 -0
  151. package/core/grpc-adapter.d.ts.map +1 -0
  152. package/core/grpc-adapter.js +688 -0
  153. package/core/odata.d.ts +347 -0
  154. package/core/odata.d.ts.map +1 -0
  155. package/core/odata.js +913 -0
  156. package/core/ogc-conformance.d.ts +35 -0
  157. package/core/ogc-conformance.d.ts.map +1 -0
  158. package/core/ogc-conformance.js +134 -0
  159. package/core/ogc-endpoint-layout.d.ts +70 -0
  160. package/core/ogc-endpoint-layout.d.ts.map +1 -0
  161. package/core/ogc-endpoint-layout.js +173 -0
  162. package/core/ogc-features.d.ts +23 -0
  163. package/core/ogc-features.d.ts.map +1 -0
  164. package/core/ogc-features.js +129 -0
  165. package/core/ogc-maps.d.ts +49 -0
  166. package/core/ogc-maps.d.ts.map +1 -0
  167. package/core/ogc-maps.js +126 -0
  168. package/core/ogc-processes.d.ts +118 -0
  169. package/core/ogc-processes.d.ts.map +1 -0
  170. package/core/ogc-processes.js +423 -0
  171. package/core/ogc-records.d.ts +75 -0
  172. package/core/ogc-records.d.ts.map +1 -0
  173. package/core/ogc-records.js +251 -0
  174. package/core/ogc-tiles.d.ts +125 -0
  175. package/core/ogc-tiles.d.ts.map +1 -0
  176. package/core/ogc-tiles.js +183 -0
  177. package/core/path-utils.d.ts +69 -0
  178. package/core/path-utils.d.ts.map +1 -0
  179. package/core/path-utils.js +123 -0
  180. package/core/pbf-decoder.d.ts +39 -0
  181. package/core/pbf-decoder.d.ts.map +1 -0
  182. package/core/pbf-decoder.js +702 -0
  183. package/core/process-runner.d.ts +104 -0
  184. package/core/process-runner.d.ts.map +1 -0
  185. package/core/process-runner.js +315 -0
  186. package/core/protocol-transport.d.ts +76 -0
  187. package/core/protocol-transport.d.ts.map +1 -0
  188. package/core/protocol-transport.js +15 -0
  189. package/core/query-builder.d.ts +261 -0
  190. package/core/query-builder.d.ts.map +1 -0
  191. package/core/query-builder.js +538 -0
  192. package/core/request-pipeline.d.ts +88 -0
  193. package/core/request-pipeline.d.ts.map +1 -0
  194. package/core/request-pipeline.js +273 -0
  195. package/core/spatial-filter.d.ts +93 -0
  196. package/core/spatial-filter.d.ts.map +1 -0
  197. package/core/spatial-filter.js +153 -0
  198. package/core/stac-static.d.ts +51 -0
  199. package/core/stac-static.d.ts.map +1 -0
  200. package/core/stac-static.js +195 -0
  201. package/core/stac.d.ts +67 -0
  202. package/core/stac.d.ts.map +1 -0
  203. package/core/stac.js +259 -0
  204. package/core/surfaces.d.ts +540 -0
  205. package/core/surfaces.d.ts.map +1 -0
  206. package/core/surfaces.js +1964 -0
  207. package/core/terrain-elevation.d.ts +114 -0
  208. package/core/terrain-elevation.d.ts.map +1 -0
  209. package/core/terrain-elevation.js +150 -0
  210. package/core/types.d.ts +1404 -0
  211. package/core/types.d.ts.map +1 -0
  212. package/core/types.js +13 -0
  213. package/core/wfs-capabilities.d.ts +153 -0
  214. package/core/wfs-capabilities.d.ts.map +1 -0
  215. package/core/wfs-capabilities.js +490 -0
  216. package/core/wfs-filter.d.ts +118 -0
  217. package/core/wfs-filter.d.ts.map +1 -0
  218. package/core/wfs-filter.js +634 -0
  219. package/core/wfs.d.ts +232 -0
  220. package/core/wfs.d.ts.map +1 -0
  221. package/core/wfs.js +426 -0
  222. package/core/wire-shared.d.ts +32 -0
  223. package/core/wire-shared.d.ts.map +1 -0
  224. package/core/wire-shared.js +76 -0
  225. package/core/wms-axis.d.ts +36 -0
  226. package/core/wms-axis.d.ts.map +1 -0
  227. package/core/wms-axis.js +73 -0
  228. package/core/wms-capabilities.d.ts +110 -0
  229. package/core/wms-capabilities.d.ts.map +1 -0
  230. package/core/wms-capabilities.js +559 -0
  231. package/core/wms-types.d.ts +128 -0
  232. package/core/wms-types.d.ts.map +1 -0
  233. package/core/wms-types.js +32 -0
  234. package/core/wms.d.ts +144 -0
  235. package/core/wms.d.ts.map +1 -0
  236. package/core/wms.js +338 -0
  237. package/core/wmts-capabilities.d.ts +82 -0
  238. package/core/wmts-capabilities.d.ts.map +1 -0
  239. package/core/wmts-capabilities.js +402 -0
  240. package/core/wmts.d.ts +103 -0
  241. package/core/wmts.d.ts.map +1 -0
  242. package/core/wmts.js +332 -0
  243. package/core/xml-text.d.ts +20 -0
  244. package/core/xml-text.d.ts.map +1 -0
  245. package/core/xml-text.js +85 -0
  246. package/esri-compat/basemap-gallery.d.ts +38 -0
  247. package/esri-compat/basemap-gallery.d.ts.map +1 -0
  248. package/esri-compat/basemap-gallery.js +159 -0
  249. package/esri-compat/basemap-layer-list.d.ts +35 -0
  250. package/esri-compat/basemap-layer-list.d.ts.map +1 -0
  251. package/esri-compat/basemap-layer-list.js +139 -0
  252. package/esri-compat/basemap.d.ts +32 -0
  253. package/esri-compat/basemap.d.ts.map +1 -0
  254. package/esri-compat/basemap.js +84 -0
  255. package/esri-compat/bookmarks.d.ts +36 -0
  256. package/esri-compat/bookmarks.d.ts.map +1 -0
  257. package/esri-compat/bookmarks.js +108 -0
  258. package/esri-compat/class-breaks-renderer.d.ts +50 -0
  259. package/esri-compat/class-breaks-renderer.d.ts.map +1 -0
  260. package/esri-compat/class-breaks-renderer.js +164 -0
  261. package/esri-compat/color.d.ts +22 -0
  262. package/esri-compat/color.d.ts.map +1 -0
  263. package/esri-compat/color.js +106 -0
  264. package/esri-compat/controls.d.ts +174 -0
  265. package/esri-compat/controls.d.ts.map +1 -0
  266. package/esri-compat/controls.js +479 -0
  267. package/esri-compat/coordinate-conversion.d.ts +41 -0
  268. package/esri-compat/coordinate-conversion.d.ts.map +1 -0
  269. package/esri-compat/coordinate-conversion.js +125 -0
  270. package/esri-compat/directions.d.ts +45 -0
  271. package/esri-compat/directions.d.ts.map +1 -0
  272. package/esri-compat/directions.js +123 -0
  273. package/esri-compat/editor.d.ts +47 -0
  274. package/esri-compat/editor.d.ts.map +1 -0
  275. package/esri-compat/editor.js +170 -0
  276. package/esri-compat/esri-config.d.ts +16 -0
  277. package/esri-compat/esri-config.d.ts.map +1 -0
  278. package/esri-compat/esri-config.js +23 -0
  279. package/esri-compat/esri-request.d.ts +17 -0
  280. package/esri-compat/esri-request.d.ts.map +1 -0
  281. package/esri-compat/esri-request.js +127 -0
  282. package/esri-compat/event-bus.d.ts +106 -0
  283. package/esri-compat/event-bus.d.ts.map +1 -0
  284. package/esri-compat/event-bus.js +90 -0
  285. package/esri-compat/expand.d.ts +36 -0
  286. package/esri-compat/expand.d.ts.map +1 -0
  287. package/esri-compat/expand.js +97 -0
  288. package/esri-compat/extent.d.ts +43 -0
  289. package/esri-compat/extent.d.ts.map +1 -0
  290. package/esri-compat/extent.js +140 -0
  291. package/esri-compat/feature-filter.d.ts +55 -0
  292. package/esri-compat/feature-filter.d.ts.map +1 -0
  293. package/esri-compat/feature-filter.js +109 -0
  294. package/esri-compat/feature-form.d.ts +64 -0
  295. package/esri-compat/feature-form.d.ts.map +1 -0
  296. package/esri-compat/feature-form.js +137 -0
  297. package/esri-compat/feature-layer.d.ts +173 -0
  298. package/esri-compat/feature-layer.d.ts.map +1 -0
  299. package/esri-compat/feature-layer.js +661 -0
  300. package/esri-compat/feature-set.d.ts +32 -0
  301. package/esri-compat/feature-set.d.ts.map +1 -0
  302. package/esri-compat/feature-set.js +80 -0
  303. package/esri-compat/feature-table.d.ts +141 -0
  304. package/esri-compat/feature-table.d.ts.map +1 -0
  305. package/esri-compat/feature-table.js +500 -0
  306. package/esri-compat/feature-templates.d.ts +41 -0
  307. package/esri-compat/feature-templates.d.ts.map +1 -0
  308. package/esri-compat/feature-templates.js +97 -0
  309. package/esri-compat/feature.d.ts +33 -0
  310. package/esri-compat/feature.d.ts.map +1 -0
  311. package/esri-compat/feature.js +83 -0
  312. package/esri-compat/geojson-layer.d.ts +86 -0
  313. package/esri-compat/geojson-layer.d.ts.map +1 -0
  314. package/esri-compat/geojson-layer.js +191 -0
  315. package/esri-compat/geometry-engine.d.ts +107 -0
  316. package/esri-compat/geometry-engine.d.ts.map +1 -0
  317. package/esri-compat/geometry-engine.js +266 -0
  318. package/esri-compat/graphic.d.ts +46 -0
  319. package/esri-compat/graphic.d.ts.map +1 -0
  320. package/esri-compat/graphic.js +103 -0
  321. package/esri-compat/graphics-layer.d.ts +49 -0
  322. package/esri-compat/graphics-layer.d.ts.map +1 -0
  323. package/esri-compat/graphics-layer.js +185 -0
  324. package/esri-compat/group-layer.d.ts +48 -0
  325. package/esri-compat/group-layer.d.ts.map +1 -0
  326. package/esri-compat/group-layer.js +212 -0
  327. package/esri-compat/identify.d.ts +71 -0
  328. package/esri-compat/identify.d.ts.map +1 -0
  329. package/esri-compat/identify.js +299 -0
  330. package/esri-compat/identity-manager.d.ts +74 -0
  331. package/esri-compat/identity-manager.d.ts.map +1 -0
  332. package/esri-compat/identity-manager.js +245 -0
  333. package/esri-compat/imagery-layer.d.ts +78 -0
  334. package/esri-compat/imagery-layer.d.ts.map +1 -0
  335. package/esri-compat/imagery-layer.js +167 -0
  336. package/esri-compat/label-class.d.ts +31 -0
  337. package/esri-compat/label-class.d.ts.map +1 -0
  338. package/esri-compat/label-class.js +102 -0
  339. package/esri-compat/layer-list.d.ts +77 -0
  340. package/esri-compat/layer-list.d.ts.map +1 -0
  341. package/esri-compat/layer-list.js +342 -0
  342. package/esri-compat/legend.d.ts +53 -0
  343. package/esri-compat/legend.d.ts.map +1 -0
  344. package/esri-compat/legend.js +254 -0
  345. package/esri-compat/map-image-layer.d.ts +162 -0
  346. package/esri-compat/map-image-layer.d.ts.map +1 -0
  347. package/esri-compat/map-image-layer.js +709 -0
  348. package/esri-compat/map-view.d.ts +323 -0
  349. package/esri-compat/map-view.d.ts.map +1 -0
  350. package/esri-compat/map-view.js +1175 -0
  351. package/esri-compat/map.d.ts +47 -0
  352. package/esri-compat/map.d.ts.map +1 -0
  353. package/esri-compat/map.js +209 -0
  354. package/esri-compat/measurement-2d.d.ts +61 -0
  355. package/esri-compat/measurement-2d.d.ts.map +1 -0
  356. package/esri-compat/measurement-2d.js +184 -0
  357. package/esri-compat/measurement.d.ts +45 -0
  358. package/esri-compat/measurement.d.ts.map +1 -0
  359. package/esri-compat/measurement.js +193 -0
  360. package/esri-compat/oauth-info.d.ts +50 -0
  361. package/esri-compat/oauth-info.d.ts.map +1 -0
  362. package/esri-compat/oauth-info.js +142 -0
  363. package/esri-compat/picture-marker-symbol.d.ts +35 -0
  364. package/esri-compat/picture-marker-symbol.d.ts.map +1 -0
  365. package/esri-compat/picture-marker-symbol.js +126 -0
  366. package/esri-compat/point.d.ts +31 -0
  367. package/esri-compat/point.d.ts.map +1 -0
  368. package/esri-compat/point.js +102 -0
  369. package/esri-compat/polygon.d.ts +31 -0
  370. package/esri-compat/polygon.d.ts.map +1 -0
  371. package/esri-compat/polygon.js +107 -0
  372. package/esri-compat/polyline.d.ts +31 -0
  373. package/esri-compat/polyline.d.ts.map +1 -0
  374. package/esri-compat/polyline.js +107 -0
  375. package/esri-compat/popup-template.d.ts +55 -0
  376. package/esri-compat/popup-template.d.ts.map +1 -0
  377. package/esri-compat/popup-template.js +128 -0
  378. package/esri-compat/popup.d.ts +54 -0
  379. package/esri-compat/popup.d.ts.map +1 -0
  380. package/esri-compat/popup.js +312 -0
  381. package/esri-compat/print.d.ts +47 -0
  382. package/esri-compat/print.d.ts.map +1 -0
  383. package/esri-compat/print.js +105 -0
  384. package/esri-compat/query.d.ts +58 -0
  385. package/esri-compat/query.d.ts.map +1 -0
  386. package/esri-compat/query.js +128 -0
  387. package/esri-compat/reactive-utils.d.ts +24 -0
  388. package/esri-compat/reactive-utils.d.ts.map +1 -0
  389. package/esri-compat/reactive-utils.js +193 -0
  390. package/esri-compat/request.d.ts +41 -0
  391. package/esri-compat/request.d.ts.map +1 -0
  392. package/esri-compat/request.js +253 -0
  393. package/esri-compat/route-layer.d.ts +59 -0
  394. package/esri-compat/route-layer.d.ts.map +1 -0
  395. package/esri-compat/route-layer.js +223 -0
  396. package/esri-compat/route-task.d.ts +88 -0
  397. package/esri-compat/route-task.d.ts.map +1 -0
  398. package/esri-compat/route-task.js +225 -0
  399. package/esri-compat/scene-view.d.ts +41 -0
  400. package/esri-compat/scene-view.d.ts.map +1 -0
  401. package/esri-compat/scene-view.js +68 -0
  402. package/esri-compat/search.d.ts +112 -0
  403. package/esri-compat/search.d.ts.map +1 -0
  404. package/esri-compat/search.js +820 -0
  405. package/esri-compat/simple-fill-symbol.d.ts +27 -0
  406. package/esri-compat/simple-fill-symbol.d.ts.map +1 -0
  407. package/esri-compat/simple-fill-symbol.js +85 -0
  408. package/esri-compat/simple-line-symbol.d.ts +27 -0
  409. package/esri-compat/simple-line-symbol.d.ts.map +1 -0
  410. package/esri-compat/simple-line-symbol.js +85 -0
  411. package/esri-compat/simple-marker-symbol.d.ts +29 -0
  412. package/esri-compat/simple-marker-symbol.d.ts.map +1 -0
  413. package/esri-compat/simple-marker-symbol.js +92 -0
  414. package/esri-compat/simple-renderer.d.ts +29 -0
  415. package/esri-compat/simple-renderer.d.ts.map +1 -0
  416. package/esri-compat/simple-renderer.js +92 -0
  417. package/esri-compat/sketch.d.ts +64 -0
  418. package/esri-compat/sketch.d.ts.map +1 -0
  419. package/esri-compat/sketch.js +227 -0
  420. package/esri-compat/spatial-reference.d.ts +31 -0
  421. package/esri-compat/spatial-reference.d.ts.map +1 -0
  422. package/esri-compat/spatial-reference.js +102 -0
  423. package/esri-compat/swipe.d.ts +34 -0
  424. package/esri-compat/swipe.d.ts.map +1 -0
  425. package/esri-compat/swipe.js +93 -0
  426. package/esri-compat/table-list.d.ts +36 -0
  427. package/esri-compat/table-list.d.ts.map +1 -0
  428. package/esri-compat/table-list.js +126 -0
  429. package/esri-compat/text-symbol.d.ts +37 -0
  430. package/esri-compat/text-symbol.d.ts.map +1 -0
  431. package/esri-compat/text-symbol.js +123 -0
  432. package/esri-compat/tile-layer.d.ts +52 -0
  433. package/esri-compat/tile-layer.d.ts.map +1 -0
  434. package/esri-compat/tile-layer.js +168 -0
  435. package/esri-compat/time-slider.d.ts +70 -0
  436. package/esri-compat/time-slider.d.ts.map +1 -0
  437. package/esri-compat/time-slider.js +208 -0
  438. package/esri-compat/track.d.ts +51 -0
  439. package/esri-compat/track.d.ts.map +1 -0
  440. package/esri-compat/track.js +174 -0
  441. package/esri-compat/unique-value-renderer.d.ts +41 -0
  442. package/esri-compat/unique-value-renderer.d.ts.map +1 -0
  443. package/esri-compat/unique-value-renderer.js +127 -0
  444. package/esri-compat/url.d.ts +13 -0
  445. package/esri-compat/url.d.ts.map +1 -0
  446. package/esri-compat/url.js +68 -0
  447. package/esri-compat/vector-tile-layer.d.ts +47 -0
  448. package/esri-compat/vector-tile-layer.d.ts.map +1 -0
  449. package/esri-compat/vector-tile-layer.js +130 -0
  450. package/esri-compat/web-map.d.ts +14 -0
  451. package/esri-compat/web-map.d.ts.map +1 -0
  452. package/esri-compat/web-map.js +24 -0
  453. package/esri-compat/wfs-layer.d.ts +64 -0
  454. package/esri-compat/wfs-layer.d.ts.map +1 -0
  455. package/esri-compat/wfs-layer.js +145 -0
  456. package/esri-compat/wms-layer.d.ts +76 -0
  457. package/esri-compat/wms-layer.d.ts.map +1 -0
  458. package/esri-compat/wms-layer.js +157 -0
  459. package/exploration/context.d.ts +25 -0
  460. package/exploration/context.d.ts.map +1 -0
  461. package/exploration/context.js +396 -0
  462. package/exploration/index.d.ts +27 -0
  463. package/exploration/index.d.ts.map +1 -0
  464. package/exploration/index.js +24 -0
  465. package/exploration/presets.d.ts +27 -0
  466. package/exploration/presets.d.ts.map +1 -0
  467. package/exploration/presets.js +114 -0
  468. package/exploration/reducer.d.ts +23 -0
  469. package/exploration/reducer.d.ts.map +1 -0
  470. package/exploration/reducer.js +332 -0
  471. package/exploration/selection.d.ts +25 -0
  472. package/exploration/selection.d.ts.map +1 -0
  473. package/exploration/selection.js +34 -0
  474. package/exploration/selectors.d.ts +56 -0
  475. package/exploration/selectors.d.ts.map +1 -0
  476. package/exploration/selectors.js +110 -0
  477. package/exploration/types.d.ts +294 -0
  478. package/exploration/types.d.ts.map +1 -0
  479. package/exploration/types.js +33 -0
  480. package/expr/expression.d.ts +457 -0
  481. package/expr/expression.d.ts.map +1 -0
  482. package/expr/expression.js +663 -0
  483. package/expr/index.d.ts +32 -0
  484. package/expr/index.d.ts.map +1 -0
  485. package/expr/index.js +30 -0
  486. package/filter-registry/index.d.ts +145 -0
  487. package/filter-registry/index.d.ts.map +1 -0
  488. package/filter-registry/index.js +531 -0
  489. package/gen/honua/v1/feature_service_pb.d.ts +918 -0
  490. package/gen/honua/v1/feature_service_pb.d.ts.map +1 -0
  491. package/gen/honua/v1/feature_service_pb.js +375 -0
  492. package/generated-app/errors.d.ts +41 -0
  493. package/generated-app/errors.d.ts.map +1 -0
  494. package/generated-app/errors.js +41 -0
  495. package/generated-app/index.d.ts +17 -0
  496. package/generated-app/index.d.ts.map +1 -0
  497. package/generated-app/index.js +12 -0
  498. package/generated-app/manifest.d.ts +183 -0
  499. package/generated-app/manifest.d.ts.map +1 -0
  500. package/generated-app/manifest.js +14 -0
  501. package/generated-app/projection.d.ts +44 -0
  502. package/generated-app/projection.d.ts.map +1 -0
  503. package/generated-app/projection.js +234 -0
  504. package/generated-app/runtime.d.ts +215 -0
  505. package/generated-app/runtime.d.ts.map +1 -0
  506. package/generated-app/runtime.js +1196 -0
  507. package/geocoding/index.d.ts +106 -0
  508. package/geocoding/index.d.ts.map +1 -0
  509. package/geocoding/index.js +278 -0
  510. package/interactions/detail-model.d.ts +54 -0
  511. package/interactions/detail-model.d.ts.map +1 -0
  512. package/interactions/detail-model.js +105 -0
  513. package/interactions/exploration-bindings.d.ts +120 -0
  514. package/interactions/exploration-bindings.d.ts.map +1 -0
  515. package/interactions/exploration-bindings.js +218 -0
  516. package/interactions/feature-state.d.ts +144 -0
  517. package/interactions/feature-state.d.ts.map +1 -0
  518. package/interactions/feature-state.js +169 -0
  519. package/interactions/hit-test.d.ts +112 -0
  520. package/interactions/hit-test.d.ts.map +1 -0
  521. package/interactions/hit-test.js +291 -0
  522. package/interactions/index.d.ts +31 -0
  523. package/interactions/index.d.ts.map +1 -0
  524. package/interactions/index.js +24 -0
  525. package/interactions/share-state.d.ts +36 -0
  526. package/interactions/share-state.d.ts.map +1 -0
  527. package/interactions/share-state.js +123 -0
  528. package/map/feature-service-adapter.d.ts +138 -0
  529. package/map/feature-service-adapter.d.ts.map +1 -0
  530. package/map/feature-service-adapter.js +279 -0
  531. package/map/honua-map.d.ts +203 -0
  532. package/map/honua-map.d.ts.map +1 -0
  533. package/map/honua-map.js +347 -0
  534. package/map/index.d.ts +27 -0
  535. package/map/index.d.ts.map +1 -0
  536. package/map/index.js +22 -0
  537. package/map/maplibre-target.d.ts +103 -0
  538. package/map/maplibre-target.d.ts.map +1 -0
  539. package/map/maplibre-target.js +164 -0
  540. package/map/webmap-maplibre.d.ts +60 -0
  541. package/map/webmap-maplibre.d.ts.map +1 -0
  542. package/map/webmap-maplibre.js +212 -0
  543. package/operate/client.d.ts +94 -0
  544. package/operate/client.d.ts.map +1 -0
  545. package/operate/client.js +361 -0
  546. package/operate/index.d.ts +22 -0
  547. package/operate/index.d.ts.map +1 -0
  548. package/operate/index.js +19 -0
  549. package/operate/types.d.ts +397 -0
  550. package/operate/types.d.ts.map +1 -0
  551. package/operate/types.js +17 -0
  552. package/operator/client.d.ts +60 -0
  553. package/operator/client.d.ts.map +1 -0
  554. package/operator/client.js +20 -0
  555. package/operator/controllers/approval.d.ts +52 -0
  556. package/operator/controllers/approval.d.ts.map +1 -0
  557. package/operator/controllers/approval.js +123 -0
  558. package/operator/controllers/base.d.ts +27 -0
  559. package/operator/controllers/base.d.ts.map +1 -0
  560. package/operator/controllers/base.js +53 -0
  561. package/operator/controllers/builder-workspace.d.ts +55 -0
  562. package/operator/controllers/builder-workspace.d.ts.map +1 -0
  563. package/operator/controllers/builder-workspace.js +108 -0
  564. package/operator/controllers/chat.d.ts +61 -0
  565. package/operator/controllers/chat.d.ts.map +1 -0
  566. package/operator/controllers/chat.js +154 -0
  567. package/operator/controllers/clarification.d.ts +52 -0
  568. package/operator/controllers/clarification.d.ts.map +1 -0
  569. package/operator/controllers/clarification.js +121 -0
  570. package/operator/controllers/execution.d.ts +60 -0
  571. package/operator/controllers/execution.d.ts.map +1 -0
  572. package/operator/controllers/execution.js +286 -0
  573. package/operator/controllers/index.d.ts +23 -0
  574. package/operator/controllers/index.d.ts.map +1 -0
  575. package/operator/controllers/index.js +15 -0
  576. package/operator/controllers/map-workspace.d.ts +85 -0
  577. package/operator/controllers/map-workspace.d.ts.map +1 -0
  578. package/operator/controllers/map-workspace.js +296 -0
  579. package/operator/controllers/plan-review.d.ts +66 -0
  580. package/operator/controllers/plan-review.d.ts.map +1 -0
  581. package/operator/controllers/plan-review.js +124 -0
  582. package/operator/errors.d.ts +62 -0
  583. package/operator/errors.d.ts.map +1 -0
  584. package/operator/errors.js +75 -0
  585. package/operator/i18n/index.d.ts +10 -0
  586. package/operator/i18n/index.d.ts.map +1 -0
  587. package/operator/i18n/index.js +8 -0
  588. package/operator/i18n/messages.d.ts +19 -0
  589. package/operator/i18n/messages.d.ts.map +1 -0
  590. package/operator/i18n/messages.js +54 -0
  591. package/operator/index.d.ts +19 -0
  592. package/operator/index.d.ts.map +1 -0
  593. package/operator/index.js +15 -0
  594. package/operator/telemetry.d.ts +26 -0
  595. package/operator/telemetry.d.ts.map +1 -0
  596. package/operator/telemetry.js +9 -0
  597. package/operator/theming/index.d.ts +12 -0
  598. package/operator/theming/index.d.ts.map +1 -0
  599. package/operator/theming/index.js +9 -0
  600. package/operator/theming/provider.d.ts +27 -0
  601. package/operator/theming/provider.d.ts.map +1 -0
  602. package/operator/theming/provider.js +26 -0
  603. package/operator/theming/tokens.d.ts +28 -0
  604. package/operator/theming/tokens.d.ts.map +1 -0
  605. package/operator/theming/tokens.js +65 -0
  606. package/operator/workspace/events.d.ts +70 -0
  607. package/operator/workspace/events.d.ts.map +1 -0
  608. package/operator/workspace/events.js +9 -0
  609. package/operator/workspace/index.d.ts +12 -0
  610. package/operator/workspace/index.d.ts.map +1 -0
  611. package/operator/workspace/index.js +8 -0
  612. package/operator/workspace/types.d.ts +178 -0
  613. package/operator/workspace/types.d.ts.map +1 -0
  614. package/operator/workspace/types.js +47 -0
  615. package/operator/workspace/workspace.d.ts +58 -0
  616. package/operator/workspace/workspace.d.ts.map +1 -0
  617. package/operator/workspace/workspace.js +339 -0
  618. package/package.json +105 -0
  619. package/realtime/exploration.d.ts +16 -0
  620. package/realtime/exploration.d.ts.map +1 -0
  621. package/realtime/exploration.js +32 -0
  622. package/realtime/honua-server.d.ts +123 -0
  623. package/realtime/honua-server.d.ts.map +1 -0
  624. package/realtime/honua-server.js +188 -0
  625. package/realtime/index.d.ts +20 -0
  626. package/realtime/index.d.ts.map +1 -0
  627. package/realtime/index.js +14 -0
  628. package/realtime/projections.d.ts +30 -0
  629. package/realtime/projections.d.ts.map +1 -0
  630. package/realtime/projections.js +51 -0
  631. package/realtime/reducer.d.ts +14 -0
  632. package/realtime/reducer.d.ts.map +1 -0
  633. package/realtime/reducer.js +351 -0
  634. package/realtime/sse.d.ts +23 -0
  635. package/realtime/sse.d.ts.map +1 -0
  636. package/realtime/sse.js +143 -0
  637. package/realtime/store.d.ts +18 -0
  638. package/realtime/store.d.ts.map +1 -0
  639. package/realtime/store.js +63 -0
  640. package/realtime/types.d.ts +190 -0
  641. package/realtime/types.d.ts.map +1 -0
  642. package/realtime/types.js +10 -0
  643. package/replica-sync/client.d.ts +32 -0
  644. package/replica-sync/client.d.ts.map +1 -0
  645. package/replica-sync/client.js +52 -0
  646. package/replica-sync/errors.d.ts +22 -0
  647. package/replica-sync/errors.d.ts.map +1 -0
  648. package/replica-sync/errors.js +29 -0
  649. package/replica-sync/fixture.d.ts +40 -0
  650. package/replica-sync/fixture.d.ts.map +1 -0
  651. package/replica-sync/fixture.js +364 -0
  652. package/replica-sync/index.d.ts +22 -0
  653. package/replica-sync/index.d.ts.map +1 -0
  654. package/replica-sync/index.js +17 -0
  655. package/replica-sync/types.d.ts +270 -0
  656. package/replica-sync/types.d.ts.map +1 -0
  657. package/replica-sync/types.js +13 -0
  658. package/runtime/diff.d.ts +31 -0
  659. package/runtime/diff.d.ts.map +1 -0
  660. package/runtime/diff.js +143 -0
  661. package/runtime/errors.d.ts +40 -0
  662. package/runtime/errors.d.ts.map +1 -0
  663. package/runtime/errors.js +35 -0
  664. package/runtime/index.d.ts +59 -0
  665. package/runtime/index.d.ts.map +1 -0
  666. package/runtime/index.js +40 -0
  667. package/runtime/legend.d.ts +23 -0
  668. package/runtime/legend.d.ts.map +1 -0
  669. package/runtime/legend.js +38 -0
  670. package/runtime/load-package.d.ts +125 -0
  671. package/runtime/load-package.d.ts.map +1 -0
  672. package/runtime/load-package.js +272 -0
  673. package/runtime/map-package-fetch.d.ts +107 -0
  674. package/runtime/map-package-fetch.d.ts.map +1 -0
  675. package/runtime/map-package-fetch.js +336 -0
  676. package/runtime/map-package-realtime.d.ts +169 -0
  677. package/runtime/map-package-realtime.d.ts.map +1 -0
  678. package/runtime/map-package-realtime.js +350 -0
  679. package/runtime/map-package-validation.d.ts +30 -0
  680. package/runtime/map-package-validation.d.ts.map +1 -0
  681. package/runtime/map-package-validation.js +257 -0
  682. package/runtime/map-package-watch.d.ts +78 -0
  683. package/runtime/map-package-watch.d.ts.map +1 -0
  684. package/runtime/map-package-watch.js +695 -0
  685. package/runtime/map-package.d.ts +167 -0
  686. package/runtime/map-package.d.ts.map +1 -0
  687. package/runtime/map-package.js +15 -0
  688. package/runtime/ogc-styles.d.ts +110 -0
  689. package/runtime/ogc-styles.d.ts.map +1 -0
  690. package/runtime/ogc-styles.js +195 -0
  691. package/runtime/pmtiles-protocol.d.ts +77 -0
  692. package/runtime/pmtiles-protocol.d.ts.map +1 -0
  693. package/runtime/pmtiles-protocol.js +120 -0
  694. package/runtime/popups.d.ts +62 -0
  695. package/runtime/popups.d.ts.map +1 -0
  696. package/runtime/popups.js +95 -0
  697. package/runtime/query-tiles.d.ts +217 -0
  698. package/runtime/query-tiles.d.ts.map +1 -0
  699. package/runtime/query-tiles.js +801 -0
  700. package/runtime/runtime.d.ts +243 -0
  701. package/runtime/runtime.d.ts.map +1 -0
  702. package/runtime/runtime.js +1147 -0
  703. package/runtime/source-bridge.d.ts +99 -0
  704. package/runtime/source-bridge.d.ts.map +1 -0
  705. package/runtime/source-bridge.js +428 -0
  706. package/runtime/style-compose.d.ts +46 -0
  707. package/runtime/style-compose.d.ts.map +1 -0
  708. package/runtime/style-compose.js +144 -0
  709. package/runtime/style-interactions.d.ts +141 -0
  710. package/runtime/style-interactions.d.ts.map +1 -0
  711. package/runtime/style-interactions.js +574 -0
  712. package/runtime/style-spec-validation.d.ts +23 -0
  713. package/runtime/style-spec-validation.d.ts.map +1 -0
  714. package/runtime/style-spec-validation.js +357 -0
  715. package/scene-workspace/analysis-widgets.d.ts +334 -0
  716. package/scene-workspace/analysis-widgets.d.ts.map +1 -0
  717. package/scene-workspace/analysis-widgets.js +424 -0
  718. package/scene-workspace/cesium-adapter.d.ts +438 -0
  719. package/scene-workspace/cesium-adapter.d.ts.map +1 -0
  720. package/scene-workspace/cesium-adapter.js +493 -0
  721. package/scene-workspace/index.d.ts +21 -0
  722. package/scene-workspace/index.d.ts.map +1 -0
  723. package/scene-workspace/index.js +14 -0
  724. package/scene-workspace/primitives.d.ts +162 -0
  725. package/scene-workspace/primitives.d.ts.map +1 -0
  726. package/scene-workspace/primitives.js +255 -0
  727. package/scene-workspace/scene-discovery.d.ts +196 -0
  728. package/scene-workspace/scene-discovery.d.ts.map +1 -0
  729. package/scene-workspace/scene-discovery.js +228 -0
  730. package/scene-workspace/scene-view.d.ts +209 -0
  731. package/scene-workspace/scene-view.d.ts.map +1 -0
  732. package/scene-workspace/scene-view.js +267 -0
  733. package/scene-workspace/types.d.ts +229 -0
  734. package/scene-workspace/types.d.ts.map +1 -0
  735. package/scene-workspace/types.js +23 -0
  736. package/scene-workspace/workspace.d.ts +13 -0
  737. package/scene-workspace/workspace.d.ts.map +1 -0
  738. package/scene-workspace/workspace.js +391 -0
  739. package/share/denial.d.ts +78 -0
  740. package/share/denial.d.ts.map +1 -0
  741. package/share/denial.js +61 -0
  742. package/share/embed-token.d.ts +71 -0
  743. package/share/embed-token.d.ts.map +1 -0
  744. package/share/embed-token.js +99 -0
  745. package/share/index.d.ts +35 -0
  746. package/share/index.d.ts.map +1 -0
  747. package/share/index.js +30 -0
  748. package/share/open-data.d.ts +114 -0
  749. package/share/open-data.d.ts.map +1 -0
  750. package/share/open-data.js +81 -0
  751. package/share/types.d.ts +163 -0
  752. package/share/types.d.ts.map +1 -0
  753. package/share/types.js +17 -0
  754. package/studio/capability-manifest.d.ts +285 -0
  755. package/studio/capability-manifest.d.ts.map +1 -0
  756. package/studio/capability-manifest.js +59 -0
  757. package/studio/chart-spec.d.ts +85 -0
  758. package/studio/chart-spec.d.ts.map +1 -0
  759. package/studio/chart-spec.js +106 -0
  760. package/studio/index.d.ts +34 -0
  761. package/studio/index.d.ts.map +1 -0
  762. package/studio/index.js +27 -0
  763. package/studio/provenance.d.ts +131 -0
  764. package/studio/provenance.d.ts.map +1 -0
  765. package/studio/provenance.js +39 -0
  766. package/studio/publish.d.ts +64 -0
  767. package/studio/publish.d.ts.map +1 -0
  768. package/studio/publish.js +13 -0
  769. package/studio/types.d.ts +278 -0
  770. package/studio/types.d.ts.map +1 -0
  771. package/studio/types.js +71 -0
  772. package/studio/validate.d.ts +45 -0
  773. package/studio/validate.d.ts.map +1 -0
  774. package/studio/validate.js +255 -0
  775. package/studio/validation.d.ts +112 -0
  776. package/studio/validation.d.ts.map +1 -0
  777. package/studio/validation.js +42 -0
  778. package/style/factory.d.ts +30 -0
  779. package/style/factory.d.ts.map +1 -0
  780. package/style/factory.js +61 -0
  781. package/style/index.d.ts +25 -0
  782. package/style/index.d.ts.map +1 -0
  783. package/style/index.js +24 -0
  784. package/style/specification.d.ts +203 -0
  785. package/style/specification.d.ts.map +1 -0
  786. package/style/specification.js +178 -0
  787. package/style/wms-wmts-resolvers.d.ts +38 -0
  788. package/style/wms-wmts-resolvers.d.ts.map +1 -0
  789. package/style/wms-wmts-resolvers.js +92 -0
  790. package/web-components/controller.d.ts +39 -0
  791. package/web-components/controller.d.ts.map +1 -0
  792. package/web-components/controller.js +640 -0
  793. package/web-components/elements.d.ts +210 -0
  794. package/web-components/elements.d.ts.map +1 -0
  795. package/web-components/elements.js +1651 -0
  796. package/web-components/index.d.ts +24 -0
  797. package/web-components/index.d.ts.map +1 -0
  798. package/web-components/index.js +22 -0
  799. package/web-components/maplibre-renderer.d.ts +22 -0
  800. package/web-components/maplibre-renderer.d.ts.map +1 -0
  801. package/web-components/maplibre-renderer.js +474 -0
  802. package/web-components/types.d.ts +397 -0
  803. package/web-components/types.d.ts.map +1 -0
  804. package/web-components/types.js +1 -0
  805. package/webmap/contract.d.ts +28 -0
  806. package/webmap/contract.d.ts.map +1 -0
  807. package/webmap/contract.js +130 -0
  808. package/webmap/convert-basemap.d.ts +17 -0
  809. package/webmap/convert-basemap.d.ts.map +1 -0
  810. package/webmap/convert-basemap.js +78 -0
  811. package/webmap/convert-extent.d.ts +17 -0
  812. package/webmap/convert-extent.d.ts.map +1 -0
  813. package/webmap/convert-extent.js +114 -0
  814. package/webmap/convert-label.d.ts +13 -0
  815. package/webmap/convert-label.d.ts.map +1 -0
  816. package/webmap/convert-label.js +125 -0
  817. package/webmap/convert-layer.d.ts +22 -0
  818. package/webmap/convert-layer.d.ts.map +1 -0
  819. package/webmap/convert-layer.js +181 -0
  820. package/webmap/convert-popup.d.ts +34 -0
  821. package/webmap/convert-popup.d.ts.map +1 -0
  822. package/webmap/convert-popup.js +68 -0
  823. package/webmap/convert-renderer.d.ts +17 -0
  824. package/webmap/convert-renderer.d.ts.map +1 -0
  825. package/webmap/convert-renderer.js +161 -0
  826. package/webmap/convert-symbol.d.ts +17 -0
  827. package/webmap/convert-symbol.d.ts.map +1 -0
  828. package/webmap/convert-symbol.js +122 -0
  829. package/webmap/index.d.ts +44 -0
  830. package/webmap/index.d.ts.map +1 -0
  831. package/webmap/index.js +33 -0
  832. package/webmap/parse.d.ts +25 -0
  833. package/webmap/parse.d.ts.map +1 -0
  834. package/webmap/parse.js +83 -0
  835. package/webmap/types.d.ts +264 -0
  836. package/webmap/types.d.ts.map +1 -0
  837. package/webmap/types.js +13 -0
  838. package/webmap/warnings.d.ts +30 -0
  839. package/webmap/warnings.d.ts.map +1 -0
  840. package/webmap/warnings.js +37 -0
@@ -0,0 +1,1964 @@
1
+ import { HonuaJobPollTimeoutError, isJobTerminal } from "../contract/jobs.js";
2
+ import { FEATURE_SERVER_H3_SPATIAL_AGGREGATION_INDEX_MODEL_ID, SPATIAL_AGGREGATION_METADATA_SCHEMA_VERSION, SPATIAL_AGGREGATION_SCHEMA_VERSION, assertFeatureServerH3SpatialAggregationRequest, spatialAggregationWidgets, } from "../contract/spatial-aggregation.js";
3
+ import { encodeServiceIdPath } from "./path-utils.js";
4
+ import { responseExceededTransferLimit } from "./wire-shared.js";
5
+ export class HonuaService {
6
+ client;
7
+ serviceId;
8
+ constructor(options) {
9
+ this.client = options.client;
10
+ this.serviceId = options.serviceId;
11
+ }
12
+ featureLayer(layerId) {
13
+ return new HonuaFeatureLayer({
14
+ client: this.client,
15
+ serviceId: this.serviceId,
16
+ layerId,
17
+ });
18
+ }
19
+ layer(layerId) {
20
+ return this.featureLayer(layerId);
21
+ }
22
+ async featureServiceMetadata(options = {}) {
23
+ return this.client.getFeatureServiceMetadata(this.serviceId, options);
24
+ }
25
+ async mapServiceMetadata(options = {}) {
26
+ return this.client.getMapServiceMetadata(this.serviceId, options);
27
+ }
28
+ async featureLayerIds() {
29
+ const metadata = await this.featureServiceMetadata();
30
+ return extractLayerIds(metadata);
31
+ }
32
+ async featureLayers() {
33
+ const ids = await this.featureLayerIds();
34
+ return ids.map((layerId) => new HonuaFeatureLayer({
35
+ client: this.client,
36
+ serviceId: this.serviceId,
37
+ layerId,
38
+ }));
39
+ }
40
+ async mapLayerIds() {
41
+ const metadata = await this.mapServiceMetadata();
42
+ return extractLayerIds(metadata);
43
+ }
44
+ async mapLayers() {
45
+ const ids = await this.mapLayerIds();
46
+ return ids.map((layerId) => new HonuaMapLayer({
47
+ client: this.client,
48
+ serviceId: this.serviceId,
49
+ layerId,
50
+ }));
51
+ }
52
+ async request(request) {
53
+ return this.client.request({
54
+ ...request,
55
+ path: `/rest/services/${encodeServiceIdPath(this.serviceId)}/${normalizeServicePath(request.path)}`,
56
+ });
57
+ }
58
+ mapService() {
59
+ return new HonuaMapService({
60
+ client: this.client,
61
+ serviceId: this.serviceId,
62
+ });
63
+ }
64
+ mapLayer(layerId) {
65
+ return new HonuaMapLayer({
66
+ client: this.client,
67
+ serviceId: this.serviceId,
68
+ layerId,
69
+ });
70
+ }
71
+ }
72
+ export class HonuaFeatureLayer {
73
+ client;
74
+ serviceId;
75
+ layerId;
76
+ constructor(options) {
77
+ this.client = options.client;
78
+ this.serviceId = options.serviceId;
79
+ this.layerId = options.layerId;
80
+ }
81
+ async metadata(options = {}) {
82
+ return this.client.getLayerMetadata(this.serviceId, this.layerId, options);
83
+ }
84
+ createQuery() {
85
+ return {
86
+ where: "1=1",
87
+ outFields: ["*"],
88
+ returnGeometry: true,
89
+ };
90
+ }
91
+ async queryFeatures(request = {}) {
92
+ return this.client.queryFeatures({
93
+ serviceId: this.serviceId,
94
+ layerId: this.layerId,
95
+ ...request,
96
+ });
97
+ }
98
+ async queryFeaturesAll(request = {}) {
99
+ const pageSize = typeof request.pageSize === "number" && Number.isFinite(request.pageSize)
100
+ ? Math.max(1, Math.trunc(request.pageSize))
101
+ : 2000;
102
+ const maxPages = typeof request.maxPages === "number" && Number.isFinite(request.maxPages)
103
+ ? Math.max(1, Math.trunc(request.maxPages))
104
+ : 100;
105
+ const startingOffset = normalizeOffset(request.resultOffset);
106
+ const features = [];
107
+ let offset = startingOffset;
108
+ for (let page = 0; page < maxPages; page += 1) {
109
+ const response = await this.queryFeatures({
110
+ ...request,
111
+ extraParams: {
112
+ ...(request.extraParams ?? {}),
113
+ resultOffset: offset,
114
+ resultRecordCount: pageSize,
115
+ },
116
+ });
117
+ const pageFeatures = response.features ?? [];
118
+ if (pageFeatures.length === 0) {
119
+ break;
120
+ }
121
+ features.push(...pageFeatures);
122
+ offset += pageFeatures.length;
123
+ if (!responseExceededTransferLimit(response) && pageFeatures.length < pageSize) {
124
+ break;
125
+ }
126
+ }
127
+ return features;
128
+ }
129
+ async *queryFeaturesStream(request = {}) {
130
+ const pageSize = typeof request.pageSize === "number" && Number.isFinite(request.pageSize)
131
+ ? Math.max(1, Math.trunc(request.pageSize))
132
+ : 2000;
133
+ const maxPages = typeof request.maxPages === "number" && Number.isFinite(request.maxPages)
134
+ ? Math.max(1, Math.trunc(request.maxPages))
135
+ : 100;
136
+ const startingOffset = normalizeOffset(request.resultOffset);
137
+ // Use server streaming RPC when gRPC-Web transport is active
138
+ if (this.client.isGrpcWeb) {
139
+ const { pageSize: _pageSize, maxPages: _maxPages, ...queryRequest } = request;
140
+ let pageCount = 0;
141
+ const stream = this.client.queryFeaturesStream({
142
+ serviceId: this.serviceId,
143
+ layerId: this.layerId,
144
+ ...queryRequest,
145
+ resultRecordCount: queryRequest.resultRecordCount ?? pageSize,
146
+ });
147
+ for await (const page of stream) {
148
+ yield page;
149
+ pageCount += 1;
150
+ if (pageCount >= maxPages) {
151
+ break;
152
+ }
153
+ }
154
+ return;
155
+ }
156
+ let offset = startingOffset;
157
+ for (let page = 0; page < maxPages; page += 1) {
158
+ const response = await this.queryFeatures({
159
+ ...request,
160
+ extraParams: {
161
+ ...(request.extraParams ?? {}),
162
+ resultOffset: offset,
163
+ resultRecordCount: pageSize,
164
+ },
165
+ });
166
+ const pageFeatures = response.features ?? [];
167
+ if (pageFeatures.length === 0) {
168
+ break;
169
+ }
170
+ yield pageFeatures;
171
+ offset += pageFeatures.length;
172
+ if (!responseExceededTransferLimit(response) && pageFeatures.length < pageSize) {
173
+ break;
174
+ }
175
+ }
176
+ }
177
+ async queryFeatureCount(request = {}) {
178
+ const response = await this.client.queryFeatures({
179
+ serviceId: this.serviceId,
180
+ layerId: this.layerId,
181
+ where: request.where ?? "1=1",
182
+ returnGeometry: false,
183
+ outFields: "OBJECTID",
184
+ method: request.method,
185
+ extraParams: {
186
+ returnCountOnly: true,
187
+ ...request.extraParams,
188
+ },
189
+ });
190
+ if (isObject(response) && typeof response.count === "number" && Number.isFinite(response.count)) {
191
+ return response.count;
192
+ }
193
+ if (isObject(response) && Array.isArray(response.features)) {
194
+ return response.features.length;
195
+ }
196
+ return 0;
197
+ }
198
+ async queryObjectIds(request = {}) {
199
+ const response = await this.client.queryFeatures({
200
+ ...request,
201
+ serviceId: this.serviceId,
202
+ layerId: this.layerId,
203
+ where: request.where ?? "1=1",
204
+ returnGeometry: false,
205
+ outFields: request.outFields ?? "OBJECTID",
206
+ extraParams: {
207
+ returnIdsOnly: true,
208
+ ...request.extraParams,
209
+ },
210
+ });
211
+ if (isObject(response) && Array.isArray(response.objectIds)) {
212
+ return response.objectIds
213
+ .map((value) => Number(value))
214
+ .filter((value) => Number.isFinite(value));
215
+ }
216
+ return [];
217
+ }
218
+ async queryExtent(request = {}) {
219
+ const response = await this.client.queryFeatures({
220
+ serviceId: this.serviceId,
221
+ layerId: this.layerId,
222
+ where: request.where ?? "1=1",
223
+ returnGeometry: false,
224
+ method: request.method,
225
+ extraParams: {
226
+ returnExtentOnly: true,
227
+ ...request.extraParams,
228
+ },
229
+ });
230
+ return extractExtentFromResponse(response);
231
+ }
232
+ async querySpatialAggregation(request) {
233
+ const sourceId = request.sourceId ?? defaultFeatureLayerSourceId(this.serviceId, this.layerId);
234
+ const normalizedRequest = {
235
+ ...request,
236
+ sourceId,
237
+ };
238
+ assertFeatureServerH3SpatialAggregationRequest(normalizedRequest);
239
+ const plan = createFeatureServerH3AggregationPlan(normalizedRequest, request.kRingDistance);
240
+ const path = `/rest/services/${encodeServiceIdPath(this.serviceId)}/FeatureServer/${this.layerId}/queryH3`;
241
+ const method = request.method ?? "POST";
242
+ const response = method === "GET"
243
+ ? await this.client.request({
244
+ method,
245
+ path,
246
+ responseFormat: request.responseFormat ?? "json",
247
+ query: plan.params,
248
+ signal: request.signal,
249
+ })
250
+ : await this.client.request({
251
+ method,
252
+ path,
253
+ responseFormat: request.responseFormat ?? "json",
254
+ headers: {
255
+ "Content-Type": "application/x-www-form-urlencoded",
256
+ },
257
+ body: toFormBody(plan.params),
258
+ signal: request.signal,
259
+ });
260
+ return featureServerH3AggregationResultFromResponse(response, normalizedRequest, plan);
261
+ }
262
+ async queryRelatedRecords(request) {
263
+ return this.client.queryRelatedRecords({
264
+ serviceId: this.serviceId,
265
+ layerId: this.layerId,
266
+ ...request,
267
+ });
268
+ }
269
+ async queryRelatedFeatures(request) {
270
+ return this.queryRelatedRecords(request);
271
+ }
272
+ async applyEdits(request) {
273
+ return this.client.applyEdits({
274
+ serviceId: this.serviceId,
275
+ layerId: this.layerId,
276
+ ...request,
277
+ });
278
+ }
279
+ async queryAttachments(request = {}) {
280
+ const method = request.method ?? "GET";
281
+ const path = `/rest/services/${encodeServiceIdPath(this.serviceId)}` + `/FeatureServer/${this.layerId}/queryAttachments`;
282
+ const query = {
283
+ ...(request.objectIds === undefined
284
+ ? {}
285
+ : {
286
+ objectIds: normalizeObjectIds(request.objectIds),
287
+ }),
288
+ ...(request.where === undefined ? {} : { where: request.where }),
289
+ ...(request.extraParams ?? {}),
290
+ };
291
+ if (method === "GET") {
292
+ return this.client.request({
293
+ method: "GET",
294
+ path,
295
+ responseFormat: request.responseFormat ?? "json",
296
+ query,
297
+ signal: request.signal,
298
+ });
299
+ }
300
+ const body = toFormBody({
301
+ f: request.responseFormat ?? "json",
302
+ ...query,
303
+ });
304
+ return this.client.request({
305
+ method: "POST",
306
+ path,
307
+ headers: {
308
+ "Content-Type": "application/x-www-form-urlencoded",
309
+ },
310
+ body,
311
+ signal: request.signal,
312
+ });
313
+ }
314
+ async listAttachments(request) {
315
+ return this.client.request({
316
+ method: "GET",
317
+ path: `/rest/services/${encodeServiceIdPath(this.serviceId)}` +
318
+ `/FeatureServer/${this.layerId}/${request.objectId}/attachments`,
319
+ responseFormat: request.responseFormat ?? "json",
320
+ query: request.extraParams,
321
+ signal: request.signal,
322
+ });
323
+ }
324
+ async deleteAttachments(request) {
325
+ const body = toFormBody({
326
+ f: request.responseFormat ?? "json",
327
+ attachmentIds: normalizeObjectIds(request.attachmentIds),
328
+ ...(request.extraParams ?? {}),
329
+ });
330
+ return this.client.request({
331
+ method: "POST",
332
+ path: `/rest/services/${encodeServiceIdPath(this.serviceId)}` +
333
+ `/FeatureServer/${this.layerId}/${request.objectId}/deleteAttachments`,
334
+ headers: {
335
+ "Content-Type": "application/x-www-form-urlencoded",
336
+ },
337
+ body,
338
+ signal: request.signal,
339
+ });
340
+ }
341
+ async addAttachment(request) {
342
+ const form = buildAttachmentFormData(request);
343
+ return this.client.request({
344
+ method: "POST",
345
+ path: `/rest/services/${encodeServiceIdPath(this.serviceId)}` +
346
+ `/FeatureServer/${this.layerId}/${request.objectId}/addAttachment`,
347
+ responseFormat: request.responseFormat ?? "json",
348
+ query: request.extraParams,
349
+ body: form,
350
+ signal: request.signal,
351
+ });
352
+ }
353
+ async updateAttachment(request) {
354
+ const form = buildAttachmentFormData(request);
355
+ form.set("attachmentId", String(request.attachmentId));
356
+ return this.client.request({
357
+ method: "POST",
358
+ path: `/rest/services/${encodeServiceIdPath(this.serviceId)}` +
359
+ `/FeatureServer/${this.layerId}/${request.objectId}/updateAttachment`,
360
+ responseFormat: request.responseFormat ?? "json",
361
+ query: request.extraParams,
362
+ body: form,
363
+ signal: request.signal,
364
+ });
365
+ }
366
+ async request(request) {
367
+ return this.client.request({
368
+ ...request,
369
+ path: `/rest/services/${encodeServiceIdPath(this.serviceId)}` +
370
+ `/FeatureServer/${this.layerId}/${normalizeLayerPath(request.path)}`,
371
+ });
372
+ }
373
+ }
374
+ export class HonuaMapService {
375
+ client;
376
+ serviceId;
377
+ constructor(options) {
378
+ this.client = options.client;
379
+ this.serviceId = options.serviceId;
380
+ }
381
+ async metadata(options = {}) {
382
+ return this.client.getMapServiceMetadata(this.serviceId, options);
383
+ }
384
+ layer(layerId) {
385
+ return new HonuaMapLayer({
386
+ client: this.client,
387
+ serviceId: this.serviceId,
388
+ layerId,
389
+ });
390
+ }
391
+ async layerIds() {
392
+ const metadata = await this.metadata();
393
+ return extractLayerIds(metadata);
394
+ }
395
+ async layers() {
396
+ const ids = await this.layerIds();
397
+ return ids.map((layerId) => new HonuaMapLayer({
398
+ client: this.client,
399
+ serviceId: this.serviceId,
400
+ layerId,
401
+ }));
402
+ }
403
+ async exportMap(request) {
404
+ return this.client.exportMap({
405
+ serviceId: this.serviceId,
406
+ ...request,
407
+ });
408
+ }
409
+ async legend(request = {}) {
410
+ return this.client.getMapLegend({
411
+ serviceId: this.serviceId,
412
+ ...request,
413
+ });
414
+ }
415
+ async getLegend(request = {}) {
416
+ return this.legend(request);
417
+ }
418
+ async identify(request) {
419
+ return this.client.identifyMap({
420
+ serviceId: this.serviceId,
421
+ ...request,
422
+ });
423
+ }
424
+ async find(request) {
425
+ return this.client.findMap({
426
+ serviceId: this.serviceId,
427
+ ...request,
428
+ });
429
+ }
430
+ async queryLayer(request) {
431
+ return this.client.queryMapLayer({
432
+ serviceId: this.serviceId,
433
+ ...request,
434
+ });
435
+ }
436
+ async queryLayerRelatedRecords(request) {
437
+ return this.client.queryMapRelatedRecords({
438
+ serviceId: this.serviceId,
439
+ ...request,
440
+ });
441
+ }
442
+ async queryLayerRelatedFeatures(request) {
443
+ return this.queryLayerRelatedRecords(request);
444
+ }
445
+ async queryLayerFeaturesAll(request) {
446
+ const pageSize = typeof request.pageSize === "number" && Number.isFinite(request.pageSize)
447
+ ? Math.max(1, Math.trunc(request.pageSize))
448
+ : 2000;
449
+ const maxPages = typeof request.maxPages === "number" && Number.isFinite(request.maxPages)
450
+ ? Math.max(1, Math.trunc(request.maxPages))
451
+ : 100;
452
+ const features = [];
453
+ let offset = 0;
454
+ for (let page = 0; page < maxPages; page += 1) {
455
+ const response = await this.queryLayer({
456
+ ...request,
457
+ extraParams: {
458
+ ...(request.extraParams ?? {}),
459
+ resultOffset: offset,
460
+ resultRecordCount: pageSize,
461
+ },
462
+ });
463
+ const pageFeatures = extractFeaturesFromResponse(response);
464
+ if (pageFeatures.length === 0) {
465
+ break;
466
+ }
467
+ features.push(...pageFeatures);
468
+ offset += pageFeatures.length;
469
+ if (!responseExceededTransferLimit(response) && pageFeatures.length < pageSize) {
470
+ break;
471
+ }
472
+ }
473
+ return features;
474
+ }
475
+ async *queryLayerFeaturesStream(request) {
476
+ const pageSize = typeof request.pageSize === "number" && Number.isFinite(request.pageSize)
477
+ ? Math.max(1, Math.trunc(request.pageSize))
478
+ : 2000;
479
+ const maxPages = typeof request.maxPages === "number" && Number.isFinite(request.maxPages)
480
+ ? Math.max(1, Math.trunc(request.maxPages))
481
+ : 100;
482
+ let offset = 0;
483
+ for (let page = 0; page < maxPages; page += 1) {
484
+ const response = await this.queryLayer({
485
+ ...request,
486
+ extraParams: {
487
+ ...(request.extraParams ?? {}),
488
+ resultOffset: offset,
489
+ resultRecordCount: pageSize,
490
+ },
491
+ });
492
+ const pageFeatures = extractFeaturesFromResponse(response);
493
+ if (pageFeatures.length === 0) {
494
+ break;
495
+ }
496
+ yield pageFeatures;
497
+ offset += pageFeatures.length;
498
+ if (!responseExceededTransferLimit(response) && pageFeatures.length < pageSize) {
499
+ break;
500
+ }
501
+ }
502
+ }
503
+ async queryLayerFeatureCount(request) {
504
+ const response = await this.queryLayer({
505
+ layerId: request.layerId,
506
+ where: request.where ?? "1=1",
507
+ returnGeometry: false,
508
+ outFields: "OBJECTID",
509
+ method: request.method,
510
+ extraParams: {
511
+ returnCountOnly: true,
512
+ ...request.extraParams,
513
+ },
514
+ });
515
+ return extractFeatureCountFromResponse(response);
516
+ }
517
+ async queryLayerObjectIds(request) {
518
+ const response = await this.queryLayer({
519
+ layerId: request.layerId,
520
+ where: request.where ?? "1=1",
521
+ returnGeometry: false,
522
+ outFields: "OBJECTID",
523
+ method: request.method,
524
+ extraParams: {
525
+ returnIdsOnly: true,
526
+ ...request.extraParams,
527
+ },
528
+ });
529
+ return extractObjectIdsFromResponse(response);
530
+ }
531
+ async queryLayerExtent(request) {
532
+ const response = await this.queryLayer({
533
+ layerId: request.layerId,
534
+ where: request.where ?? "1=1",
535
+ returnGeometry: false,
536
+ method: request.method,
537
+ extraParams: {
538
+ returnExtentOnly: true,
539
+ ...request.extraParams,
540
+ },
541
+ });
542
+ return extractExtentFromResponse(response);
543
+ }
544
+ async exportImage(request) {
545
+ return this.exportMap(request);
546
+ }
547
+ async request(request) {
548
+ return this.client.request({
549
+ ...request,
550
+ path: `/rest/services/${encodeServiceIdPath(this.serviceId)}` + `/MapServer/${normalizeServicePath(request.path)}`,
551
+ });
552
+ }
553
+ }
554
+ export class HonuaMapLayer {
555
+ client;
556
+ serviceId;
557
+ layerId;
558
+ constructor(options) {
559
+ this.client = options.client;
560
+ this.serviceId = options.serviceId;
561
+ this.layerId = options.layerId;
562
+ }
563
+ async metadata(options = {}) {
564
+ return this.client.getMapLayerMetadata(this.serviceId, this.layerId, options);
565
+ }
566
+ createQuery() {
567
+ return {
568
+ where: "1=1",
569
+ outFields: ["*"],
570
+ returnGeometry: true,
571
+ };
572
+ }
573
+ async queryFeatures(request = {}) {
574
+ return this.client.queryMapLayer({
575
+ serviceId: this.serviceId,
576
+ layerId: this.layerId,
577
+ ...request,
578
+ });
579
+ }
580
+ async queryRelatedRecords(request) {
581
+ return this.client.queryMapRelatedRecords({
582
+ serviceId: this.serviceId,
583
+ layerId: this.layerId,
584
+ ...request,
585
+ });
586
+ }
587
+ async queryRelatedFeatures(request) {
588
+ return this.queryRelatedRecords(request);
589
+ }
590
+ async queryFeaturesAll(request = {}) {
591
+ const pageSize = typeof request.pageSize === "number" && Number.isFinite(request.pageSize)
592
+ ? Math.max(1, Math.trunc(request.pageSize))
593
+ : 2000;
594
+ const maxPages = typeof request.maxPages === "number" && Number.isFinite(request.maxPages)
595
+ ? Math.max(1, Math.trunc(request.maxPages))
596
+ : 100;
597
+ const startingOffset = normalizeOffset(request.resultOffset);
598
+ const features = [];
599
+ let offset = startingOffset;
600
+ for (let page = 0; page < maxPages; page += 1) {
601
+ const response = await this.queryFeatures({
602
+ ...request,
603
+ extraParams: {
604
+ ...(request.extraParams ?? {}),
605
+ resultOffset: offset,
606
+ resultRecordCount: pageSize,
607
+ },
608
+ });
609
+ const pageFeatures = extractFeaturesFromResponse(response);
610
+ if (pageFeatures.length === 0) {
611
+ break;
612
+ }
613
+ features.push(...pageFeatures);
614
+ offset += pageFeatures.length;
615
+ if (!responseExceededTransferLimit(response) && pageFeatures.length < pageSize) {
616
+ break;
617
+ }
618
+ }
619
+ return features;
620
+ }
621
+ async *queryFeaturesStream(request = {}) {
622
+ const pageSize = typeof request.pageSize === "number" && Number.isFinite(request.pageSize)
623
+ ? Math.max(1, Math.trunc(request.pageSize))
624
+ : 2000;
625
+ const maxPages = typeof request.maxPages === "number" && Number.isFinite(request.maxPages)
626
+ ? Math.max(1, Math.trunc(request.maxPages))
627
+ : 100;
628
+ const startingOffset = normalizeOffset(request.resultOffset);
629
+ let offset = startingOffset;
630
+ for (let page = 0; page < maxPages; page += 1) {
631
+ const response = await this.queryFeatures({
632
+ ...request,
633
+ extraParams: {
634
+ ...(request.extraParams ?? {}),
635
+ resultOffset: offset,
636
+ resultRecordCount: pageSize,
637
+ },
638
+ });
639
+ const pageFeatures = extractFeaturesFromResponse(response);
640
+ if (pageFeatures.length === 0) {
641
+ break;
642
+ }
643
+ yield pageFeatures;
644
+ offset += pageFeatures.length;
645
+ if (!responseExceededTransferLimit(response) && pageFeatures.length < pageSize) {
646
+ break;
647
+ }
648
+ }
649
+ }
650
+ async queryFeatureCount(request = {}) {
651
+ const response = await this.queryFeatures({
652
+ where: request.where ?? "1=1",
653
+ returnGeometry: false,
654
+ outFields: "OBJECTID",
655
+ method: request.method,
656
+ extraParams: {
657
+ returnCountOnly: true,
658
+ ...request.extraParams,
659
+ },
660
+ });
661
+ return extractFeatureCountFromResponse(response);
662
+ }
663
+ async queryObjectIds(request = {}) {
664
+ const response = await this.queryFeatures({
665
+ ...request,
666
+ where: request.where ?? "1=1",
667
+ returnGeometry: false,
668
+ outFields: request.outFields ?? "OBJECTID",
669
+ extraParams: {
670
+ returnIdsOnly: true,
671
+ ...request.extraParams,
672
+ },
673
+ });
674
+ return extractObjectIdsFromResponse(response);
675
+ }
676
+ async queryExtent(request = {}) {
677
+ const response = await this.queryFeatures({
678
+ where: request.where ?? "1=1",
679
+ returnGeometry: false,
680
+ method: request.method,
681
+ extraParams: {
682
+ returnExtentOnly: true,
683
+ ...request.extraParams,
684
+ },
685
+ });
686
+ return extractExtentFromResponse(response);
687
+ }
688
+ async request(request) {
689
+ return this.client.request({
690
+ ...request,
691
+ path: `/rest/services/${encodeServiceIdPath(this.serviceId)}` +
692
+ `/MapServer/${this.layerId}/${normalizeLayerPath(request.path)}`,
693
+ });
694
+ }
695
+ }
696
+ /**
697
+ * Resolve the layout to inject onto a request. Returns `undefined` for the
698
+ * facade fast path so the wire layer keeps its zero-round-trip default.
699
+ */
700
+ async function resolveInjectedLayout(client, mode) {
701
+ if (mode === undefined || mode === "honua-facade")
702
+ return undefined;
703
+ return client.resolveOgcFeaturesLayout(mode);
704
+ }
705
+ export class HonuaOgcFeatures {
706
+ client;
707
+ layoutMode;
708
+ constructor(options) {
709
+ this.client = options.client;
710
+ this.layoutMode = options.layout;
711
+ }
712
+ layout() {
713
+ return resolveInjectedLayout(this.client, this.layoutMode);
714
+ }
715
+ collection(collectionId) {
716
+ return new HonuaOgcFeatureCollection({
717
+ client: this.client,
718
+ collectionId,
719
+ ...(this.layoutMode ? { layout: this.layoutMode } : {}),
720
+ });
721
+ }
722
+ async landing(request = {}) {
723
+ const layout = await this.layout();
724
+ return this.client.getOgcFeaturesLanding({ ...request, ...(layout ? { layout } : {}) });
725
+ }
726
+ async conformance(request = {}) {
727
+ const layout = await this.layout();
728
+ return this.client.getOgcFeaturesConformance({ ...request, ...(layout ? { layout } : {}) });
729
+ }
730
+ async collections(request = {}) {
731
+ const layout = await this.layout();
732
+ return this.client.listOgcCollections({ ...request, ...(layout ? { layout } : {}) });
733
+ }
734
+ async getCollection(request) {
735
+ const layout = await this.layout();
736
+ return this.client.getOgcCollection({ ...request, ...(layout ? { layout } : {}) });
737
+ }
738
+ async queryables(request) {
739
+ const layout = await this.layout();
740
+ return this.client.getOgcQueryables({ ...request, ...(layout ? { layout } : {}) });
741
+ }
742
+ async items(request) {
743
+ const layout = await this.layout();
744
+ return this.client.listOgcItems({ ...request, ...(layout ? { layout } : {}) });
745
+ }
746
+ async itemsAll(request) {
747
+ const pageSize = normalizePageSize(request.pageSize, request.limit);
748
+ const maxPages = normalizeMaxPages(request.maxPages);
749
+ const offset = normalizeOffset(request.offset);
750
+ const totalLimit = normalizeTotalLimit(request.limit);
751
+ const features = [];
752
+ for (let page = 0; page < maxPages; page += 1) {
753
+ if (totalLimit !== undefined && features.length >= totalLimit) {
754
+ break;
755
+ }
756
+ const remainingLimit = totalLimit === undefined ? pageSize : Math.max(0, totalLimit - features.length);
757
+ if (remainingLimit < 1) {
758
+ break;
759
+ }
760
+ const limit = Math.min(pageSize, remainingLimit);
761
+ const response = await this.items({
762
+ ...request,
763
+ limit,
764
+ offset: offset + page * pageSize,
765
+ });
766
+ const pageFeatures = extractOgcFeatures(response);
767
+ if (pageFeatures.length === 0) {
768
+ break;
769
+ }
770
+ features.push(...pageFeatures);
771
+ if (pageFeatures.length < limit) {
772
+ break;
773
+ }
774
+ }
775
+ if (totalLimit !== undefined && features.length > totalLimit) {
776
+ return features.slice(0, totalLimit);
777
+ }
778
+ return features;
779
+ }
780
+ async item(request) {
781
+ const layout = await this.layout();
782
+ return this.client.getOgcItem({ ...request, ...(layout ? { layout } : {}) });
783
+ }
784
+ async createItem(request) {
785
+ const layout = await this.layout();
786
+ return this.client.createOgcItem({ ...request, ...(layout ? { layout } : {}) });
787
+ }
788
+ async replaceItem(request) {
789
+ const layout = await this.layout();
790
+ return this.client.replaceOgcItem({ ...request, ...(layout ? { layout } : {}) });
791
+ }
792
+ async patchItem(request) {
793
+ const layout = await this.layout();
794
+ return this.client.patchOgcItem({ ...request, ...(layout ? { layout } : {}) });
795
+ }
796
+ async deleteItem(request) {
797
+ const layout = await this.layout();
798
+ return this.client.deleteOgcItem({ ...request, ...(layout ? { layout } : {}) });
799
+ }
800
+ }
801
+ export class HonuaOgcFeatureCollection {
802
+ client;
803
+ collectionId;
804
+ layoutMode;
805
+ constructor(options) {
806
+ this.client = options.client;
807
+ this.collectionId = options.collectionId;
808
+ this.layoutMode = options.layout;
809
+ }
810
+ layout() {
811
+ return resolveInjectedLayout(this.client, this.layoutMode);
812
+ }
813
+ async metadata(request = {}) {
814
+ const layout = await this.layout();
815
+ return this.client.getOgcCollection({
816
+ ...request,
817
+ collectionId: this.collectionId,
818
+ ...(layout ? { layout } : {}),
819
+ });
820
+ }
821
+ async queryables(request = {}) {
822
+ const layout = await this.layout();
823
+ return this.client.getOgcQueryables({
824
+ ...request,
825
+ collectionId: this.collectionId,
826
+ ...(layout ? { layout } : {}),
827
+ });
828
+ }
829
+ async items(request = {}) {
830
+ const layout = await this.layout();
831
+ return this.client.listOgcItems({
832
+ ...request,
833
+ collectionId: this.collectionId,
834
+ ...(layout ? { layout } : {}),
835
+ });
836
+ }
837
+ async itemsAll(request = {}) {
838
+ const pageSize = normalizePageSize(request.pageSize, request.limit);
839
+ const maxPages = normalizeMaxPages(request.maxPages);
840
+ const offset = normalizeOffset(request.offset);
841
+ const totalLimit = normalizeTotalLimit(request.limit);
842
+ const features = [];
843
+ for (let page = 0; page < maxPages; page += 1) {
844
+ if (totalLimit !== undefined && features.length >= totalLimit) {
845
+ break;
846
+ }
847
+ const remainingLimit = totalLimit === undefined ? pageSize : Math.max(0, totalLimit - features.length);
848
+ if (remainingLimit < 1) {
849
+ break;
850
+ }
851
+ const limit = Math.min(pageSize, remainingLimit);
852
+ const response = await this.items({
853
+ ...request,
854
+ limit,
855
+ offset: offset + page * pageSize,
856
+ });
857
+ const pageFeatures = extractOgcFeatures(response);
858
+ if (pageFeatures.length === 0) {
859
+ break;
860
+ }
861
+ features.push(...pageFeatures);
862
+ if (pageFeatures.length < limit) {
863
+ break;
864
+ }
865
+ }
866
+ if (totalLimit !== undefined && features.length > totalLimit) {
867
+ return features.slice(0, totalLimit);
868
+ }
869
+ return features;
870
+ }
871
+ async *itemsStream(request = {}) {
872
+ const pageSize = normalizePageSize(request.pageSize, request.limit);
873
+ const maxPages = normalizeMaxPages(request.maxPages);
874
+ const offset = normalizeOffset(request.offset);
875
+ for (let page = 0; page < maxPages; page += 1) {
876
+ const response = await this.items({
877
+ ...request,
878
+ limit: pageSize,
879
+ offset: offset + page * pageSize,
880
+ });
881
+ const pageFeatures = extractOgcFeatures(response);
882
+ if (pageFeatures.length === 0) {
883
+ break;
884
+ }
885
+ yield pageFeatures;
886
+ if (pageFeatures.length < pageSize) {
887
+ break;
888
+ }
889
+ }
890
+ }
891
+ async item(request) {
892
+ const layout = await this.layout();
893
+ return this.client.getOgcItem({
894
+ ...request,
895
+ collectionId: this.collectionId,
896
+ ...(layout ? { layout } : {}),
897
+ });
898
+ }
899
+ async createItem(request) {
900
+ const layout = await this.layout();
901
+ return this.client.createOgcItem({
902
+ ...request,
903
+ collectionId: this.collectionId,
904
+ ...(layout ? { layout } : {}),
905
+ });
906
+ }
907
+ async replaceItem(request) {
908
+ const layout = await this.layout();
909
+ return this.client.replaceOgcItem({
910
+ ...request,
911
+ collectionId: this.collectionId,
912
+ ...(layout ? { layout } : {}),
913
+ });
914
+ }
915
+ async patchItem(request) {
916
+ const layout = await this.layout();
917
+ return this.client.patchOgcItem({
918
+ ...request,
919
+ collectionId: this.collectionId,
920
+ ...(layout ? { layout } : {}),
921
+ });
922
+ }
923
+ async deleteItem(request) {
924
+ const layout = await this.layout();
925
+ return this.client.deleteOgcItem({
926
+ ...request,
927
+ collectionId: this.collectionId,
928
+ ...(layout ? { layout } : {}),
929
+ });
930
+ }
931
+ }
932
+ export function createHonuaService(client, serviceId) {
933
+ return new HonuaService({
934
+ client,
935
+ serviceId,
936
+ });
937
+ }
938
+ export function createHonuaOgcFeatures(client) {
939
+ return new HonuaOgcFeatures({
940
+ client,
941
+ });
942
+ }
943
+ /**
944
+ * Wrapper over a Honua ImageServer endpoint. Each operation maps to the
945
+ * server route published in
946
+ * `honua-server/docs/gis/image-server-matrix.md`. The wrapper does not
947
+ * downgrade to a generic raw call: it carries a typed request shape so
948
+ * the contract layer can negotiate capabilities and the server can
949
+ * branch on a stable method name.
950
+ */
951
+ export class HonuaImageService {
952
+ client;
953
+ serviceId;
954
+ constructor(options) {
955
+ this.client = options.client;
956
+ this.serviceId = options.serviceId;
957
+ }
958
+ async metadata() {
959
+ return this.client.request({
960
+ method: "GET",
961
+ path: `/rest/services/${encodeServiceIdPath(this.serviceId)}/ImageServer`,
962
+ responseFormat: "json",
963
+ });
964
+ }
965
+ async queryRasterCatalog(request = {}) {
966
+ return this.dispatch("query", request, imageQueryParams(request));
967
+ }
968
+ async queryRasterCatalogObjectIds(request = {}) {
969
+ const response = await this.dispatch("query", request, {
970
+ ...imageQueryParams(request),
971
+ where: request.where ?? "1=1",
972
+ returnIdsOnly: true,
973
+ });
974
+ if (!Array.isArray(response.objectIds))
975
+ return [];
976
+ return response.objectIds.map((v) => Number(v)).filter((v) => Number.isFinite(v));
977
+ }
978
+ async exportImage(request) {
979
+ return this.dispatch("exportImage", request, imageExportParams(request));
980
+ }
981
+ async identify(request) {
982
+ return this.dispatch("identify", request, imageIdentifyParams(request));
983
+ }
984
+ /**
985
+ * Dispatch an ImageServer operation. POST mode sends params as a
986
+ * form-encoded body so the server's `TryReadRequestValuesAsync` parser
987
+ * finds them (returns "Request body is required" otherwise); GET mode
988
+ * keeps params in the query string. Both encodings are accepted by
989
+ * Honua Server per its ImageServer endpoint registration.
990
+ */
991
+ async dispatch(op, request, params) {
992
+ const method = request.method ?? "GET";
993
+ const path = `/rest/services/${encodeServiceIdPath(this.serviceId)}/ImageServer/${op}`;
994
+ const responseFormat = request.responseFormat ?? "json";
995
+ if (method === "GET") {
996
+ return this.client.request({ method: "GET", path, responseFormat, query: params, signal: request.signal });
997
+ }
998
+ return this.client.request({
999
+ method: "POST",
1000
+ path,
1001
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
1002
+ body: toFormBody({ f: responseFormat, ...params }),
1003
+ signal: request.signal,
1004
+ });
1005
+ }
1006
+ tileUrl(level, row, col, format = "png") {
1007
+ const path = `/rest/services/${encodeServiceIdPath(this.serviceId)}/ImageServer/tile/${level}/${row}/${col}`;
1008
+ return `${this.client.serverBaseUrl}${path}?f=${format}`;
1009
+ }
1010
+ async legend() {
1011
+ return this.client.request({
1012
+ method: "GET",
1013
+ path: `/rest/services/${encodeServiceIdPath(this.serviceId)}/ImageServer/legend`,
1014
+ responseFormat: "json",
1015
+ });
1016
+ }
1017
+ }
1018
+ function imageQueryParams(request) {
1019
+ const params = {};
1020
+ if (request.where !== undefined)
1021
+ params.where = request.where;
1022
+ if (request.outFields !== undefined) {
1023
+ params.outFields = Array.isArray(request.outFields) ? request.outFields.join(",") : String(request.outFields);
1024
+ }
1025
+ if (request.objectIds !== undefined) {
1026
+ params.objectIds = Array.isArray(request.objectIds) ? request.objectIds.join(",") : String(request.objectIds);
1027
+ }
1028
+ if (request.returnGeometry !== undefined)
1029
+ params.returnGeometry = request.returnGeometry;
1030
+ if (request.outSr !== undefined)
1031
+ params.outSR = String(request.outSr);
1032
+ if (request.resultOffset !== undefined)
1033
+ params.resultOffset = request.resultOffset;
1034
+ if (request.resultRecordCount !== undefined)
1035
+ params.resultRecordCount = request.resultRecordCount;
1036
+ if (request.geometry !== undefined)
1037
+ params.geometry = JSON.stringify(request.geometry);
1038
+ if (request.geometryType !== undefined)
1039
+ params.geometryType = String(request.geometryType);
1040
+ if (request.spatialRel !== undefined)
1041
+ params.spatialRel = String(request.spatialRel);
1042
+ Object.assign(params, request.extraParams ?? {});
1043
+ return params;
1044
+ }
1045
+ function imageExportParams(request) {
1046
+ const params = {};
1047
+ if (request.bbox !== undefined) {
1048
+ params.bbox = Array.isArray(request.bbox) ? request.bbox.join(",") : request.bbox;
1049
+ }
1050
+ if (request.size !== undefined) {
1051
+ params.size = Array.isArray(request.size) ? request.size.join(",") : request.size;
1052
+ }
1053
+ if (request.format !== undefined)
1054
+ params.format = request.format;
1055
+ if (request.pixelType !== undefined)
1056
+ params.pixelType = request.pixelType;
1057
+ if (request.noData !== undefined)
1058
+ params.noData = request.noData;
1059
+ if (request.interpolation !== undefined)
1060
+ params.interpolation = request.interpolation;
1061
+ if (request.compressionQuality !== undefined)
1062
+ params.compressionQuality = request.compressionQuality;
1063
+ if (request.bandIds !== undefined) {
1064
+ params.bandIds = Array.isArray(request.bandIds) ? request.bandIds.join(",") : String(request.bandIds);
1065
+ }
1066
+ if (request.mosaicRule !== undefined) {
1067
+ params.mosaicRule =
1068
+ typeof request.mosaicRule === "string" ? request.mosaicRule : JSON.stringify(request.mosaicRule);
1069
+ }
1070
+ if (request.renderingRule !== undefined) {
1071
+ params.renderingRule =
1072
+ typeof request.renderingRule === "string" ? request.renderingRule : JSON.stringify(request.renderingRule);
1073
+ }
1074
+ if (request.imageSr !== undefined)
1075
+ params.imageSR = String(request.imageSr);
1076
+ if (request.bboxSr !== undefined)
1077
+ params.bboxSR = String(request.bboxSr);
1078
+ Object.assign(params, request.extraParams ?? {});
1079
+ return params;
1080
+ }
1081
+ function imageIdentifyParams(request) {
1082
+ const params = {};
1083
+ params.geometry = typeof request.geometry === "string" ? request.geometry : JSON.stringify(request.geometry);
1084
+ if (request.geometryType !== undefined)
1085
+ params.geometryType = request.geometryType;
1086
+ if (request.sr !== undefined)
1087
+ params.sr = String(request.sr);
1088
+ if (request.mosaicRule !== undefined) {
1089
+ params.mosaicRule =
1090
+ typeof request.mosaicRule === "string" ? request.mosaicRule : JSON.stringify(request.mosaicRule);
1091
+ }
1092
+ if (request.renderingRule !== undefined) {
1093
+ params.renderingRule =
1094
+ typeof request.renderingRule === "string" ? request.renderingRule : JSON.stringify(request.renderingRule);
1095
+ }
1096
+ if (request.pixelSize !== undefined) {
1097
+ params.pixelSize = Array.isArray(request.pixelSize) ? request.pixelSize.join(",") : request.pixelSize;
1098
+ }
1099
+ Object.assign(params, request.extraParams ?? {});
1100
+ return params;
1101
+ }
1102
+ /**
1103
+ * Wrapper over a Honua Geometry Service endpoint. Routes match the
1104
+ * canonical paths published by Honua Server's `EndpointRegistry`
1105
+ * (`/rest/services/Utilities/Geometry/GeometryServer/<op>`; see
1106
+ * `honua-server/docs/gis/geometry-service-matrix.md`). Wraps the
1107
+ * server-supported operations: `project`, `buffer`, `simplify`,
1108
+ * `intersect`, `union`, `clip`, `difference`. Operations not
1109
+ * implemented in Honua Server (autoComplete, convexHull, cut,
1110
+ * areasAndLengths/lengths measurement helpers, etc.) intentionally have
1111
+ * no wrapper — callers that need them go through the raw `request()`
1112
+ * escape hatch and handle 404s themselves.
1113
+ *
1114
+ * POST mode submits form-encoded bodies so the server's
1115
+ * `TryReadRequestValuesAsync` parser finds the parameters. GET mode keeps
1116
+ * params in the query string (the server accepts both).
1117
+ */
1118
+ const GEOMETRY_SERVICE_ROOT = "/rest/services/Utilities/Geometry/GeometryServer";
1119
+ export class HonuaGeometryService {
1120
+ client;
1121
+ constructor(options) {
1122
+ this.client = options.client;
1123
+ }
1124
+ async project(request) {
1125
+ return this.dispatch("project", request, geometryProjectParams(request));
1126
+ }
1127
+ async buffer(request) {
1128
+ return this.dispatch("buffer", request, geometryBufferParams(request));
1129
+ }
1130
+ async simplify(request) {
1131
+ return this.dispatch("simplify", request, geometrySimplifyParams(request));
1132
+ }
1133
+ async intersect(request) {
1134
+ return this.dispatch("intersect", request, geometryBinaryParams(request));
1135
+ }
1136
+ async union(request) {
1137
+ return this.dispatch("union", request, geometryUnionParams(request));
1138
+ }
1139
+ async clip(request) {
1140
+ return this.dispatch("clip", request, geometryBinaryParams(request));
1141
+ }
1142
+ async difference(request) {
1143
+ return this.dispatch("difference", request, geometryBinaryParams(request));
1144
+ }
1145
+ async dispatch(op, request, params) {
1146
+ const method = request.method ?? "POST";
1147
+ const path = `${GEOMETRY_SERVICE_ROOT}/${op}`;
1148
+ const responseFormat = request.responseFormat ?? "json";
1149
+ if (method === "GET") {
1150
+ return this.client.request({ method: "GET", path, responseFormat, query: params, signal: request.signal });
1151
+ }
1152
+ return this.client.request({
1153
+ method: "POST",
1154
+ path,
1155
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
1156
+ body: toFormBody({ f: responseFormat, ...params }),
1157
+ signal: request.signal,
1158
+ });
1159
+ }
1160
+ }
1161
+ function geometryProjectParams(request) {
1162
+ const params = {
1163
+ geometries: typeof request.geometries === "string" ? request.geometries : JSON.stringify(request.geometries),
1164
+ inSR: typeof request.inSr === "string" || typeof request.inSr === "number"
1165
+ ? String(request.inSr)
1166
+ : JSON.stringify(request.inSr),
1167
+ outSR: typeof request.outSr === "string" || typeof request.outSr === "number"
1168
+ ? String(request.outSr)
1169
+ : JSON.stringify(request.outSr),
1170
+ };
1171
+ Object.assign(params, request.extraParams ?? {});
1172
+ return params;
1173
+ }
1174
+ function geometryBufferParams(request) {
1175
+ const params = {
1176
+ geometries: typeof request.geometries === "string" ? request.geometries : JSON.stringify(request.geometries),
1177
+ distances: Array.isArray(request.distances) ? request.distances.join(",") : String(request.distances),
1178
+ };
1179
+ if (request.unit !== undefined)
1180
+ params.unit = request.unit;
1181
+ if (request.inSr !== undefined)
1182
+ params.inSR = typeof request.inSr === "object" ? JSON.stringify(request.inSr) : String(request.inSr);
1183
+ if (request.outSr !== undefined)
1184
+ params.outSR = typeof request.outSr === "object" ? JSON.stringify(request.outSr) : String(request.outSr);
1185
+ if (request.bufferSr !== undefined)
1186
+ params.bufferSR =
1187
+ typeof request.bufferSr === "object" ? JSON.stringify(request.bufferSr) : String(request.bufferSr);
1188
+ if (request.unionResults !== undefined)
1189
+ params.unionResults = request.unionResults;
1190
+ if (request.geodesic !== undefined)
1191
+ params.geodesic = request.geodesic;
1192
+ Object.assign(params, request.extraParams ?? {});
1193
+ return params;
1194
+ }
1195
+ function geometrySimplifyParams(request) {
1196
+ const params = {
1197
+ geometries: typeof request.geometries === "string" ? request.geometries : JSON.stringify(request.geometries),
1198
+ };
1199
+ if (request.sr !== undefined)
1200
+ params.sr = typeof request.sr === "object" ? JSON.stringify(request.sr) : String(request.sr);
1201
+ Object.assign(params, request.extraParams ?? {});
1202
+ return params;
1203
+ }
1204
+ function geometryBinaryParams(request) {
1205
+ const params = {
1206
+ geometries: typeof request.geometries === "string" ? request.geometries : JSON.stringify(request.geometries),
1207
+ geometry: typeof request.geometry === "string" ? request.geometry : JSON.stringify(request.geometry),
1208
+ sr: typeof request.sr === "object" ? JSON.stringify(request.sr) : String(request.sr),
1209
+ };
1210
+ Object.assign(params, request.extraParams ?? {});
1211
+ return params;
1212
+ }
1213
+ function geometryUnionParams(request) {
1214
+ const params = {
1215
+ geometries: typeof request.geometries === "string" ? request.geometries : JSON.stringify(request.geometries),
1216
+ sr: typeof request.sr === "object" ? JSON.stringify(request.sr) : String(request.sr),
1217
+ };
1218
+ Object.assign(params, request.extraParams ?? {});
1219
+ return params;
1220
+ }
1221
+ /**
1222
+ * Wrapper over a Honua GP Service task. Mirrors the routes published in
1223
+ * `honua-server/docs/gis/geoprocess-framework-analysis.md`: `submitJob`,
1224
+ * `jobs/{jobId}` (status), `jobs/{jobId}/cancel`, and per-result lookup
1225
+ * (currently registered route, output delivery still depends on the
1226
+ * execution engine — see the parity matrix).
1227
+ */
1228
+ export class HonuaGeoprocessingService {
1229
+ client;
1230
+ serviceId;
1231
+ taskName;
1232
+ constructor(options) {
1233
+ this.client = options.client;
1234
+ this.serviceId = options.serviceId;
1235
+ this.taskName = options.taskName;
1236
+ }
1237
+ async submitJob(request) {
1238
+ return this.client.request({
1239
+ method: request.method ?? "POST",
1240
+ path: this.taskPath("submitJob"),
1241
+ responseFormat: request.responseFormat ?? "json",
1242
+ query: gpSubmitParams(request),
1243
+ signal: request.signal,
1244
+ });
1245
+ }
1246
+ /**
1247
+ * Submit a GeoServices GP job and expose it through the canonical
1248
+ * async-operation surface. This keeps GPServer tasks interoperable with
1249
+ * OGC Processes jobs, app-workspace job state, and any future job-aware
1250
+ * UI components.
1251
+ */
1252
+ async submit(request, options = {}) {
1253
+ const accepted = await this.submitJob(request);
1254
+ return new HonuaGeoprocessingJobRun({
1255
+ client: this.client,
1256
+ serviceId: this.serviceId,
1257
+ taskName: this.taskName,
1258
+ jobId: accepted.jobId,
1259
+ initialJob: accepted,
1260
+ resultNames: options.resultNames,
1261
+ pollIntervalMs: options.pollIntervalMs,
1262
+ });
1263
+ }
1264
+ /** Adopt an existing GP job by id after navigation or reconnect. */
1265
+ job(jobId, options = {}) {
1266
+ return new HonuaGeoprocessingJobRun({
1267
+ client: this.client,
1268
+ serviceId: this.serviceId,
1269
+ taskName: this.taskName,
1270
+ jobId,
1271
+ resultNames: options.resultNames,
1272
+ pollIntervalMs: options.pollIntervalMs,
1273
+ });
1274
+ }
1275
+ async jobStatus(jobId, options = {}) {
1276
+ return this.client.request({
1277
+ method: "GET",
1278
+ path: `${this.taskPath("jobs")}/${encodeURIComponent(jobId)}`,
1279
+ responseFormat: "json",
1280
+ signal: options.signal,
1281
+ });
1282
+ }
1283
+ async cancelJob(jobId, options = {}) {
1284
+ return this.client.request({
1285
+ method: "POST",
1286
+ path: `${this.taskPath("jobs")}/${encodeURIComponent(jobId)}/cancel`,
1287
+ responseFormat: "json",
1288
+ signal: options.signal,
1289
+ });
1290
+ }
1291
+ async jobResult(jobId, resultName, options = {}) {
1292
+ return this.client.request({
1293
+ method: "GET",
1294
+ path: `${this.taskPath("jobs")}/${encodeURIComponent(jobId)}/results/${encodeURIComponent(resultName)}`,
1295
+ responseFormat: "json",
1296
+ signal: options.signal,
1297
+ });
1298
+ }
1299
+ taskPath(suffix) {
1300
+ const taskSegment = this.taskName ? `/${encodeURIComponent(this.taskName)}` : "";
1301
+ return `/rest/services/${encodeServiceIdPath(this.serviceId)}/GPServer${taskSegment}/${suffix}`;
1302
+ }
1303
+ }
1304
+ const DEFAULT_GP_POLL_INTERVAL_MS = 1_000;
1305
+ export class HonuaGeoprocessingJobRun {
1306
+ id;
1307
+ type;
1308
+ client;
1309
+ serviceId;
1310
+ taskName;
1311
+ resultNames;
1312
+ pollIntervalMs;
1313
+ pollFn;
1314
+ resultFn;
1315
+ cancelFn;
1316
+ currentStatus;
1317
+ currentProgress;
1318
+ terminalSnapshot;
1319
+ terminalPromise;
1320
+ listeners = new Set();
1321
+ constructor(options) {
1322
+ this.client = options.client;
1323
+ this.serviceId = options.serviceId;
1324
+ this.taskName = options.taskName;
1325
+ this.id = options.jobId;
1326
+ this.type = options.taskName ? `${options.serviceId}/${options.taskName}` : options.serviceId;
1327
+ this.resultNames = options.resultNames ?? [];
1328
+ this.pollIntervalMs = options.pollIntervalMs ?? DEFAULT_GP_POLL_INTERVAL_MS;
1329
+ this.pollFn =
1330
+ options.pollFn ??
1331
+ ((jobId, signal) => new HonuaGeoprocessingService({
1332
+ client: this.client,
1333
+ serviceId: this.serviceId,
1334
+ taskName: this.taskName,
1335
+ }).jobStatus(jobId, { signal }));
1336
+ this.resultFn =
1337
+ options.resultFn ??
1338
+ ((jobId, resultName, signal) => new HonuaGeoprocessingService({
1339
+ client: this.client,
1340
+ serviceId: this.serviceId,
1341
+ taskName: this.taskName,
1342
+ }).jobResult(jobId, resultName, { signal }));
1343
+ this.cancelFn =
1344
+ options.cancelFn ??
1345
+ ((jobId, signal) => new HonuaGeoprocessingService({
1346
+ client: this.client,
1347
+ serviceId: this.serviceId,
1348
+ taskName: this.taskName,
1349
+ }).cancelJob(jobId, { signal }));
1350
+ this.currentStatus = geoprocessingStatusToJobStatus(options.initialJob?.jobStatus);
1351
+ this.currentProgress = progressFromGeoprocessingJob(options.initialJob);
1352
+ }
1353
+ get status() {
1354
+ return this.currentStatus;
1355
+ }
1356
+ get progress() {
1357
+ return this.currentProgress;
1358
+ }
1359
+ async poll() {
1360
+ if (this.terminalSnapshot)
1361
+ return this.terminalSnapshot;
1362
+ const job = await this.pollFn(this.id);
1363
+ return this.handleGeoprocessingJob(job);
1364
+ }
1365
+ watch(listener) {
1366
+ this.listeners.add(listener);
1367
+ return () => this.listeners.delete(listener);
1368
+ }
1369
+ async results(options = {}) {
1370
+ if (!this.terminalPromise) {
1371
+ // Reset the cached promise if the poll loop rejects (abort / deadline /
1372
+ // attempt cap / transient poll error) so a later results() call can retry
1373
+ // rather than being permanently poisoned while the job may still be
1374
+ // running and pollable.
1375
+ this.terminalPromise = this.runUntilTerminal(options).catch((error) => {
1376
+ this.terminalPromise = undefined;
1377
+ throw error;
1378
+ });
1379
+ }
1380
+ return this.terminalPromise;
1381
+ }
1382
+ async cancel() {
1383
+ if (this.terminalSnapshot)
1384
+ return this.currentStatus;
1385
+ const cancelled = await this.cancelFn(this.id);
1386
+ const snapshot = await this.handleGeoprocessingJob(cancelled);
1387
+ return snapshot.status;
1388
+ }
1389
+ async runUntilTerminal(options = {}) {
1390
+ const { signal } = options;
1391
+ const baseIntervalMs = options.pollIntervalMs ?? this.pollIntervalMs;
1392
+ const maxIntervalMs = options.maxPollIntervalMs ?? Math.max(baseIntervalMs, 30_000);
1393
+ const startedAt = Date.now();
1394
+ let attempts = 0;
1395
+ while (!this.terminalSnapshot) {
1396
+ if (signal?.aborted) {
1397
+ throw new HonuaJobPollTimeoutError(`Job ${this.id} poll aborted`, "aborted", this.id, this.currentStatus);
1398
+ }
1399
+ if (options.maxAttempts !== undefined && attempts >= options.maxAttempts) {
1400
+ throw new HonuaJobPollTimeoutError(`Job ${this.id} did not reach a terminal state within ${options.maxAttempts} poll attempt(s)`, "max-attempts", this.id, this.currentStatus);
1401
+ }
1402
+ let job;
1403
+ try {
1404
+ job = await this.pollFn(this.id, signal);
1405
+ }
1406
+ catch (error) {
1407
+ if (signal?.aborted) {
1408
+ throw new HonuaJobPollTimeoutError(`Job ${this.id} poll aborted`, "aborted", this.id, this.currentStatus);
1409
+ }
1410
+ throw error;
1411
+ }
1412
+ attempts += 1;
1413
+ await this.handleGeoprocessingJob(job);
1414
+ if (this.terminalSnapshot)
1415
+ break;
1416
+ if (options.deadlineMs !== undefined && Date.now() - startedAt >= options.deadlineMs) {
1417
+ throw new HonuaJobPollTimeoutError(`Job ${this.id} did not reach a terminal state within ${options.deadlineMs}ms`, "deadline", this.id, this.currentStatus);
1418
+ }
1419
+ // Capped exponential backoff instead of a fixed interval, matching the
1420
+ // OGC Processes and geospatial-grpc job pollers.
1421
+ const intervalMs = Math.min(maxIntervalMs, baseIntervalMs * 2 ** (attempts - 1));
1422
+ if (intervalMs > 0)
1423
+ await gpDelay(intervalMs, signal);
1424
+ }
1425
+ if (this.terminalSnapshot.status === "successful" && this.terminalSnapshot.result) {
1426
+ return this.terminalSnapshot.result;
1427
+ }
1428
+ const error = this.terminalSnapshot.error;
1429
+ throw new Error(error?.message ?? `GeoServices GP job ended in ${this.terminalSnapshot.status}`);
1430
+ }
1431
+ async handleGeoprocessingJob(job) {
1432
+ const status = geoprocessingStatusToJobStatus(job?.jobStatus);
1433
+ const progress = progressFromGeoprocessingJob(job);
1434
+ this.currentStatus = status;
1435
+ this.currentProgress = progress;
1436
+ if (status === "successful") {
1437
+ const outputs = await this.resolveOutputs(job);
1438
+ const snapshot = {
1439
+ status,
1440
+ progress,
1441
+ result: { outputs },
1442
+ };
1443
+ this.terminalSnapshot = snapshot;
1444
+ this.notify(snapshot);
1445
+ return snapshot;
1446
+ }
1447
+ if (status === "failed" || status === "dismissed") {
1448
+ const error = geoprocessingJobError(status, job);
1449
+ const snapshot = {
1450
+ status,
1451
+ progress,
1452
+ ...(error ? { error } : {}),
1453
+ };
1454
+ this.terminalSnapshot = snapshot;
1455
+ this.notify(snapshot);
1456
+ return snapshot;
1457
+ }
1458
+ const snapshot = { status, progress };
1459
+ this.notify(snapshot);
1460
+ return snapshot;
1461
+ }
1462
+ async resolveOutputs(job) {
1463
+ if (this.resultNames.length === 0) {
1464
+ return (job?.results ?? {});
1465
+ }
1466
+ const outputs = {};
1467
+ for (const resultName of this.resultNames) {
1468
+ outputs[resultName] = (await this.resultFn(this.id, resultName));
1469
+ }
1470
+ return outputs;
1471
+ }
1472
+ notify(snapshot) {
1473
+ for (const listener of this.listeners) {
1474
+ listener(snapshot);
1475
+ }
1476
+ }
1477
+ }
1478
+ function gpSubmitParams(request) {
1479
+ const params = {};
1480
+ for (const [key, value] of Object.entries(request.parameters)) {
1481
+ params[key] =
1482
+ typeof value === "string" || typeof value === "number" || typeof value === "boolean"
1483
+ ? value
1484
+ : JSON.stringify(value);
1485
+ }
1486
+ Object.assign(params, request.extraParams ?? {});
1487
+ return params;
1488
+ }
1489
+ function geoprocessingStatusToJobStatus(value) {
1490
+ const normalized = (value ?? "esriJobSubmitted").toLowerCase();
1491
+ if (normalized.includes("succeeded") || normalized === "successful")
1492
+ return "successful";
1493
+ if (normalized.includes("cancelled") || normalized.includes("canceled") || normalized.includes("dismissed")) {
1494
+ return "dismissed";
1495
+ }
1496
+ if (normalized.includes("failed") || normalized.includes("timedout") || normalized.includes("timed out")) {
1497
+ return "failed";
1498
+ }
1499
+ if (normalized.includes("submitted") || normalized.includes("waiting") || normalized.includes("accepted")) {
1500
+ return "accepted";
1501
+ }
1502
+ if (isJobTerminal(normalized))
1503
+ return normalized;
1504
+ return "running";
1505
+ }
1506
+ function progressFromGeoprocessingJob(job) {
1507
+ if (!job)
1508
+ return undefined;
1509
+ const message = job.messages?.at(-1)?.description;
1510
+ const status = geoprocessingStatusToJobStatus(job.jobStatus);
1511
+ const percent = status === "successful" ? 100 : status === "accepted" ? 5 : status === "running" ? 50 : undefined;
1512
+ if (percent === undefined && message === undefined)
1513
+ return undefined;
1514
+ return { ...(percent !== undefined ? { percent } : {}), ...(message !== undefined ? { message } : {}) };
1515
+ }
1516
+ function geoprocessingJobError(status, job) {
1517
+ const message = job?.messages?.find((entry) => /error|failed|cancel/i.test(entry.type))?.description ??
1518
+ job?.messages?.at(-1)?.description;
1519
+ if (!message) {
1520
+ return status === "dismissed"
1521
+ ? { code: "GeoServicesJobDismissed", message: "GeoServices GP job was dismissed." }
1522
+ : { code: "GeoServicesJobFailed", message: "GeoServices GP job failed." };
1523
+ }
1524
+ return {
1525
+ code: status === "dismissed" ? "GeoServicesJobDismissed" : "GeoServicesJobFailed",
1526
+ message,
1527
+ };
1528
+ }
1529
+ function gpDelay(ms, signal) {
1530
+ return new Promise((resolve) => {
1531
+ if (signal?.aborted) {
1532
+ resolve();
1533
+ return;
1534
+ }
1535
+ const onAbort = () => {
1536
+ clearTimeout(timer);
1537
+ resolve();
1538
+ };
1539
+ const timer = setTimeout(() => {
1540
+ signal?.removeEventListener("abort", onAbort);
1541
+ resolve();
1542
+ }, ms);
1543
+ signal?.addEventListener("abort", onAbort, { once: true });
1544
+ });
1545
+ }
1546
+ function isObject(value) {
1547
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1548
+ }
1549
+ function isFiniteNumber(value) {
1550
+ return typeof value === "number" && Number.isFinite(value);
1551
+ }
1552
+ function defaultFeatureLayerSourceId(serviceId, layerId) {
1553
+ return `geoservices-feature-service:${serviceId}/${layerId}`;
1554
+ }
1555
+ function createFeatureServerH3AggregationPlan(request, kRingDistance) {
1556
+ const resolution = request.resolution?.indexResolution;
1557
+ if (resolution === undefined) {
1558
+ throw new Error("FeatureServer queryH3 requires resolution.indexResolution");
1559
+ }
1560
+ const params = {
1561
+ resolution,
1562
+ };
1563
+ if (request.where !== undefined) {
1564
+ params.where = request.where;
1565
+ }
1566
+ const normalizedKRingDistance = normalizeH3KRingDistance(kRingDistance);
1567
+ if (normalizedKRingDistance !== undefined) {
1568
+ params.kRingDistance = normalizedKRingDistance;
1569
+ }
1570
+ const firstSummary = request.summaries[0];
1571
+ const usesServerDefaultCount = request.summaries.length === 1 && firstSummary?.kind === "count" && firstSummary.field === undefined;
1572
+ if (usesServerDefaultCount) {
1573
+ return {
1574
+ params,
1575
+ resolution,
1576
+ summaryBindings: [{ summary: firstSummary, responseField: "count" }],
1577
+ };
1578
+ }
1579
+ const outStatistics = [];
1580
+ const summaryBindings = request.summaries.map((summary, index) => {
1581
+ const responseField = outStatisticFieldName(summary, index);
1582
+ const onStatisticField = statisticInputField(summary);
1583
+ outStatistics.push({
1584
+ statisticType: summary.kind,
1585
+ onStatisticField,
1586
+ outStatisticFieldName: responseField,
1587
+ });
1588
+ return { summary, responseField };
1589
+ });
1590
+ params.outStatistics = JSON.stringify(outStatistics);
1591
+ return {
1592
+ params,
1593
+ resolution,
1594
+ summaryBindings,
1595
+ };
1596
+ }
1597
+ function featureServerH3AggregationResultFromResponse(response, request, plan) {
1598
+ const cells = extractFeaturesFromResponse(response).map((feature) => featureServerH3CellFromFeature(feature, request, plan));
1599
+ const extent = mergeExtents(cells.map((cell) => cell.extent).filter((value) => value !== undefined));
1600
+ const indexModel = {
1601
+ id: request.index?.modelId ?? FEATURE_SERVER_H3_SPATIAL_AGGREGATION_INDEX_MODEL_ID,
1602
+ title: "FeatureServer indexed cells",
1603
+ family: FEATURE_SERVER_H3_SPATIAL_AGGREGATION_INDEX_MODEL_ID,
1604
+ cellIdEncoding: "string",
1605
+ minResolution: 0,
1606
+ maxResolution: 15,
1607
+ supportedGeometry: ["none", "extent", "boundary"],
1608
+ hierarchy: "parent-child",
1609
+ spatialReference: response.spatialReference ?? extent?.spatialReference ?? { wkid: 4326 },
1610
+ };
1611
+ const summaries = request.summaries.map(spatialAggregationSummaryMetadataFromSpec);
1612
+ const progressive = {
1613
+ status: response.exceededTransferLimit === true ? "partial" : "complete",
1614
+ refinement: response.exceededTransferLimit === true ? "append" : undefined,
1615
+ loadedCellCount: cells.length,
1616
+ };
1617
+ const metadata = {
1618
+ schemaVersion: SPATIAL_AGGREGATION_METADATA_SCHEMA_VERSION,
1619
+ sourceId: request.sourceId,
1620
+ indexModels: [indexModel],
1621
+ summaries,
1622
+ progressive,
1623
+ cache: {
1624
+ metadataCacheable: true,
1625
+ resultCacheable: false,
1626
+ cacheKeyParts: [
1627
+ "geoservices-feature-service",
1628
+ request.sourceId,
1629
+ "queryH3",
1630
+ `resolution=${plan.resolution}`,
1631
+ `where=${request.where ?? ""}`,
1632
+ ],
1633
+ },
1634
+ };
1635
+ return {
1636
+ schemaVersion: SPATIAL_AGGREGATION_SCHEMA_VERSION,
1637
+ requestId: request.requestId,
1638
+ sourceId: request.sourceId,
1639
+ index: {
1640
+ model: indexModel,
1641
+ resolution: plan.resolution,
1642
+ requestedResolution: request.resolution,
1643
+ cellCount: cells.length,
1644
+ extent,
1645
+ },
1646
+ metadata: {
1647
+ ...metadata,
1648
+ widgets: spatialAggregationWidgets(metadata),
1649
+ },
1650
+ cells,
1651
+ page: response.exceededTransferLimit === true
1652
+ ? {
1653
+ loadedCellCount: cells.length,
1654
+ }
1655
+ : undefined,
1656
+ degraded: response.exceededTransferLimit === true
1657
+ ? [
1658
+ {
1659
+ capability: "spatialAggregate",
1660
+ protocol: "geoservices-feature-service",
1661
+ sourceId: request.sourceId,
1662
+ reason: "FeatureServer queryH3 response exceeded the server transfer limit; returned cells may be partial.",
1663
+ },
1664
+ ]
1665
+ : undefined,
1666
+ };
1667
+ }
1668
+ function featureServerH3CellFromFeature(feature, request, plan) {
1669
+ const attributes = feature.attributes ?? {};
1670
+ const id = cellIdFromAttributes(attributes);
1671
+ const extent = extentFromGeometry(feature.geometry);
1672
+ const geometryMode = request.index?.geometry ?? "boundary";
1673
+ const cell = {
1674
+ id,
1675
+ resolution: plan.resolution,
1676
+ extent,
1677
+ summaries: spatialAggregationSummariesFromAttributes(attributes, plan),
1678
+ };
1679
+ if (geometryMode === "boundary" && isObject(feature.geometry)) {
1680
+ return {
1681
+ ...cell,
1682
+ geometry: feature.geometry,
1683
+ };
1684
+ }
1685
+ return cell;
1686
+ }
1687
+ function spatialAggregationSummariesFromAttributes(attributes, plan) {
1688
+ const summaries = {};
1689
+ for (const binding of plan.summaryBindings) {
1690
+ summaries[binding.summary.id] = spatialAggregationSummaryValueFromAttribute(binding.summary, attributes[binding.responseField]);
1691
+ }
1692
+ return summaries;
1693
+ }
1694
+ function spatialAggregationSummaryValueFromAttribute(summary, value) {
1695
+ if (summary.kind === "count") {
1696
+ return {
1697
+ kind: "count",
1698
+ value: Math.max(0, finiteNumberOr(value, 0)),
1699
+ };
1700
+ }
1701
+ if (summary.kind === "sum" || summary.kind === "avg" || summary.kind === "min" || summary.kind === "max") {
1702
+ return {
1703
+ kind: summary.kind,
1704
+ value: finiteNumberOrNull(value),
1705
+ unit: summary.unit,
1706
+ };
1707
+ }
1708
+ throw new Error(`FeatureServer queryH3 does not support ${summary.kind} summaries.`);
1709
+ }
1710
+ function spatialAggregationSummaryMetadataFromSpec(summary) {
1711
+ return {
1712
+ id: summary.id,
1713
+ kind: summary.kind,
1714
+ title: summary.title,
1715
+ field: summary.field,
1716
+ valueType: summary.valueType ?? (summary.kind === "count" ? "number" : undefined),
1717
+ unit: summary.unit,
1718
+ };
1719
+ }
1720
+ function statisticInputField(summary) {
1721
+ if (summary.kind === "count") {
1722
+ if (summary.field === undefined) {
1723
+ throw new Error("count summaries require a field when queryH3 uses outStatistics.");
1724
+ }
1725
+ return summary.field;
1726
+ }
1727
+ if (summary.kind === "sum" || summary.kind === "avg" || summary.kind === "min" || summary.kind === "max") {
1728
+ return summary.field;
1729
+ }
1730
+ throw new Error(`FeatureServer queryH3 does not support ${summary.kind} summaries.`);
1731
+ }
1732
+ function outStatisticFieldName(summary, index) {
1733
+ const safeId = summary.id.replace(/[^A-Za-z0-9_]/g, "_").replace(/^([^A-Za-z_])/, "_$1");
1734
+ return `honua_${index + 1}_${safeId || "summary"}`.slice(0, 63);
1735
+ }
1736
+ function normalizeH3KRingDistance(value) {
1737
+ if (value === undefined) {
1738
+ return undefined;
1739
+ }
1740
+ if (!Number.isInteger(value) || value < 0 || value > 20) {
1741
+ throw new Error("FeatureServer queryH3 kRingDistance must be an integer between 0 and 20.");
1742
+ }
1743
+ return value;
1744
+ }
1745
+ function cellIdFromAttributes(attributes) {
1746
+ for (const key of ["cellIndex", "cell_index", "h3Index", "h3_index"]) {
1747
+ const value = attributes[key];
1748
+ if (typeof value === "string" || typeof value === "number" || typeof value === "bigint") {
1749
+ return String(value);
1750
+ }
1751
+ }
1752
+ throw new Error("FeatureServer queryH3 response is missing a cellIndex attribute.");
1753
+ }
1754
+ function extentFromGeometry(geometry) {
1755
+ if (!isObject(geometry)) {
1756
+ return undefined;
1757
+ }
1758
+ if (isFiniteNumber(geometry.xmin) &&
1759
+ isFiniteNumber(geometry.ymin) &&
1760
+ isFiniteNumber(geometry.xmax) &&
1761
+ isFiniteNumber(geometry.ymax)) {
1762
+ return {
1763
+ xmin: geometry.xmin,
1764
+ ymin: geometry.ymin,
1765
+ xmax: geometry.xmax,
1766
+ ymax: geometry.ymax,
1767
+ spatialReference: isObject(geometry.spatialReference)
1768
+ ? geometry.spatialReference
1769
+ : undefined,
1770
+ };
1771
+ }
1772
+ const coordinates = [];
1773
+ collectCoordinatePairs(geometry.rings, coordinates);
1774
+ collectCoordinatePairs(geometry.paths, coordinates);
1775
+ collectCoordinatePairs(geometry.points, coordinates);
1776
+ if (isFiniteNumber(geometry.x) && isFiniteNumber(geometry.y)) {
1777
+ coordinates.push([geometry.x, geometry.y]);
1778
+ }
1779
+ if (coordinates.length === 0) {
1780
+ return undefined;
1781
+ }
1782
+ let xmin = Number.POSITIVE_INFINITY;
1783
+ let ymin = Number.POSITIVE_INFINITY;
1784
+ let xmax = Number.NEGATIVE_INFINITY;
1785
+ let ymax = Number.NEGATIVE_INFINITY;
1786
+ for (const [x, y] of coordinates) {
1787
+ xmin = Math.min(xmin, x);
1788
+ ymin = Math.min(ymin, y);
1789
+ xmax = Math.max(xmax, x);
1790
+ ymax = Math.max(ymax, y);
1791
+ }
1792
+ return {
1793
+ xmin,
1794
+ ymin,
1795
+ xmax,
1796
+ ymax,
1797
+ spatialReference: isObject(geometry.spatialReference)
1798
+ ? geometry.spatialReference
1799
+ : undefined,
1800
+ };
1801
+ }
1802
+ function collectCoordinatePairs(value, coordinates) {
1803
+ if (!Array.isArray(value)) {
1804
+ return;
1805
+ }
1806
+ if (isFiniteNumber(value[0]) && isFiniteNumber(value[1])) {
1807
+ coordinates.push([value[0], value[1]]);
1808
+ return;
1809
+ }
1810
+ for (const child of value) {
1811
+ collectCoordinatePairs(child, coordinates);
1812
+ }
1813
+ }
1814
+ function mergeExtents(extents) {
1815
+ if (extents.length === 0) {
1816
+ return undefined;
1817
+ }
1818
+ const [first, ...rest] = extents;
1819
+ return rest.reduce((merged, extent) => ({
1820
+ xmin: Math.min(merged.xmin, extent.xmin),
1821
+ ymin: Math.min(merged.ymin, extent.ymin),
1822
+ xmax: Math.max(merged.xmax, extent.xmax),
1823
+ ymax: Math.max(merged.ymax, extent.ymax),
1824
+ spatialReference: merged.spatialReference ?? extent.spatialReference,
1825
+ }), first);
1826
+ }
1827
+ function finiteNumberOr(value, fallback) {
1828
+ const numeric = finiteNumberOrNull(value);
1829
+ return numeric ?? fallback;
1830
+ }
1831
+ function finiteNumberOrNull(value) {
1832
+ if (isFiniteNumber(value)) {
1833
+ return value;
1834
+ }
1835
+ if (typeof value === "string" && value.trim().length > 0) {
1836
+ const parsed = Number(value);
1837
+ return Number.isFinite(parsed) ? parsed : null;
1838
+ }
1839
+ return null;
1840
+ }
1841
+ function extractFeatureCountFromResponse(response) {
1842
+ if (isObject(response) && typeof response.count === "number" && Number.isFinite(response.count)) {
1843
+ return response.count;
1844
+ }
1845
+ if (isObject(response) && Array.isArray(response.features)) {
1846
+ return response.features.length;
1847
+ }
1848
+ return 0;
1849
+ }
1850
+ function extractFeaturesFromResponse(response) {
1851
+ if (!isObject(response) || !Array.isArray(response.features)) {
1852
+ return [];
1853
+ }
1854
+ return response.features;
1855
+ }
1856
+ function extractObjectIdsFromResponse(response) {
1857
+ if (!isObject(response) || !Array.isArray(response.objectIds)) {
1858
+ return [];
1859
+ }
1860
+ return response.objectIds.map((value) => Number(value)).filter((value) => Number.isFinite(value));
1861
+ }
1862
+ function extractExtentFromResponse(response) {
1863
+ if (!isObject(response)) {
1864
+ return { extent: null };
1865
+ }
1866
+ const count = isFiniteNumber(response.count) ? response.count : undefined;
1867
+ const extent = isObject(response.extent) ? response.extent : null;
1868
+ return { extent, count };
1869
+ }
1870
+ function normalizeObjectIds(ids) {
1871
+ return Array.isArray(ids) ? ids.join(",") : String(ids);
1872
+ }
1873
+ function toFormBody(values) {
1874
+ const params = new URLSearchParams();
1875
+ for (const [key, value] of Object.entries(values)) {
1876
+ params.set(key, String(value));
1877
+ }
1878
+ return params.toString();
1879
+ }
1880
+ function normalizeLayerPath(path) {
1881
+ return path.startsWith("/") ? path.slice(1) : path;
1882
+ }
1883
+ function normalizeServicePath(path) {
1884
+ return path.startsWith("/") ? path.slice(1) : path;
1885
+ }
1886
+ function normalizePageSize(pageSize, limit) {
1887
+ if (isFinitePositiveInteger(pageSize)) {
1888
+ return pageSize;
1889
+ }
1890
+ if (isFinitePositiveInteger(limit)) {
1891
+ return limit;
1892
+ }
1893
+ return 100;
1894
+ }
1895
+ function normalizeMaxPages(maxPages) {
1896
+ if (isFinitePositiveInteger(maxPages)) {
1897
+ return maxPages;
1898
+ }
1899
+ return 100;
1900
+ }
1901
+ function normalizeOffset(offset) {
1902
+ if (typeof offset !== "number" || !Number.isFinite(offset)) {
1903
+ return 0;
1904
+ }
1905
+ return Math.max(0, Math.trunc(offset));
1906
+ }
1907
+ function normalizeTotalLimit(limit) {
1908
+ if (!isFinitePositiveInteger(limit)) {
1909
+ return undefined;
1910
+ }
1911
+ return limit;
1912
+ }
1913
+ function isFinitePositiveInteger(value) {
1914
+ return typeof value === "number" && Number.isFinite(value) && Math.trunc(value) > 0;
1915
+ }
1916
+ function buildAttachmentFormData(request) {
1917
+ const form = new FormData();
1918
+ if (request.attachment instanceof Blob) {
1919
+ const blob = ensureBlobType(request.attachment, request.contentType);
1920
+ const fileName = request.name ?? resolveBlobName(request.attachment);
1921
+ form.set("attachment", blob, fileName);
1922
+ return form;
1923
+ }
1924
+ const blob = new Blob([request.attachment], {
1925
+ type: request.contentType ?? "application/octet-stream",
1926
+ });
1927
+ form.set("attachment", blob, request.name ?? "attachment.txt");
1928
+ return form;
1929
+ }
1930
+ function resolveBlobName(blob) {
1931
+ if ("name" in blob && typeof blob.name === "string" && blob.name.length > 0) {
1932
+ return blob.name;
1933
+ }
1934
+ return "attachment.bin";
1935
+ }
1936
+ function ensureBlobType(blob, contentType) {
1937
+ if (!contentType || blob.type === contentType) {
1938
+ return blob;
1939
+ }
1940
+ return new Blob([blob], { type: contentType });
1941
+ }
1942
+ function extractLayerIds(metadata) {
1943
+ if (!isObject(metadata) || !Array.isArray(metadata.layers)) {
1944
+ return [];
1945
+ }
1946
+ const ids = [];
1947
+ for (const layer of metadata.layers) {
1948
+ if (!isObject(layer)) {
1949
+ continue;
1950
+ }
1951
+ const parsed = Number(layer.id);
1952
+ if (!Number.isFinite(parsed)) {
1953
+ continue;
1954
+ }
1955
+ ids.push(Math.trunc(parsed));
1956
+ }
1957
+ return ids;
1958
+ }
1959
+ function extractOgcFeatures(response) {
1960
+ if (!isObject(response) || !Array.isArray(response.features)) {
1961
+ return [];
1962
+ }
1963
+ return response.features;
1964
+ }