@geode/opengeodeweb-front 10.44.0-rc.1 → 10.44.0-rc.10

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 (245) hide show
  1. package/.build/server/utils/cleanup.js +7 -2
  2. package/.build/server/utils/microservices.js +9 -81
  3. package/.build/server/utils/microservices_process.js +85 -0
  4. package/.build/server/utils/scripts.js +34 -23
  5. package/.build/server/utils/typed_handler.js +5 -1
  6. package/.build/server/utils/ws_client.js +7 -2
  7. package/.build/shared/utils/fetch_raw.js +2 -2
  8. package/.build/shared/utils/parse_boolean.js +2 -1
  9. package/app/assets/geode_objects.ts +1 -0
  10. package/app/components/BasemapAttribution.vue +28 -0
  11. package/app/components/ClippingPlanes.vue +22 -78
  12. package/app/components/DragAndDrop.vue +16 -79
  13. package/app/components/FileSelector.vue +9 -6
  14. package/app/components/HybridViewerTooltip.vue +8 -2
  15. package/app/components/MissingFilesSelector.vue +40 -23
  16. package/app/components/ObjectSelector.vue +34 -20
  17. package/app/components/Screenshot.vue +17 -59
  18. package/app/components/ThresholdCard.vue +205 -0
  19. package/app/components/ThresholdFilter.vue +81 -216
  20. package/app/components/ViewToolbar.vue +15 -231
  21. package/app/components/Viewer/Basemap/CropOptions.vue +50 -0
  22. package/app/components/Viewer/Basemap/OpacityOptions.vue +52 -0
  23. package/app/components/Viewer/ContextMenu/CircularItems.vue +1 -2
  24. package/app/components/Viewer/ContextMenu/ContextMenu.vue +11 -6
  25. package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +10 -7
  26. package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
  27. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
  28. package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +221 -0
  29. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
  30. package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
  31. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
  32. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +13 -0
  33. package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +227 -0
  34. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
  35. package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
  36. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
  37. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +14 -12
  38. package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
  39. package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
  40. package/app/components/Viewer/Generic/Model/CornersOptions.vue +15 -294
  41. package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
  42. package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
  43. package/app/components/Viewer/Generic/Model/LinesOptions.vue +15 -427
  44. package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
  45. package/app/components/Viewer/Generic/Model/ModelCardTabs.vue +35 -0
  46. package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +34 -25
  47. package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +34 -25
  48. package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +17 -5
  49. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +16 -12
  50. package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
  51. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +55 -11
  52. package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
  53. package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
  54. package/app/components/Viewer/Options/ColorPicker.vue +4 -1
  55. package/app/components/Viewer/Options/ColoringTypeSelector.vue +48 -74
  56. package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
  57. package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
  58. package/app/components/Viewer/Options/Sliders/Opacity.vue +22 -0
  59. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +13 -0
  60. package/app/components/Viewer/Scene/BackgroundOptions.vue +37 -0
  61. package/app/components/Viewer/Scene/OrientationWidgetOptions.vue +48 -0
  62. package/app/components/Viewer/Scene/TextOptions.vue +63 -0
  63. package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
  64. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
  65. package/app/components/Viewer/Surface/PolygonsColoring.vue +224 -0
  66. package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
  67. package/app/components/Viewer/Ui.vue +6 -1
  68. package/app/components/csv-preview/CsvPreviewer.vue +4 -1
  69. package/app/composables/attribute_coloring_style.ts +8 -2
  70. package/app/composables/attribute_selector.ts +126 -0
  71. package/app/composables/batch_style_model.ts +34 -0
  72. package/app/composables/clipping_slices.ts +166 -0
  73. package/app/composables/global_attribute_style.ts +4 -3
  74. package/app/composables/hover_highlight.ts +19 -18
  75. package/app/composables/model_tabs.ts +86 -0
  76. package/app/composables/overlapping_picker_menu.ts +43 -0
  77. package/app/composables/project_manager.ts +6 -97
  78. package/app/composables/project_manager_helpers/reset.ts +34 -0
  79. package/app/composables/project_manager_helpers/restore.ts +67 -0
  80. package/app/composables/project_manager_helpers/types.ts +24 -0
  81. package/app/composables/project_manager_helpers/viewer_session.ts +25 -0
  82. package/app/composables/stepper_tree.ts +10 -2
  83. package/app/composables/tree_filter.ts +11 -2
  84. package/app/composables/tree_keyboard_nav.ts +4 -2
  85. package/app/composables/use_overlapping_picker.ts +30 -42
  86. package/app/composables/view_toolbar_options.ts +126 -0
  87. package/app/composables/view_toolbar_tool_options.ts +115 -0
  88. package/app/composables/view_toolbar_tools.ts +108 -0
  89. package/app/composables/viewer_context_menu.ts +19 -1
  90. package/app/composables/virtual_tree.ts +20 -131
  91. package/app/composables/virtual_tree_flatten.ts +109 -0
  92. package/app/composables/virtual_tree_types.ts +81 -0
  93. package/app/stores/app.ts +8 -55
  94. package/app/stores/app_helpers/extension.ts +90 -51
  95. package/app/stores/app_helpers/registry.ts +69 -0
  96. package/app/stores/basemap.ts +52 -0
  97. package/app/stores/basemap_detail.ts +51 -0
  98. package/app/stores/basemap_helpers/builds.ts +158 -0
  99. package/app/stores/basemap_helpers/detail_layers.ts +72 -0
  100. package/app/stores/basemap_helpers/detail_map.ts +62 -0
  101. package/app/stores/basemap_helpers/detail_refresh.ts +134 -0
  102. package/app/stores/basemap_helpers/detail_view.ts +94 -0
  103. package/app/stores/basemap_helpers/extent.ts +40 -0
  104. package/app/stores/basemap_helpers/georeferenced.ts +50 -0
  105. package/app/stores/basemap_helpers/layers.ts +66 -0
  106. package/app/stores/basemap_helpers/settings.ts +87 -0
  107. package/app/stores/basemap_helpers/viewer.ts +114 -0
  108. package/app/stores/data_style.ts +8 -0
  109. package/app/stores/feedback.ts +2 -2
  110. package/app/stores/hybrid_viewer.ts +1 -1
  111. package/app/stores/infra.ts +26 -21
  112. package/app/stores/menu.ts +8 -124
  113. package/app/stores/menu_helpers/basemap.ts +10 -0
  114. package/app/stores/menu_helpers/menus_data.ts +27 -0
  115. package/app/stores/menu_helpers/mesh/edged_curve.ts +12 -0
  116. package/app/stores/menu_helpers/mesh/grid.ts +24 -0
  117. package/app/stores/menu_helpers/mesh/point_set.ts +11 -0
  118. package/app/stores/menu_helpers/mesh/solid.ts +29 -0
  119. package/app/stores/menu_helpers/mesh/surface.ts +22 -0
  120. package/app/stores/menu_helpers/model.ts +25 -0
  121. package/app/stores/menu_helpers/scene.ts +10 -0
  122. package/app/stores/menu_helpers/types.ts +5 -0
  123. package/app/stores/treeview.ts +17 -10
  124. package/app/stores/viewer.ts +17 -79
  125. package/app/stores/viewer_helpers/actions.ts +68 -0
  126. package/app/stores/viewer_helpers/request.ts +61 -0
  127. package/app/utils/basemap_tree.ts +76 -0
  128. package/app/utils/clipping_planes.ts +4 -131
  129. package/app/utils/clipping_planes_scene.ts +131 -0
  130. package/app/utils/color_picker.ts +18 -15
  131. package/app/utils/coloring_styles.ts +101 -0
  132. package/app/utils/default_styles/constants.ts +10 -0
  133. package/app/utils/default_styles/index.ts +17 -1
  134. package/app/utils/default_styles/mesh_components.ts +168 -0
  135. package/app/utils/default_styles/meshes.ts +13 -153
  136. package/app/utils/default_styles/model_components.ts +170 -0
  137. package/app/utils/default_styles/models.ts +16 -153
  138. package/app/utils/drag_and_drop.ts +80 -0
  139. package/app/utils/extension.ts +1 -1
  140. package/app/utils/import_workflow.ts +6 -4
  141. package/app/utils/model_component_coloring.ts +46 -0
  142. package/app/utils/threshold.ts +33 -0
  143. package/app/utils/threshold_sources.ts +51 -0
  144. package/app/utils/treeview.ts +12 -1
  145. package/app/utils/upload_path.ts +15 -9
  146. package/app/utils/visible_map_area.ts +129 -0
  147. package/internal/database/base_database.ts +2 -0
  148. package/internal/database/database.ts +47 -29
  149. package/internal/database/tables/scene_style.ts +6 -0
  150. package/internal/stores/data_style/mesh/base_style.ts +74 -0
  151. package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
  152. package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
  153. package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
  154. package/internal/stores/data_style/mesh/cells/color.ts +3 -1
  155. package/internal/stores/data_style/mesh/cells/index.ts +17 -1
  156. package/internal/stores/data_style/mesh/cells/opacity.ts +54 -0
  157. package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
  158. package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
  159. package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
  160. package/internal/stores/data_style/mesh/edges/color.ts +3 -1
  161. package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
  162. package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
  163. package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
  164. package/internal/stores/data_style/mesh/edges/index.ts +17 -1
  165. package/internal/stores/data_style/mesh/edges/opacity.ts +54 -0
  166. package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
  167. package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
  168. package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
  169. package/internal/stores/data_style/mesh/index.ts +2 -57
  170. package/internal/stores/data_style/mesh/points/color.ts +3 -1
  171. package/internal/stores/data_style/mesh/points/index.ts +17 -1
  172. package/internal/stores/data_style/mesh/points/opacity.ts +54 -0
  173. package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
  174. package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
  175. package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
  176. package/internal/stores/data_style/mesh/polygons/color.ts +3 -1
  177. package/internal/stores/data_style/mesh/polygons/index.ts +17 -1
  178. package/internal/stores/data_style/mesh/polygons/opacity.ts +54 -0
  179. package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
  180. package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
  181. package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
  182. package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
  183. package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
  184. package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
  185. package/internal/stores/data_style/mesh/polyhedra/color.ts +3 -1
  186. package/internal/stores/data_style/mesh/polyhedra/index.ts +17 -1
  187. package/internal/stores/data_style/mesh/polyhedra/opacity.ts +54 -0
  188. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
  189. package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
  190. package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
  191. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
  192. package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
  193. package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
  194. package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
  195. package/internal/stores/data_style/model/blocks/color.ts +58 -57
  196. package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
  197. package/internal/stores/data_style/model/blocks/index.ts +12 -140
  198. package/internal/stores/data_style/model/blocks/polyhedron.ts +102 -54
  199. package/internal/stores/data_style/model/blocks/vertex.ts +102 -54
  200. package/internal/stores/data_style/model/color.ts +25 -26
  201. package/internal/stores/data_style/model/common.ts +10 -119
  202. package/internal/stores/data_style/model/common_mutations.ts +184 -0
  203. package/internal/stores/data_style/model/corners/index.ts +85 -78
  204. package/internal/stores/data_style/model/corners/vertex.ts +97 -49
  205. package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
  206. package/internal/stores/data_style/model/lines/color.ts +53 -40
  207. package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
  208. package/internal/stores/data_style/model/lines/edge.ts +102 -54
  209. package/internal/stores/data_style/model/lines/index.ts +10 -134
  210. package/internal/stores/data_style/model/lines/vertex.ts +102 -54
  211. package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
  212. package/internal/stores/data_style/model/surfaces/color.ts +68 -56
  213. package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
  214. package/internal/stores/data_style/model/surfaces/index.ts +16 -160
  215. package/internal/stores/data_style/model/surfaces/polygon.ts +94 -46
  216. package/internal/stores/data_style/model/surfaces/vertex.ts +94 -46
  217. package/internal/stores/data_style/model/visibility.ts +3 -156
  218. package/internal/stores/data_style/model/visibility_dispatch.ts +110 -0
  219. package/internal/stores/data_style/scene.ts +118 -0
  220. package/internal/stores/data_style/state.ts +5 -181
  221. package/internal/stores/data_style/state_shared.ts +199 -0
  222. package/internal/stores/data_style/types.ts +24 -1
  223. package/internal/stores/hybrid_viewer/brightness.ts +8 -2
  224. package/internal/stores/hybrid_viewer/camera.ts +7 -161
  225. package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
  226. package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
  227. package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
  228. package/internal/stores/hybrid_viewer/filters.ts +54 -11
  229. package/internal/stores/hybrid_viewer/highlight.ts +80 -63
  230. package/internal/stores/hybrid_viewer/ruler.ts +4 -3
  231. package/internal/stores/hybrid_viewer/scene.ts +31 -25
  232. package/internal/stores/hybrid_viewer/vtk_types.ts +2 -1
  233. package/internal/utils/ws_client.ts +8 -1
  234. package/package.json +2 -2
  235. package/server/api/local/extensions/run.post.ts +6 -4
  236. package/server/api/local/extensions/upload.put.ts +47 -20
  237. package/server/utils/cleanup.ts +12 -2
  238. package/server/utils/microservices.ts +10 -102
  239. package/server/utils/microservices_process.ts +127 -0
  240. package/server/utils/scripts.ts +35 -30
  241. package/server/utils/typed_handler.ts +8 -1
  242. package/server/utils/ws_client.ts +15 -2
  243. package/shared/utils/fetch_raw.ts +2 -2
  244. package/shared/utils/parse_boolean.ts +4 -1
  245. package/app/components/Viewer/Options/OptionsSection.vue +0 -76
@@ -28,6 +28,10 @@ async function deleteFolderRecursive(folderPath) {
28
28
  function isErrorWithMessage(error) {
29
29
  return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
30
30
  }
31
+ function describeError(error) {
32
+ if (isErrorWithMessage(error)) return error.message;
33
+ return String(error);
34
+ }
31
35
  async function killHttpMicroservice(microservice) {
32
36
  consola.debug("killHttpMicroservice", { ...microservice });
33
37
  const failMessage = `Failed to kill ${microservice.name}`;
@@ -36,7 +40,7 @@ async function killHttpMicroservice(microservice) {
36
40
  try {
37
41
  await fetch(microservice.url, { method: microservice.method });
38
42
  } catch (error) {
39
- const message = isErrorWithMessage(error) ? error.message : String(error);
43
+ const message = describeError(error);
40
44
  consola.info(`Expected error during kill of ${microservice.name}:`, message);
41
45
  }
42
46
  }
@@ -109,7 +113,8 @@ async function cleanupBackend(projectFolderPath) {
109
113
  }
110
114
  function getMicroserviceByName(microservices, name) {
111
115
  const found = microservices.find((microservice) => microservice.name === name);
112
- return found === void 0 ? void 0 : { ...found };
116
+ if (found === void 0) return;
117
+ return { ...found };
113
118
  }
114
119
  //#endregion
115
120
  export { cleanupBackend, deleteFolderRecursive, getMicroserviceByName, killMicroservice, microservicesMetadatasPath, projectMicroservices };
@@ -1,67 +1,13 @@
1
1
  import { microservicesMetadatasPath, projectMicroservices } from "./cleanup.js";
2
2
  import { addNginxLocation, addSupervisorProgram } from "./cloud.js";
3
- import { getAvailablePort, waitForReady } from "./scripts.js";
3
+ import { getAvailablePort } from "./scripts.js";
4
4
  import { executablePath } from "./path.js";
5
- import path from "node:path";
5
+ import { DEFAULT_RUN_ARGS, backArgs, isPortInUseError, runScript, waitUntilListening } from "./microservices_process.js";
6
6
  import { consola } from "consola";
7
7
  import fs from "node:fs";
8
8
  import child_process from "node:child_process";
9
9
  import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json" with { type: "json" };
10
10
  //#region server/utils/microservices.ts
11
- const MILLISECONDS_PER_SECOND = 1e3;
12
- const DEFAULT_TIMEOUT_SECONDS = 120;
13
- const MAX_PORT_RETRIES = 1;
14
- const DEFAULT_RUN_ARGS = { projectFolderPath: "" };
15
- const LISTENING_LOG_PATTERN = /^Listening on https?:\/\/.+:\d+\/?\s*$/mu;
16
- async function runScript(execPath, execName, args, expectedResponse, timeoutSeconds = DEFAULT_TIMEOUT_SECONDS) {
17
- const command = executablePath(execPath, execName);
18
- consola.debug("runScript", command, args);
19
- const child = child_process.spawn(command, args, { stdio: [
20
- "ignore",
21
- "pipe",
22
- "pipe"
23
- ] });
24
- child.name = command.replace(/^.*[\\/]/u, "");
25
- child.on("spawn", () => {
26
- consola.info(`[${child.name}] spawned, pid=${child.pid}`);
27
- });
28
- const controller = new AbortController();
29
- const timer = setTimeout(() => {
30
- controller.abort();
31
- }, timeoutSeconds * MILLISECONDS_PER_SECOND);
32
- if (typeof timer.unref === "function") timer.unref();
33
- try {
34
- const result = await waitForReady(child, expectedResponse, controller.signal);
35
- clearTimeout(timer);
36
- return result;
37
- } catch (error) {
38
- clearTimeout(timer);
39
- child.kill();
40
- throw error;
41
- }
42
- }
43
- function isPortInUseError(error) {
44
- return /EADDRINUSE|address already in use|port already in use/iu.test(String(error));
45
- }
46
- function backArgs(args, port) {
47
- const { projectFolderPath } = args;
48
- if (!projectFolderPath) throw new Error("projectFolderPath is required");
49
- const uploadFolderPath = args.uploadFolderPath !== void 0 && args.uploadFolderPath !== "" ? args.uploadFolderPath : path.join(projectFolderPath, "uploads");
50
- const executableArgs = [
51
- "--port",
52
- String(port),
53
- "--project_folder_path",
54
- projectFolderPath,
55
- "--upload_folder_path",
56
- uploadFolderPath,
57
- "--allowed_origins",
58
- "http://localhost:*",
59
- "--timeout",
60
- "0"
61
- ];
62
- if (process.env.NODE_ENV === void 0 || process.env.NODE_ENV === "development") executableArgs.push("--debug");
63
- return executableArgs;
64
- }
65
11
  async function runBack(execName, execPath, args = DEFAULT_RUN_ARGS, attempts = 0) {
66
12
  let port = void 0;
67
13
  try {
@@ -75,7 +21,7 @@ async function runBack(execName, execPath, args = DEFAULT_RUN_ARGS, attempts = 0
75
21
  consola.error("runBack error", error);
76
22
  throw error;
77
23
  }
78
- if (attempts <= MAX_PORT_RETRIES) {
24
+ if (attempts <= 1) {
79
25
  consola.info("Retrying runBack on conflicting port", port);
80
26
  return await runBack(execName, execPath, args, attempts + 1);
81
27
  }
@@ -104,7 +50,7 @@ async function runViewer(execName, execPath, args = DEFAULT_RUN_ARGS, attempts =
104
50
  consola.error("runViewer error", error);
105
51
  throw error;
106
52
  }
107
- if (attempts <= MAX_PORT_RETRIES) {
53
+ if (attempts <= 1) {
108
54
  consola.info("Retrying runViewer on conflicting port", port);
109
55
  return await runViewer(execName, execPath, args, attempts + 1);
110
56
  }
@@ -126,48 +72,30 @@ async function runExtension(extensionId, execName, execPath, args = DEFAULT_RUN_
126
72
  consola.error("runExtension error", error);
127
73
  throw error;
128
74
  }
129
- if (attempts <= MAX_PORT_RETRIES) {
75
+ if (attempts <= 1) {
130
76
  consola.info("Retrying runExtension on conflicting port", port);
131
77
  return await runExtension(extensionId, execName, execPath, args, attempts + 1);
132
78
  }
133
79
  }
134
80
  throw new Error(`runExtension failed to run ${extensionId}`);
135
81
  }
136
- async function waitUntilListening(child) {
137
- child.stderr.on("data", (data) => {
138
- consola.info(`[${child.spawnfile}] STDERR:`, data.toString().trim());
139
- });
140
- child.on("close", (code) => {
141
- consola.info(`[${child.spawnfile}] exited with code ${code}`);
142
- });
143
- for await (const chunk of child.stdout) {
144
- const output = String(chunk);
145
- consola.info(`[${child.spawnfile}] STDOUT:`, output.trim());
146
- if (LISTENING_LOG_PATTERN.test(output)) {
147
- child.stdout.on("data", (data) => {
148
- consola.info(`[${child.spawnfile}] STDOUT:`, data.toString().trim());
149
- });
150
- return;
151
- }
152
- }
153
- throw new Error(`${child.spawnfile} exited before becoming ready`);
154
- }
155
82
  async function runExtensionServer(entryPath, attempts = 0) {
156
83
  let port = void 0;
157
84
  try {
158
85
  port = await getAvailablePort();
159
86
  consola.info("runExtensionServer", entryPath, port);
160
- await waitUntilListening(child_process.spawn("node", [entryPath], { env: {
87
+ const child = child_process.spawn("node", [entryPath], { env: {
161
88
  ...process.env,
162
89
  PORT: String(port)
163
- } }));
90
+ } });
91
+ await waitUntilListening(child);
164
92
  return port;
165
93
  } catch (error) {
166
94
  if (!isPortInUseError(error)) {
167
95
  consola.error("runExtensionServer error", error);
168
96
  throw error;
169
97
  }
170
- if (attempts <= MAX_PORT_RETRIES) {
98
+ if (attempts <= 1) {
171
99
  consola.warn("Retrying runExtensionServer on conflicting port", port);
172
100
  return await runExtensionServer(entryPath, attempts + 1);
173
101
  }
@@ -0,0 +1,85 @@
1
+ import { waitForReady } from "./scripts.js";
2
+ import { executablePath } from "./path.js";
3
+ import path from "node:path";
4
+ import { consola } from "consola";
5
+ import child_process from "node:child_process";
6
+ //#region server/utils/microservices_process.ts
7
+ const MILLISECONDS_PER_SECOND = 1e3;
8
+ const DEFAULT_TIMEOUT_SECONDS = 120;
9
+ const MAX_PORT_RETRIES = 1;
10
+ const DEFAULT_RUN_ARGS = { projectFolderPath: "" };
11
+ const LISTENING_LOG_PATTERN = /^Listening on https?:\/\/.+:\d+\/?\s*$/mu;
12
+ async function runScript(execPath, execName, args, expectedResponse, timeoutSeconds = DEFAULT_TIMEOUT_SECONDS) {
13
+ const command = executablePath(execPath, execName);
14
+ consola.debug("runScript", command, args);
15
+ const child = child_process.spawn(command, args, { stdio: [
16
+ "ignore",
17
+ "pipe",
18
+ "pipe"
19
+ ] });
20
+ child.name = command.replace(/^.*[\\/]/u, "");
21
+ child.on("spawn", () => {
22
+ consola.info(`[${child.name}] spawned, pid=${child.pid}`);
23
+ });
24
+ const controller = new AbortController();
25
+ const timer = setTimeout(() => {
26
+ controller.abort();
27
+ }, timeoutSeconds * MILLISECONDS_PER_SECOND);
28
+ if (typeof timer.unref === "function") timer.unref();
29
+ try {
30
+ const result = await waitForReady(child, expectedResponse, controller.signal);
31
+ clearTimeout(timer);
32
+ return result;
33
+ } catch (error) {
34
+ clearTimeout(timer);
35
+ child.kill();
36
+ throw error;
37
+ }
38
+ }
39
+ function isPortInUseError(error) {
40
+ return /EADDRINUSE|address already in use|port already in use/iu.test(String(error));
41
+ }
42
+ function resolveUploadFolderPath(projectFolderPath, uploadFolderPath) {
43
+ if (uploadFolderPath !== void 0 && uploadFolderPath !== "") return uploadFolderPath;
44
+ return path.join(projectFolderPath, "uploads");
45
+ }
46
+ function backArgs(args, port) {
47
+ const { projectFolderPath } = args;
48
+ if (!projectFolderPath) throw new Error("projectFolderPath is required");
49
+ const uploadFolderPath = resolveUploadFolderPath(projectFolderPath, args.uploadFolderPath);
50
+ const executableArgs = [
51
+ "--port",
52
+ String(port),
53
+ "--project_folder_path",
54
+ projectFolderPath,
55
+ "--upload_folder_path",
56
+ uploadFolderPath,
57
+ "--allowed_origins",
58
+ "http://localhost:*",
59
+ "--timeout",
60
+ "0"
61
+ ];
62
+ if (process.env.NODE_ENV === void 0 || process.env.NODE_ENV === "development") executableArgs.push("--debug");
63
+ return executableArgs;
64
+ }
65
+ async function waitUntilListening(child) {
66
+ child.stderr.on("data", (data) => {
67
+ consola.info(`[${child.spawnfile}] STDERR:`, data.toString().trim());
68
+ });
69
+ child.on("close", (code) => {
70
+ consola.info(`[${child.spawnfile}] exited with code ${code}`);
71
+ });
72
+ for await (const chunk of child.stdout) {
73
+ const output = String(chunk);
74
+ consola.info(`[${child.spawnfile}] STDOUT:`, output.trim());
75
+ if (LISTENING_LOG_PATTERN.test(output)) {
76
+ child.stdout.on("data", (data) => {
77
+ consola.info(`[${child.spawnfile}] STDOUT:`, data.toString().trim());
78
+ });
79
+ return;
80
+ }
81
+ }
82
+ throw new Error(`${child.spawnfile} exited before becoming ready`);
83
+ }
84
+ //#endregion
85
+ export { DEFAULT_RUN_ARGS, MAX_PORT_RETRIES, backArgs, isPortInUseError, runScript, waitUntilListening };
@@ -25,31 +25,46 @@ const encoder = new TextEncoder();
25
25
  function byteLength(str) {
26
26
  return encoder.encode(str).byteLength;
27
27
  }
28
+ function truncateLine(lineOutput) {
29
+ const halfBuffer = MAX_ERROR_BUFFER_BYTES / 2;
30
+ return byteLength(lineOutput) > halfBuffer ? `${lineOutput.slice(0, halfBuffer)}…[truncated]` : lineOutput;
31
+ }
32
+ function trimOutputBuffer(output) {
33
+ let trimmed = output;
34
+ while (byteLength(trimmed) > MAX_ERROR_BUFFER_BYTES) {
35
+ const newline = trimmed.indexOf("\n");
36
+ if (newline === -1) return "";
37
+ trimmed = trimmed.slice(newline + 1);
38
+ }
39
+ return trimmed;
40
+ }
41
+ function createOutputRecorder() {
42
+ let recentOutput = "";
43
+ function record(lineOutput) {
44
+ recentOutput = trimOutputBuffer(`${recentOutput} ${truncateLine(lineOutput)}\n`);
45
+ }
46
+ function read() {
47
+ return recentOutput;
48
+ }
49
+ return {
50
+ record,
51
+ read
52
+ };
53
+ }
28
54
  async function waitForReady(child, expectedResponse, signal) {
29
55
  return new Promise((resolve, reject) => {
30
56
  const readlineStdout = readline.createInterface({ input: child.stdout });
31
57
  const readlineStderr = readline.createInterface({ input: child.stderr });
32
- let recentOutput = "";
33
- function recordOutput(lineOutput) {
34
- const safeLine = byteLength(lineOutput) > MAX_ERROR_BUFFER_BYTES / 2 ? `${lineOutput.slice(0, MAX_ERROR_BUFFER_BYTES / 2)}…[truncated]` : lineOutput;
35
- recentOutput = `${recentOutput} ${safeLine}\n`;
36
- while (byteLength(recentOutput) > MAX_ERROR_BUFFER_BYTES) {
37
- const newline = recentOutput.indexOf("\n");
38
- if (newline === -1) {
39
- recentOutput = "";
40
- break;
41
- }
42
- recentOutput = recentOutput.slice(newline + 1);
43
- }
44
- }
58
+ const recorder = createOutputRecorder();
45
59
  let onLine = void 0;
46
- let onErrLine = void 0;
47
60
  let onError = void 0;
48
61
  let onClose = void 0;
49
62
  let onAbort = void 0;
50
63
  function cleanup() {
51
- if (onLine) readlineStdout.removeListener("line", onLine);
52
- if (onErrLine) readlineStderr.removeListener("line", onErrLine);
64
+ if (onLine) {
65
+ readlineStdout.removeListener("line", onLine);
66
+ readlineStderr.removeListener("line", onLine);
67
+ }
53
68
  if (onError) child.removeListener("error", onError);
54
69
  if (onClose) child.removeListener("close", onClose);
55
70
  if (signal && onAbort) signal.removeEventListener("abort", onAbort);
@@ -69,14 +84,9 @@ async function waitForReady(child, expectedResponse, signal) {
69
84
  }
70
85
  onLine = (lineOutput) => {
71
86
  consola.info(`[${child.name}] ${lineOutput}`);
72
- recordOutput(lineOutput);
87
+ recorder.record(lineOutput);
73
88
  if (lineOutput.includes(expectedResponse)) becomeReady();
74
89
  };
75
- onErrLine = (line) => {
76
- consola.info(`[${child.name}] ${line}`);
77
- recordOutput(line);
78
- if (line.includes(expectedResponse)) becomeReady();
79
- };
80
90
  onError = (err) => {
81
91
  cleanup();
82
92
  reject(err);
@@ -84,6 +94,7 @@ async function waitForReady(child, expectedResponse, signal) {
84
94
  onClose = (code) => {
85
95
  consola.info(`[${child.name}] exited with code ${code}`);
86
96
  cleanup();
97
+ const recentOutput = recorder.read();
87
98
  reject(/* @__PURE__ */ new Error(`[${child.name}] exited with code ${code} before becoming ready.${recentOutput ? `\nRecent output:\n${recentOutput}` : ""}`));
88
99
  };
89
100
  onAbort = () => {
@@ -91,7 +102,7 @@ async function waitForReady(child, expectedResponse, signal) {
91
102
  reject(/* @__PURE__ */ new Error(`[${child.name}] timed out waiting for "${expectedResponse}"`));
92
103
  };
93
104
  readlineStdout.on("line", onLine);
94
- readlineStderr.on("line", onErrLine);
105
+ readlineStderr.on("line", onLine);
95
106
  child.once("error", onError);
96
107
  child.once("close", onClose);
97
108
  if (signal) signal.addEventListener("abort", onAbort, { once: true });
@@ -5,6 +5,10 @@ import { createError, defineEventHandler, getQuery, isError, readBody, setRespon
5
5
  //#region server/utils/typed_handler.ts
6
6
  const BAD_REQUEST = 400;
7
7
  const INTERNAL_SERVER_ERROR = 500;
8
+ function describeError(error) {
9
+ if (error instanceof Error) return error.message;
10
+ return String(error);
11
+ }
8
12
  function toErrorResponse(error) {
9
13
  if (isError(error)) return {
10
14
  code: error.statusCode,
@@ -14,7 +18,7 @@ function toErrorResponse(error) {
14
18
  return {
15
19
  code: INTERNAL_SERVER_ERROR,
16
20
  name: "Internal Server Error",
17
- description: error instanceof Error ? error.message : String(error)
21
+ description: describeError(error)
18
22
  };
19
23
  }
20
24
  function sendError(event, schema, error) {
@@ -11,7 +11,12 @@ function isWsRpcMessage(value) {
11
11
  }
12
12
  function rawDataToBlob(raw) {
13
13
  if (raw instanceof ArrayBuffer) return new Blob([raw]);
14
- return new Blob([Uint8Array.from(Array.isArray(raw) ? Buffer.concat(raw) : raw)]);
14
+ if (Array.isArray(raw)) return new Blob([Uint8Array.from(Buffer.concat(raw))]);
15
+ return new Blob([Uint8Array.from(raw)]);
16
+ }
17
+ function findPendingCall(pending, id) {
18
+ if (id === void 0) return;
19
+ return pending.get(id);
15
20
  }
16
21
  function createServerWsRpcClient(baseUrl) {
17
22
  const socket = new WebSocket(baseUrl);
@@ -46,7 +51,7 @@ function createServerWsRpcClient(baseUrl) {
46
51
  return;
47
52
  }
48
53
  if (typeof message.id === "string" && message.id.startsWith("publish:")) return;
49
- const entry = message.id === void 0 ? void 0 : pending.get(message.id);
54
+ const entry = findPendingCall(pending, message.id);
50
55
  if (!entry || message.id === void 0) return;
51
56
  pending.delete(message.id);
52
57
  if (message.error) entry.reject(new Error(message.error.message ?? "wslink RPC error"));
@@ -17,8 +17,8 @@ async function performFetch({ route, method, params, baseURL, headers, max_retry
17
17
  baseURL,
18
18
  method,
19
19
  headers,
20
- ...hasBody(params) ? { body: params } : {},
21
- ...max_retry === void 0 ? {} : { retry: max_retry },
20
+ ...hasBody(params) && { body: params },
21
+ ...max_retry !== void 0 && { retry: max_retry },
22
22
  async onRequestError({ error }) {
23
23
  if (request_error_function) await request_error_function(error);
24
24
  },
@@ -14,7 +14,8 @@ const FALSY_VALUES = /* @__PURE__ */ new Set([
14
14
  "no"
15
15
  ]);
16
16
  function parseBoolean(value) {
17
- const normalized = typeof value === "string" ? value.trim().toLowerCase() : value;
17
+ let normalized = value;
18
+ if (typeof value === "string") normalized = value.trim().toLowerCase();
18
19
  if (TRUTHY_VALUES.has(normalized)) return true;
19
20
  if (FALSY_VALUES.has(normalized)) return false;
20
21
  throw new Error(`Cannot parse boolean from: ${value}`);
@@ -13,6 +13,7 @@ import PointSet3D from "@ogw_front/assets/img/geode_objects/PointSet3D.svg";
13
13
  import PolygonalSurface2D from "@ogw_front/assets/img/geode_objects/PolygonalSurface2D.svg";
14
14
  import PolygonalSurface3D from "@ogw_front/assets/img/geode_objects/PolygonalSurface3D.svg";
15
15
  import PolyhedralSolid3D from "@ogw_front/assets/img/geode_objects/PolyhedralSolid3D.svg";
16
+ // oxlint-disable-next-line import/max-dependencies -- one icon import per geode object.
16
17
  import RasterImage2D from "@ogw_front/assets/img/geode_objects/RasterImage2D.svg";
17
18
  import RasterImage3D from "@ogw_front/assets/img/geode_objects/RasterImage3D.svg";
18
19
  import RegularGrid2D from "@ogw_front/assets/img/geode_objects/RegularGrid2D.svg";
@@ -0,0 +1,28 @@
1
+ <script setup lang="ts">
2
+ import { useBasemapStore } from "@ogw_front/stores/basemap";
3
+
4
+ const basemapStore = useBasemapStore();
5
+ // A hidden basemap stays built: its attribution goes with its maps
6
+ </script>
7
+
8
+ <template>
9
+ <span
10
+ v-if="basemapStore.attribution && basemapStore.maps.length > 0"
11
+ data-testid="basemapAttribution"
12
+ class="basemap-attribution text-caption text-medium-emphasis px-1"
13
+ >
14
+ {{ basemapStore.attribution }}
15
+ </span>
16
+ </template>
17
+
18
+ <style scoped>
19
+ .basemap-attribution {
20
+ position: absolute;
21
+ left: 8px;
22
+ bottom: 4px;
23
+ z-index: 1;
24
+ background: rgba(var(--v-theme-surface), 0.6);
25
+ border-radius: 4px;
26
+ pointer-events: none;
27
+ }
28
+ </style>
@@ -1,16 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import { DEBOUNCE_DELAY, DEFAULT_NORMALS } from "@ogw_front/utils/clipping_planes";
3
- import {
4
- DEFAULT_SLICE_AXIS,
5
- SLICE_AXES,
6
- type SliceAxis,
7
- areAllGrids,
8
- } from "@ogw_front/utils/slice";
9
3
  import type { ClippingPlane } from "@ogw_front/composables/clipping_planes_widget_entries";
10
4
  import ClippingPlaneCard from "@ogw_front/components/ClippingPlaneCard.vue";
11
5
  import SliceCard from "@ogw_front/components/SliceCard.vue";
12
6
  import ToolPanel from "@ogw_front/components/ToolPanel.vue";
13
7
  import { useClippingPlanesWidget } from "@ogw_front/composables/clipping_planes_widget";
8
+ import { useClippingSlices } from "@ogw_front/composables/clipping_slices";
14
9
  import { useDataStore } from "@ogw_front/stores/data";
15
10
  import { useDebounceFn } from "@vueuse/core";
16
11
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
@@ -33,16 +28,12 @@ function newItemId(): number {
33
28
  }
34
29
  const planes = ref<ClippingPlane[]>([{ id: newItemId(), origin: undefined, normal: [1, 0, 0] }]);
35
30
  const allItems = dataStore.refRegisteredItems();
36
- const sliceEnabled = ref<boolean>(false);
37
- const slices = ref<{ id: number; axis: SliceAxis; index: number }[]>([
38
- { id: newItemId(), axis: DEFAULT_SLICE_AXIS, index: 0 },
39
- ]);
40
- const sliceMaxIndices = ref<[number, number, number]>([0, 0, 0]);
41
- const targetIds = computed<string[]>(() =>
42
- targetAllVisible.value ? allItems.value.map((item) => item.id) : selectedDatasetIds.value,
43
- );
44
- const isAllGrid = computed<boolean>(() => areAllGrids(allItems.value, targetIds.value));
45
- const isSliceActive = computed<boolean>(() => isAllGrid.value && sliceEnabled.value);
31
+ const targetIds = computed<string[]>(() => {
32
+ if (targetAllVisible.value) {
33
+ return allItems.value.map((item) => item.id);
34
+ }
35
+ return selectedDatasetIds.value;
36
+ });
46
37
  const availableDatasets = computed<{ title: string; value: string }[]>(() =>
47
38
  allItems.value.map((item) => ({
48
39
  title: item.name || item.id,
@@ -51,8 +42,6 @@ const availableDatasets = computed<{ title: string; value: string }[]>(() =>
51
42
  );
52
43
  const widgetContainer = useTemplateRef("widgetContainer");
53
44
  let debouncedApply: ((...args: unknown[]) => void) | undefined = undefined;
54
- let areSlicesApplied = false;
55
- let pendingSlices: Promise<void> = Promise.resolve();
56
45
 
57
46
  const {
58
47
  getSceneCenter,
@@ -76,6 +65,19 @@ function getUntargetedIds(): string[] {
76
65
  return allItems.value.map((item) => item.id).filter((id) => !targetIds.value.includes(id));
77
66
  }
78
67
 
68
+ const {
69
+ sliceEnabled,
70
+ slices,
71
+ sliceMaxIndices,
72
+ isAllGrid,
73
+ isSliceActive,
74
+ applySlices,
75
+ addSlice,
76
+ removeSlice,
77
+ resetSlices,
78
+ removeSlices,
79
+ } = useClippingSlices({ allItems, targetIds, getUntargetedIds, newItemId, hybridViewerStore });
80
+
79
81
  async function applyClippingPlanes(): Promise<void> {
80
82
  if (allItems.value.length === 0) {
81
83
  return;
@@ -97,45 +99,6 @@ async function applyClippingPlanes(): Promise<void> {
97
99
  }
98
100
  }
99
101
 
100
- async function sendSlices(): Promise<void> {
101
- if (!isAllGrid.value && !areSlicesApplied) {
102
- return;
103
- }
104
- const isActive = isSliceActive.value;
105
- const untargetedIds = getUntargetedIds();
106
- if (targetIds.value.length > 0) {
107
- const maxIndices = await hybridViewerStore.setSlice(
108
- targetIds.value,
109
- isActive ? slices.value.map(({ axis, index }) => ({ axis, index })) : [],
110
- );
111
- if (isAllGrid.value) {
112
- sliceMaxIndices.value = maxIndices;
113
- }
114
- if (isActive) {
115
- for (const slice of slices.value) {
116
- slice.index = Math.min(slice.index, maxIndices[slice.axis]);
117
- }
118
- }
119
- }
120
- if (areSlicesApplied && untargetedIds.length > 0) {
121
- await hybridViewerStore.setSlice(untargetedIds, []);
122
- }
123
- areSlicesApplied = isActive;
124
- }
125
-
126
- function queueSliceTask(task: () => Promise<void>): Promise<void> {
127
- const previous = pendingSlices;
128
- pendingSlices = (async (): Promise<void> => {
129
- await Promise.allSettled([previous]);
130
- await task();
131
- })();
132
- return pendingSlices;
133
- }
134
-
135
- function applySlices(): Promise<void> {
136
- return queueSliceTask(sendSlices);
137
- }
138
-
139
102
  async function applyAll(): Promise<void> {
140
103
  await applyClippingPlanes();
141
104
  await applySlices();
@@ -156,19 +119,6 @@ function removePlane(index: number): void {
156
119
  planes.value.splice(index, 1);
157
120
  }
158
121
 
159
- function addSlice(): void {
160
- const lastSlice = slices.value.at(-1);
161
- slices.value.push({
162
- id: newItemId(),
163
- axis: lastSlice ? SLICE_AXES[lastSlice.axis].next : DEFAULT_SLICE_AXIS,
164
- index: 0,
165
- });
166
- }
167
-
168
- function removeSlice(index: number): void {
169
- slices.value.splice(index, 1);
170
- }
171
-
172
122
  function flipNormal(plane: { normal: number[] }): void {
173
123
  plane.normal = plane.normal.map((component) => -component);
174
124
  syncWidgets();
@@ -178,8 +128,7 @@ function flipNormal(plane: { normal: number[] }): void {
178
128
  async function resetClippingPlanes(): Promise<void> {
179
129
  setFromWidget(true);
180
130
  planes.value = [{ id: newItemId(), origin: undefined, normal: [1, 0, 0] }];
181
- sliceEnabled.value = false;
182
- slices.value = [{ id: newItemId(), axis: DEFAULT_SLICE_AXIS, index: 0 }];
131
+ resetSlices();
183
132
  updateWidgetPlacement({ isReset: true });
184
133
  setFromWidget(false);
185
134
  await applyAll();
@@ -188,12 +137,7 @@ async function resetClippingPlanes(): Promise<void> {
188
137
  async function removeClippingPlanes(): Promise<void> {
189
138
  const allIds = allItems.value.map((item) => item.id);
190
139
  await hybridViewerStore.setClippingPlanes(allIds, []);
191
- await queueSliceTask(async () => {
192
- if (areSlicesApplied) {
193
- await hybridViewerStore.setSlice(allIds, []);
194
- areSlicesApplied = false;
195
- }
196
- });
140
+ await removeSlices(allIds);
197
141
  }
198
142
 
199
143
  watch(widgetContainer, (container) => {