@geode/opengeodeweb-front 10.34.0-rc.2 → 10.34.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build/opengeodeweb_front_schemas.js +175 -0
- package/.build/server/utils/app_config.js +57 -0
- package/.build/server/utils/cleanup.js +135 -0
- package/.build/server/utils/cloud.js +156 -0
- package/.build/server/utils/microservices.js +153 -0
- package/.build/server/utils/path.js +108 -0
- package/.build/server/utils/scripts.js +134 -0
- package/.build/server/utils/server.js +44 -0
- package/.build/server/utils/server_config.js +51 -0
- package/.build/server/utils/stream.js +6 -0
- package/.build/server/utils/ws_client.js +100 -0
- package/.build/shared/app_mode.js +8 -0
- package/.build/shared/scripts.js +49 -0
- package/.build/shared/utils/call_raw.js +31 -0
- package/.build/shared/utils/call_schema.js +28 -0
- package/.build/shared/utils/fetch_raw.js +52 -0
- package/.build/shared/utils/fetch_schema.js +32 -0
- package/.build/shared/utils/file.js +14 -0
- package/.build/shared/utils/parse_boolean.js +23 -0
- package/.build/shared/utils/response_handlers/load.js +50 -0
- package/.build/shared/utils/types.js +1 -0
- package/.build/shared/utils/validate_schema.js +17 -0
- package/README.md +8 -0
- package/app/assets/{geode_objects.js → geode_objects.ts} +8 -1
- package/app/components/ActionButton.vue +28 -12
- package/app/components/Basic/Slider.vue +2 -2
- package/app/components/Basic/Switch.vue +2 -2
- package/app/components/CameraManager/List.vue +11 -11
- package/app/components/CameraManager/Saver.vue +8 -4
- package/app/components/CameraManager.vue +24 -12
- package/app/components/CameraOrientation.vue +31 -17
- package/app/components/ClippingPlaneCard.vue +13 -12
- package/app/components/ClippingPlanes.vue +31 -21
- package/app/components/CrsSelector.vue +26 -18
- package/app/components/DeleteDialog.vue +18 -16
- package/app/components/DragAndDrop.vue +55 -37
- package/app/components/DragAndDropInternal/DragAndDropInline.vue +31 -16
- package/app/components/DragAndDropInternal/DragAndDropOverlay.vue +32 -19
- package/app/components/ExtensionSelector.vue +34 -18
- package/app/components/FeedBack/ErrorBanner.vue +4 -3
- package/app/components/FeedBack/Snackers.vue +6 -5
- package/app/components/FetchingData.vue +8 -12
- package/app/components/FileSelector.vue +27 -17
- package/app/components/FileUploader.vue +51 -30
- package/app/components/GlassCard.vue +17 -13
- package/app/components/HybridRenderingView.vue +25 -12
- package/app/components/HybridViewerTooltip.vue +28 -26
- package/app/components/InfraConnected.vue +1 -1
- package/app/components/Launcher.vue +12 -10
- package/app/components/Loading/EcoMessages.vue +24 -13
- package/app/components/Loading/Header.vue +6 -7
- package/app/components/Loading/Progress.vue +6 -7
- package/app/components/Loading.vue +10 -14
- package/app/components/MissingFilesSelector.vue +35 -19
- package/app/components/ObjectSelector.vue +37 -21
- package/app/components/PackagesVersions.vue +16 -8
- package/app/components/Recaptcha.vue +17 -23
- package/app/components/RemoteRenderingView.vue +21 -15
- package/app/components/Ruler.vue +11 -9
- package/app/components/Screenshot.vue +25 -19
- package/app/components/SearchBar.vue +12 -6
- package/app/components/ShrinkFilter.vue +19 -14
- package/app/components/Step.vue +32 -12
- package/app/components/Stepper.vue +19 -7
- package/app/components/ToolPanel.vue +29 -13
- package/app/components/ViewToolbar.vue +53 -44
- package/app/components/Viewer/ContextMenu/CenterButton.vue +16 -9
- package/app/components/Viewer/ContextMenu/CircularItems.vue +13 -10
- package/app/components/Viewer/ContextMenu/ContextMenu.vue +40 -32
- package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +31 -17
- package/app/components/Viewer/ContextMenu/InfoCard.vue +38 -22
- package/app/components/Viewer/EdgedCurve/PointsOptions.vue +8 -5
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +67 -48
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +74 -50
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +69 -50
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +47 -35
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +91 -51
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +74 -49
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +115 -53
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +75 -37
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +13 -9
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +110 -61
- package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +32 -21
- package/app/components/Viewer/Generic/Model/ModelStyleOptions.vue +9 -5
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +19 -13
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +119 -49
- package/app/components/Viewer/Grid/2D/CellsOptions.vue +8 -5
- package/app/components/Viewer/Grid/2D/EdgesOptions.vue +8 -5
- package/app/components/Viewer/Grid/2D/PointsOptions.vue +8 -5
- package/app/components/Viewer/Grid/3D/CellsOptions.vue +8 -5
- package/app/components/Viewer/Grid/3D/EdgesOptions.vue +8 -5
- package/app/components/Viewer/Grid/3D/FacetsOptions.vue +8 -5
- package/app/components/Viewer/Grid/3D/PointsOptions.vue +8 -5
- package/app/components/Viewer/ObjectTree/Base/CommonTreeView.vue +120 -76
- package/app/components/Viewer/ObjectTree/Base/Controls.vue +25 -10
- package/app/components/Viewer/ObjectTree/Base/ItemLabel.vue +42 -17
- package/app/components/Viewer/ObjectTree/Base/StickyHeader.vue +22 -9
- package/app/components/Viewer/ObjectTree/Base/TreeRow.vue +29 -14
- package/app/components/Viewer/ObjectTree/Box.vue +32 -15
- package/app/components/Viewer/ObjectTree/Layout.vue +55 -35
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +63 -34
- package/app/components/Viewer/ObjectTree/Views/{ModelCollections.vue → ModelTree.vue} +101 -39
- package/app/components/Viewer/Options/AttributeColorBar.vue +14 -6
- package/app/components/Viewer/Options/AttributeRangeSelector.vue +8 -4
- package/app/components/Viewer/Options/AttributeSelector.vue +64 -33
- package/app/components/Viewer/Options/ColorMapList.vue +52 -24
- package/app/components/Viewer/Options/ColorMapPicker.vue +15 -11
- package/app/components/Viewer/Options/ColorPicker.vue +239 -50
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +87 -67
- package/app/components/Viewer/Options/ColormapQuickPicker.vue +16 -12
- package/app/components/Viewer/Options/OptionsSection.vue +7 -5
- package/app/components/Viewer/Options/Sliders/Size.vue +3 -3
- package/app/components/Viewer/Options/Sliders/Slider.vue +9 -6
- package/app/components/Viewer/Options/Sliders/Width.vue +3 -3
- package/app/components/Viewer/Options/TextureItem.vue +29 -22
- package/app/components/Viewer/Options/TexturesSelector.vue +23 -12
- package/app/components/Viewer/Options/VisibilitySwitch.vue +3 -3
- package/app/components/Viewer/OverlappingObjectsPicker.vue +27 -12
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +38 -26
- package/app/components/Viewer/Solid/EdgesOptions.vue +8 -5
- package/app/components/Viewer/Solid/PointsOptions.vue +8 -5
- package/app/components/Viewer/Solid/PolygonsOptions.vue +8 -5
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +73 -48
- package/app/components/Viewer/Surface/EdgesOptions.vue +8 -5
- package/app/components/Viewer/Surface/PointsOptions.vue +8 -5
- package/app/components/Viewer/Surface/PolygonsOptions.vue +79 -49
- package/app/components/Viewer/Surface/Triangulated/TrianglesOptions.vue +8 -5
- package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +8 -5
- package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +8 -5
- package/app/components/Viewer/Ui.vue +19 -14
- package/app/components/Wrapper.vue +16 -10
- package/app/components/ZScaling.vue +18 -10
- package/app/components/csv-preview/CsvPreviewer.vue +72 -50
- package/app/components/csv-preview/CsvSettings.vue +30 -50
- package/app/components/csv-preview/CsvTable.vue +34 -14
- package/app/composables/{batch_style.js → batch_style.ts} +9 -7
- package/app/composables/clipping_planes_widget.ts +204 -0
- package/app/composables/clipping_planes_widget_entries.ts +189 -0
- package/app/composables/copy_to_clipboard.ts +7 -0
- package/app/composables/global_attribute_style.ts +303 -0
- package/app/composables/hover_highlight.ts +127 -0
- package/app/composables/{model_collections.js → model_collections.ts} +28 -9
- package/app/composables/{model_components.js → model_components.ts} +28 -9
- package/app/composables/{project_manager.js → project_manager.ts} +77 -20
- package/app/composables/responsive_middle_truncate.ts +48 -0
- package/app/composables/{run_function_when_microservices_connected.js → run_function_when_microservices_connected.ts} +1 -1
- package/app/composables/stepper_tree.ts +79 -0
- package/app/composables/tree_filter.ts +194 -0
- package/app/composables/{tree_keyboard_nav.js → tree_keyboard_nav.ts} +62 -20
- package/app/composables/{tree_scroll.js → tree_scroll.ts} +61 -12
- package/app/composables/use_adaptive_styles.ts +186 -0
- package/app/composables/use_overlapping_picker.ts +263 -0
- package/app/composables/use_quick_colormap.ts +55 -0
- package/app/composables/virtual_tree.ts +271 -0
- package/app/composables/vtk_implicit_plane_widget.d.ts +2 -0
- package/app/plugins/{auto_store_register.js → auto_store_register.ts} +3 -5
- package/app/plugins/click_outside_ignore_snackbars.client.ts +36 -0
- package/app/stores/app.ts +252 -0
- package/app/stores/app_helpers/extension.ts +179 -0
- package/app/stores/{back.js → back.ts} +54 -28
- package/app/stores/camera_manager.ts +80 -0
- package/app/stores/{cloud.js → cloud.ts} +18 -13
- package/app/stores/data.ts +392 -0
- package/app/stores/data_helpers/collections.ts +138 -0
- package/app/stores/data_helpers/mesh.ts +169 -0
- package/app/stores/data_style.ts +167 -0
- package/app/stores/{feedback.js → feedback.ts} +19 -8
- package/app/stores/{hybrid_viewer.js → hybrid_viewer.ts} +49 -45
- package/app/stores/infra.ts +106 -0
- package/app/stores/{menu.js → menu.ts} +67 -36
- package/app/stores/treeview.ts +383 -0
- package/app/stores/{viewer.js → viewer.ts} +75 -42
- package/app/utils/attributes.ts +40 -0
- package/app/utils/clipping_planes.ts +222 -0
- package/app/utils/color_picker.js +54 -0
- package/app/utils/colormap.ts +102 -0
- package/app/utils/default_styles/{constants.js → constants.ts} +25 -12
- package/app/utils/default_styles/{index.js → index.ts} +4 -3
- package/app/utils/default_styles/meshes.ts +264 -0
- package/app/utils/default_styles/{models.js → models.ts} +106 -52
- package/app/utils/{extension.js → extension.ts} +63 -19
- package/app/utils/{import_workflow.js → import_workflow.ts} +39 -22
- package/app/utils/{log.js → log.ts} +12 -2
- package/app/utils/{name_cleaner.js → name_cleaner.ts} +6 -6
- package/app/utils/status.ts +19 -0
- package/app/utils/{stores.js → stores.ts} +5 -5
- package/app/utils/{string.js → string.ts} +6 -6
- package/app/utils/{treeview.js → treeview.ts} +4 -1
- package/internal/database/{base_database.js → base_database.ts} +7 -3
- package/internal/database/database.ts +102 -0
- package/internal/database/{extended_database.js → extended_database.ts} +5 -1
- package/internal/database/tables/camera_positions.ts +6 -0
- package/internal/database/tables/{data.js → data.ts} +3 -1
- package/internal/database/tables/data_style.ts +6 -0
- package/internal/database/tables/model_component_datastyle.ts +6 -0
- package/internal/database/tables/model_component_type_datastyle.ts +6 -0
- package/internal/database/tables/model_components.ts +6 -0
- package/internal/database/tables/model_components_relation.ts +6 -0
- package/internal/database/tables/table_definition.ts +5 -0
- package/internal/stores/data_style/mesh/cells/cell.ts +279 -0
- package/internal/stores/data_style/mesh/cells/{color.js → color.ts} +13 -7
- package/internal/stores/data_style/mesh/cells/common.ts +50 -0
- package/internal/stores/data_style/mesh/cells/index.ts +161 -0
- package/internal/stores/data_style/mesh/cells/{textures.js → textures.ts} +14 -8
- package/internal/stores/data_style/mesh/cells/vertex.ts +285 -0
- package/internal/stores/data_style/mesh/cells/visibility.ts +46 -0
- package/internal/stores/data_style/mesh/edges/{color.js → color.ts} +13 -7
- package/internal/stores/data_style/mesh/edges/common.ts +41 -0
- package/internal/stores/data_style/mesh/edges/edge.ts +279 -0
- package/internal/stores/data_style/mesh/edges/index.ts +155 -0
- package/internal/stores/data_style/mesh/edges/vertex.ts +285 -0
- package/internal/stores/data_style/mesh/edges/visibility.ts +45 -0
- package/internal/stores/data_style/mesh/edges/width.ts +42 -0
- package/internal/stores/data_style/mesh/{index.js → index.ts} +34 -14
- package/internal/stores/data_style/mesh/points/{color.js → color.ts} +13 -7
- package/internal/stores/data_style/mesh/points/common.ts +51 -0
- package/internal/stores/data_style/mesh/points/index.ts +133 -0
- package/internal/stores/data_style/mesh/points/size.ts +43 -0
- package/internal/stores/data_style/mesh/points/vertex.ts +285 -0
- package/internal/stores/data_style/mesh/points/visibility.ts +49 -0
- package/internal/stores/data_style/mesh/polygons/{color.js → color.ts} +13 -7
- package/internal/stores/data_style/mesh/polygons/common.ts +50 -0
- package/internal/stores/data_style/mesh/polygons/index.ts +167 -0
- package/internal/stores/data_style/mesh/polygons/polygon.ts +282 -0
- package/internal/stores/data_style/mesh/polygons/{textures.js → textures.ts} +14 -8
- package/internal/stores/data_style/mesh/polygons/vertex.ts +288 -0
- package/internal/stores/data_style/mesh/polygons/visibility.ts +48 -0
- package/internal/stores/data_style/mesh/polyhedra/{color.js → color.ts} +13 -7
- package/internal/stores/data_style/mesh/polyhedra/common.ts +41 -0
- package/internal/stores/data_style/mesh/polyhedra/index.ts +157 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +294 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +288 -0
- package/internal/stores/data_style/mesh/polyhedra/visibility.ts +48 -0
- package/internal/stores/data_style/model/blocks/{color.js → color.ts} +50 -13
- package/internal/stores/data_style/model/blocks/common.ts +67 -0
- package/internal/stores/data_style/model/blocks/{index.js → index.ts} +111 -66
- package/internal/stores/data_style/model/blocks/polyhedron.ts +363 -0
- package/internal/stores/data_style/model/blocks/vertex.ts +349 -0
- package/internal/stores/data_style/model/blocks/visibility.ts +37 -0
- package/internal/stores/data_style/model/color.ts +348 -0
- package/internal/stores/data_style/model/common.ts +262 -0
- package/internal/stores/data_style/model/corners/{color.js → color.ts} +49 -10
- package/internal/stores/data_style/model/corners/common.ts +71 -0
- package/internal/stores/data_style/model/corners/{index.js → index.ts} +86 -47
- package/internal/stores/data_style/model/corners/vertex.ts +315 -0
- package/internal/stores/data_style/model/corners/visibility.ts +39 -0
- package/internal/stores/data_style/model/edges/common.ts +29 -0
- package/internal/stores/data_style/model/edges/{index.js → index.ts} +2 -7
- package/internal/stores/data_style/model/edges/visibility.ts +55 -0
- package/internal/stores/data_style/model/{index.js → index.ts} +24 -11
- package/internal/stores/data_style/model/lines/{color.js → color.ts} +47 -10
- package/internal/stores/data_style/model/lines/common.ts +63 -0
- package/internal/stores/data_style/model/lines/edge.ts +343 -0
- package/internal/stores/data_style/model/lines/{index.js → index.ts} +108 -66
- package/internal/stores/data_style/model/lines/vertex.ts +344 -0
- package/internal/stores/data_style/model/lines/visibility.ts +37 -0
- package/internal/stores/data_style/model/points/common.ts +25 -0
- package/internal/stores/data_style/model/points/index.ts +35 -0
- package/internal/stores/data_style/model/points/size.ts +44 -0
- package/internal/stores/data_style/model/points/visibility.ts +46 -0
- package/internal/stores/data_style/model/selection.ts +138 -0
- package/internal/stores/data_style/model/surfaces/{color.js → color.ts} +47 -10
- package/internal/stores/data_style/model/surfaces/common.ts +69 -0
- package/internal/stores/data_style/model/surfaces/{index.js → index.ts} +113 -66
- package/internal/stores/data_style/model/surfaces/polygon.ts +347 -0
- package/internal/stores/data_style/model/surfaces/vertex.ts +351 -0
- package/internal/stores/data_style/model/surfaces/visibility.ts +37 -0
- package/internal/stores/data_style/model/{visibility.js → visibility.ts} +112 -32
- package/internal/stores/data_style/state.ts +281 -0
- package/internal/stores/data_style/types.ts +30 -0
- package/internal/stores/hybrid_viewer/brightness.ts +124 -0
- package/internal/stores/hybrid_viewer/camera.ts +326 -0
- package/internal/stores/hybrid_viewer/{camera_animation.js → camera_animation.ts} +30 -12
- package/internal/stores/hybrid_viewer/{constants.js → constants.ts} +2 -2
- package/internal/stores/hybrid_viewer/core.ts +64 -0
- package/internal/stores/hybrid_viewer/{filters.js → filters.ts} +10 -13
- package/internal/stores/hybrid_viewer/highlight.ts +183 -0
- package/internal/stores/hybrid_viewer/{ruler.js → ruler.ts} +50 -22
- package/internal/stores/hybrid_viewer/scene.ts +125 -0
- package/internal/stores/hybrid_viewer/viewport.ts +177 -0
- package/internal/stores/hybrid_viewer/vtk_types.ts +58 -0
- package/internal/utils/api_fetch.ts +133 -0
- package/internal/utils/upload_file.ts +115 -0
- package/internal/utils/viewer_call.ts +99 -0
- package/internal/utils/ws_client.ts +54 -0
- package/nuxt.config.ts +168 -0
- package/opengeodeweb_front_schemas.json +2 -2
- package/package.json +49 -13
- package/server/api/cloud/extensions/{run.post.js → run.post.ts} +16 -12
- package/server/api/local/app/project_folder_path.post.ts +33 -0
- package/server/api/local/app/run_back.post.ts +39 -0
- package/server/api/local/app/run_viewer.post.ts +39 -0
- package/server/api/local/extensions/{kill.post.js → kill.post.ts} +15 -8
- package/server/api/local/extensions/{run.post.js → run.post.ts} +17 -12
- package/server/api/local/extensions/upload.put.ts +71 -0
- package/server/api/microservice/app/{get_is_app_ready.get.js → get_is_app_ready.get.ts} +5 -5
- package/server/api/microservice/app/schemas/get_is_app_ready.json +1 -1
- package/server/api/microservice/app/set_app_base_url.post.ts +29 -0
- package/server/api/microservice/app/set_back_base_url.post.ts +26 -0
- package/server/api/microservice/app/set_is_app_ready.post.ts +29 -0
- package/server/api/microservice/app/set_viewer_base_url.post.ts +26 -0
- package/server/api/microservice/extensions/{download.post.js → download.post.ts} +13 -6
- package/server/api/serverless/run_cloud.post.ts +92 -0
- package/server/utils/{app_config.js → app_config.ts} +40 -18
- package/server/utils/{cleanup.js → cleanup.ts} +76 -29
- package/server/utils/{cloud.js → cloud.ts} +33 -17
- package/server/utils/{extension.js → extension.ts} +31 -4
- package/server/utils/{microservices.js → microservices.ts} +68 -27
- package/server/utils/{path.js → path.ts} +36 -17
- package/server/utils/{scripts.js → scripts.ts} +49 -33
- package/server/utils/{server.js → server.ts} +13 -6
- package/server/utils/server_config.ts +74 -0
- package/server/utils/stream.ts +6 -0
- package/server/utils/ws_client.ts +165 -0
- package/shared/{scripts.js → scripts.ts} +15 -10
- package/shared/utils/call_raw.ts +73 -0
- package/shared/utils/{call_schema.js → call_schema.ts} +15 -6
- package/shared/utils/fetch_raw.ts +125 -0
- package/shared/utils/{fetch_schema.js → fetch_schema.ts} +16 -7
- package/shared/utils/file.ts +22 -0
- package/shared/utils/{parse_boolean.js → parse_boolean.ts} +1 -1
- package/shared/utils/response_handlers/load.ts +109 -0
- package/shared/utils/types.ts +27 -0
- package/shared/utils/{validate_schema.js → validate_schema.ts} +3 -1
- package/.github/workflows/config.json +0 -5
- package/.github/workflows/deploy.yml +0 -15
- package/.github/workflows/manual_release.yml +0 -11
- package/.github/workflows/merge_request.yml +0 -9
- package/.github/workflows/pr_update.yml +0 -11
- package/.github/workflows/prepare_deploy.yml +0 -9
- package/.github/workflows/schedule.yml +0 -18
- package/.github/workflows/test.yml +0 -14
- package/.github/workflows/test_pr.yml +0 -12
- package/.oxlintrc.json +0 -150
- package/.releaserc +0 -11
- package/app/components/Viewer/ObjectTree/Views/ModelComponents.vue +0 -224
- package/app/composables/clipping_planes_widget.js +0 -249
- package/app/composables/global_attribute_style.js +0 -181
- package/app/composables/hover_highlight.js +0 -91
- package/app/composables/responsive_middle_truncate.js +0 -34
- package/app/composables/stepper_tree.js +0 -56
- package/app/composables/tree_filter.js +0 -138
- package/app/composables/use_adaptive_styles.js +0 -120
- package/app/composables/use_overlapping_picker.js +0 -169
- package/app/composables/use_quick_colormap.js +0 -32
- package/app/composables/virtual_tree.js +0 -191
- package/app/stores/app.js +0 -326
- package/app/stores/camera_manager.js +0 -57
- package/app/stores/data.js +0 -278
- package/app/stores/data_helpers/collections.js +0 -96
- package/app/stores/data_helpers/mesh.js +0 -122
- package/app/stores/data_style.js +0 -116
- package/app/stores/infra.js +0 -95
- package/app/stores/treeview.js +0 -290
- package/app/utils/attributes.js +0 -23
- package/app/utils/clipping_planes.js +0 -110
- package/app/utils/colormap.js +0 -64
- package/app/utils/default_styles/meshes.js +0 -191
- package/app/utils/status.js +0 -10
- package/commitlint.config.js +0 -20
- package/internal/database/database.js +0 -80
- package/internal/database/tables/camera_positions.js +0 -4
- package/internal/database/tables/data_style.js +0 -4
- package/internal/database/tables/model_component_datastyle.js +0 -4
- package/internal/database/tables/model_component_type_datastyle.js +0 -4
- package/internal/database/tables/model_components.js +0 -4
- package/internal/database/tables/model_components_relation.js +0 -4
- package/internal/stores/data_style/mesh/cells/cell.js +0 -196
- package/internal/stores/data_style/mesh/cells/common.js +0 -39
- package/internal/stores/data_style/mesh/cells/index.js +0 -81
- package/internal/stores/data_style/mesh/cells/vertex.js +0 -193
- package/internal/stores/data_style/mesh/cells/visibility.js +0 -35
- package/internal/stores/data_style/mesh/edges/common.js +0 -32
- package/internal/stores/data_style/mesh/edges/edge.js +0 -195
- package/internal/stores/data_style/mesh/edges/index.js +0 -81
- package/internal/stores/data_style/mesh/edges/vertex.js +0 -196
- package/internal/stores/data_style/mesh/edges/visibility.js +0 -34
- package/internal/stores/data_style/mesh/edges/width.js +0 -34
- package/internal/stores/data_style/mesh/points/common.js +0 -37
- package/internal/stores/data_style/mesh/points/index.js +0 -82
- package/internal/stores/data_style/mesh/points/size.js +0 -35
- package/internal/stores/data_style/mesh/points/vertex.js +0 -193
- package/internal/stores/data_style/mesh/points/visibility.js +0 -37
- package/internal/stores/data_style/mesh/polygons/common.js +0 -32
- package/internal/stores/data_style/mesh/polygons/index.js +0 -107
- package/internal/stores/data_style/mesh/polygons/polygon.js +0 -196
- package/internal/stores/data_style/mesh/polygons/vertex.js +0 -196
- package/internal/stores/data_style/mesh/polygons/visibility.js +0 -38
- package/internal/stores/data_style/mesh/polyhedra/common.js +0 -32
- package/internal/stores/data_style/mesh/polyhedra/index.js +0 -98
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +0 -196
- package/internal/stores/data_style/mesh/polyhedra/vertex.js +0 -196
- package/internal/stores/data_style/mesh/polyhedra/visibility.js +0 -38
- package/internal/stores/data_style/model/blocks/common.js +0 -51
- package/internal/stores/data_style/model/blocks/polyhedron.js +0 -215
- package/internal/stores/data_style/model/blocks/vertex.js +0 -204
- package/internal/stores/data_style/model/blocks/visibility.js +0 -20
- package/internal/stores/data_style/model/color.js +0 -218
- package/internal/stores/data_style/model/common.js +0 -141
- package/internal/stores/data_style/model/corners/common.js +0 -51
- package/internal/stores/data_style/model/corners/vertex.js +0 -204
- package/internal/stores/data_style/model/corners/visibility.js +0 -20
- package/internal/stores/data_style/model/edges/common.js +0 -20
- package/internal/stores/data_style/model/edges/visibility.js +0 -38
- package/internal/stores/data_style/model/lines/common.js +0 -51
- package/internal/stores/data_style/model/lines/edge.js +0 -203
- package/internal/stores/data_style/model/lines/vertex.js +0 -204
- package/internal/stores/data_style/model/lines/visibility.js +0 -20
- package/internal/stores/data_style/model/points/common.js +0 -20
- package/internal/stores/data_style/model/points/index.js +0 -25
- package/internal/stores/data_style/model/points/size.js +0 -36
- package/internal/stores/data_style/model/points/visibility.js +0 -36
- package/internal/stores/data_style/model/selection.js +0 -89
- package/internal/stores/data_style/model/surfaces/common.js +0 -51
- package/internal/stores/data_style/model/surfaces/polygon.js +0 -215
- package/internal/stores/data_style/model/surfaces/vertex.js +0 -215
- package/internal/stores/data_style/model/surfaces/visibility.js +0 -20
- package/internal/stores/data_style/state.js +0 -197
- package/internal/stores/hybrid_viewer/brightness.js +0 -82
- package/internal/stores/hybrid_viewer/camera.js +0 -274
- package/internal/stores/hybrid_viewer/highlight.js +0 -170
- package/internal/stores/hybrid_viewer/scene.js +0 -136
- package/internal/stores/hybrid_viewer/viewport.js +0 -140
- package/internal/utils/api_fetch.js +0 -52
- package/internal/utils/upload_file.js +0 -57
- package/internal/utils/viewer_call.js +0 -49
- package/internal/utils/ws_client.js +0 -29
- package/nuxt.config.js +0 -106
- package/scripts/generate_geode_objects.js +0 -24
- package/server/api/local/app/project_folder_path.post.js +0 -29
- package/server/api/local/app/run_back.post.js +0 -33
- package/server/api/local/app/run_viewer.post.js +0 -33
- package/server/api/local/extensions/upload.put.js +0 -72
- package/server/api/microservice/app/set_app_base_url.post.js +0 -25
- package/server/api/microservice/app/set_back_base_url.post.js +0 -22
- package/server/api/microservice/app/set_is_app_ready.post.js +0 -25
- package/server/api/microservice/app/set_viewer_base_url.post.js +0 -22
- package/server/api/serverless/run_cloud.post.js +0 -44
- package/server/utils/server_config.js +0 -58
- package/server/utils/ws_client.js +0 -112
- package/shared/utils/call_raw.js +0 -46
- package/shared/utils/fetch_raw.js +0 -61
- package/shared/utils/file.js +0 -16
- package/shared/utils/response_handlers/load.js +0 -74
- package/tests/integration/data/uploads/test.og_brep +0 -0
- package/tests/integration/data/uploads/test.og_edc2d +0 -0
- package/tests/integration/data/uploads/test.og_edc3d +0 -0
- package/tests/integration/data/uploads/test.og_psf3d +0 -0
- package/tests/integration/data/uploads/test.og_rgd2d +0 -0
- package/tests/integration/data/uploads/test.og_rgd3d +0 -0
- package/tests/integration/data/uploads/test.vtu +0 -22
- package/tests/integration/setup.js +0 -92
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +0 -343
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +0 -254
- package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +0 -62
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +0 -201
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +0 -260
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +0 -267
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +0 -397
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +0 -264
- package/tests/integration/stores/data_style/model/edges.nuxt.test.js +0 -71
- package/tests/integration/stores/data_style/model/index.nuxt.test.js +0 -92
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +0 -379
- package/tests/integration/stores/data_style/model/points.nuxt.test.js +0 -95
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +0 -574
- package/tests/integration/stores/viewer.nuxt.test.js +0 -69
- package/tests/setup_indexeddb.js +0 -4
- package/tests/unit/components/CrsSelector.nuxt.test.js +0 -55
- package/tests/unit/components/DragAndDrop.nuxt.test.js +0 -89
- package/tests/unit/components/ExtensionSelector.nuxt.test.js +0 -65
- package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +0 -41
- package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +0 -49
- package/tests/unit/components/FileSelector.nuxt.test.js +0 -124
- package/tests/unit/components/FileUploader.nuxt.test.js +0 -69
- package/tests/unit/components/MissingFilesSelector.nuxt.test.js +0 -77
- package/tests/unit/components/ObjectSelector.nuxt.test.js +0 -118
- package/tests/unit/components/PackagesVersions.nuxt.test.js +0 -42
- package/tests/unit/components/Step.nuxt.test.js +0 -51
- package/tests/unit/components/Stepper.nuxt.test.js +0 -41
- package/tests/unit/components/ToolPanel.nuxt.test.js +0 -66
- package/tests/unit/composables/api_fetch.nuxt.test.js +0 -75
- package/tests/unit/composables/project_manager.nuxt.test.js +0 -299
- package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +0 -57
- package/tests/unit/composables/upload_file.nuxt.test.js +0 -45
- package/tests/unit/composables/virtual_tree.nuxt.test.js +0 -63
- package/tests/unit/plugins/project_load.nuxt.test.js +0 -98
- package/tests/unit/stores/app.nuxt.test.js +0 -189
- package/tests/unit/stores/back.nuxt.test.js +0 -147
- package/tests/unit/stores/cloud.nuxt.test.js +0 -90
- package/tests/unit/stores/data.nuxt.test.js +0 -162
- package/tests/unit/stores/feedback.nuxt.test.js +0 -90
- package/tests/unit/stores/infra.nuxt.test.js +0 -313
- package/tests/unit/stores/treeview.nuxt.test.js +0 -63
- package/tests/unit/stores/viewer.nuxt.test.js +0 -161
- package/tests/unit/utils/validate_schema.nuxt.test.js +0 -38
- package/tests/utils.js +0 -20
- package/tests/vitest.config.js +0 -67
- /package/server/api/local/app/{kill.post.js → kill.post.ts} +0 -0
- /package/shared/{app_mode.js → app_mode.ts} +0 -0
|
@@ -3,14 +3,21 @@
|
|
|
3
3
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json";
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
|
+
import { type NewDataItem, useDataStore } from "@ogw_front/stores/data";
|
|
6
7
|
import { useBackStore } from "@ogw_front/stores/back";
|
|
7
|
-
import { useDataStore } from "@ogw_front/stores/data";
|
|
8
8
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
9
9
|
import { useFeedbackStore } from "@ogw_front/stores/feedback";
|
|
10
10
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
11
11
|
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
interface FileToImport {
|
|
14
|
+
readonly filename: string;
|
|
15
|
+
readonly geode_object_type: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// NewDataItem has mutable array fields (mesh_components, collection_components), so it can't
|
|
19
|
+
// Satisfy prefer-readonly-parameter-types deeply; left unfixed (same pattern as app/plugins/auto_store_register.ts).
|
|
20
|
+
async function importItem(item: NewDataItem): Promise<string> {
|
|
14
21
|
const dataStore = useDataStore();
|
|
15
22
|
const dataStyleStore = useDataStyleStore();
|
|
16
23
|
const hybridViewerStore = useHybridViewerStore();
|
|
@@ -22,19 +29,19 @@ async function importItem(item) {
|
|
|
22
29
|
const addDataTask = dataStore.addItem(item);
|
|
23
30
|
const registerTask = addDataTask.then(async () => {
|
|
24
31
|
if (!(await dataStore.isItemViewable(item))) {
|
|
25
|
-
return;
|
|
32
|
+
return undefined;
|
|
26
33
|
}
|
|
27
|
-
return dataStore.registerObject(item.id, item.name);
|
|
34
|
+
return dataStore.registerObject(item.id, item.name ?? item.id);
|
|
28
35
|
});
|
|
29
36
|
const addDataComponentsTask =
|
|
30
37
|
item.viewer_type === "model" ? dataStore.addComponents(item) : Promise.resolve();
|
|
31
38
|
const addDataRelationsTask =
|
|
32
39
|
item.viewer_type === "model" ? dataStore.addComponentRelations(item) : Promise.resolve();
|
|
33
|
-
treeviewStore.addItem(item.geode_object_type, item.name, item.id, item.viewer_type);
|
|
40
|
+
treeviewStore.addItem(item.geode_object_type, item.name ?? item.id, item.id, item.viewer_type);
|
|
34
41
|
const addDataStyleTask = dataStyleStore.addDataStyle(item.id, item.geode_object_type);
|
|
35
42
|
const addViewerTask = addDataTask.then(async () => {
|
|
36
43
|
if (!(await dataStore.isItemViewable(item))) {
|
|
37
|
-
return;
|
|
44
|
+
return undefined;
|
|
38
45
|
}
|
|
39
46
|
return hybridViewerStore.addItem(item.id);
|
|
40
47
|
});
|
|
@@ -56,7 +63,7 @@ async function importItem(item) {
|
|
|
56
63
|
]);
|
|
57
64
|
return item.id;
|
|
58
65
|
}
|
|
59
|
-
async function importFile(filename, geode_object_type) {
|
|
66
|
+
async function importFile(filename: string, geode_object_type: string): Promise<string> {
|
|
60
67
|
const backStore = useBackStore();
|
|
61
68
|
const schema = back_schemas.opengeodeweb_back.save_viewable_file;
|
|
62
69
|
const params = {
|
|
@@ -67,54 +74,64 @@ async function importFile(filename, geode_object_type) {
|
|
|
67
74
|
schema,
|
|
68
75
|
params,
|
|
69
76
|
});
|
|
70
|
-
|
|
77
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- this is the trusted API boundary; the back-end response shape matches NewDataItem.
|
|
78
|
+
return importItem(response as NewDataItem);
|
|
71
79
|
}
|
|
72
80
|
|
|
73
|
-
async function importWorkflow(files) {
|
|
81
|
+
async function importWorkflow(files: readonly FileToImport[]): Promise<string[]> {
|
|
74
82
|
const chunk_size = 5;
|
|
75
|
-
const chunks = [];
|
|
83
|
+
const chunks: FileToImport[][] = [];
|
|
76
84
|
for (let i = 0; i < files.length; i += chunk_size) {
|
|
77
85
|
chunks.push(files.slice(i, i + chunk_size));
|
|
78
86
|
}
|
|
79
87
|
|
|
80
|
-
const results = [];
|
|
81
|
-
async function processChunk(chunkIndex) {
|
|
88
|
+
const results: string[] = [];
|
|
89
|
+
async function processChunk(chunkIndex: number): Promise<void> {
|
|
82
90
|
if (chunkIndex >= chunks.length) {
|
|
83
91
|
return;
|
|
84
92
|
}
|
|
85
|
-
const chunk = chunks[chunkIndex];
|
|
93
|
+
const chunk = chunks[chunkIndex] ?? [];
|
|
86
94
|
const chunk_results = await Promise.all(
|
|
87
|
-
chunk.map(({ filename, geode_object_type }) =>
|
|
95
|
+
chunk.map(async ({ filename, geode_object_type }) => {
|
|
96
|
+
const id = await importFile(filename, geode_object_type);
|
|
97
|
+
return id;
|
|
98
|
+
}),
|
|
88
99
|
);
|
|
89
100
|
results.push(...chunk_results);
|
|
90
101
|
await processChunk(chunkIndex + 1);
|
|
91
102
|
}
|
|
92
103
|
await processChunk(0);
|
|
93
104
|
const hybridViewerStore = useHybridViewerStore();
|
|
94
|
-
hybridViewerStore.remoteRender();
|
|
105
|
+
await hybridViewerStore.remoteRender();
|
|
95
106
|
return results;
|
|
96
107
|
}
|
|
97
108
|
|
|
98
|
-
|
|
109
|
+
// NewDataItem has mutable array fields (mesh_components, collection_components), so a readonly array of it can't satisfy prefer-readonly-parameter-types deeply; left unfixed (same pattern as app/plugins/auto_store_register.ts).
|
|
110
|
+
async function importWorkflowFromSnapshot(items: readonly NewDataItem[]): Promise<string[]> {
|
|
99
111
|
console.log("[importWorkflowFromSnapshot] start", { count: items?.length });
|
|
100
112
|
const hybridViewerStore = useHybridViewerStore();
|
|
101
113
|
const chunk_size = 5;
|
|
102
|
-
const chunks = [];
|
|
114
|
+
const chunks: NewDataItem[][] = [];
|
|
103
115
|
for (let i = 0; i < items.length; i += chunk_size) {
|
|
104
116
|
chunks.push(items.slice(i, i + chunk_size));
|
|
105
117
|
}
|
|
106
|
-
const ids = [];
|
|
107
|
-
async function processChunk(chunkIndex) {
|
|
118
|
+
const ids: string[] = [];
|
|
119
|
+
async function processChunk(chunkIndex: number): Promise<void> {
|
|
108
120
|
if (chunkIndex >= chunks.length) {
|
|
109
121
|
return;
|
|
110
122
|
}
|
|
111
|
-
const chunk = chunks[chunkIndex];
|
|
112
|
-
const chunk_ids = await Promise.all(
|
|
123
|
+
const chunk = chunks[chunkIndex] ?? [];
|
|
124
|
+
const chunk_ids = await Promise.all(
|
|
125
|
+
chunk.map(async (item) => {
|
|
126
|
+
const id = await importItem(item);
|
|
127
|
+
return id;
|
|
128
|
+
}),
|
|
129
|
+
);
|
|
113
130
|
ids.push(...chunk_ids);
|
|
114
131
|
await processChunk(chunkIndex + 1);
|
|
115
132
|
}
|
|
116
133
|
await processChunk(0);
|
|
117
|
-
hybridViewerStore.remoteRender();
|
|
134
|
+
await hybridViewerStore.remoteRender();
|
|
118
135
|
console.log("[importWorkflowFromSnapshot] done", {
|
|
119
136
|
ids,
|
|
120
137
|
});
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import type { JsonRpcSchema } from "@ogw_shared/utils/types.js";
|
|
2
|
+
|
|
3
|
+
interface Loggable {
|
|
4
|
+
$id: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function startRequestLog(microservice: Loggable, schema: JsonRpcSchema): Date {
|
|
2
8
|
console.log(`[${microservice.$id}] Request:`, schema.$id);
|
|
3
9
|
const requestStartingTime = new Date(Date.now());
|
|
4
10
|
return requestStartingTime;
|
|
5
11
|
}
|
|
6
12
|
|
|
7
|
-
function endRequestLog(
|
|
13
|
+
function endRequestLog(
|
|
14
|
+
microservice: Loggable,
|
|
15
|
+
schema: JsonRpcSchema,
|
|
16
|
+
requestStartingTime: Date,
|
|
17
|
+
): void {
|
|
8
18
|
const requestEndingTime = new Date(Date.now());
|
|
9
19
|
console.log(
|
|
10
20
|
`[${microservice.$id}] Request completed:`,
|
|
@@ -3,12 +3,12 @@ const DEFAULT_SLICE_START = 8;
|
|
|
3
3
|
const DEFAULT_SLICE_END_OFFSET = 8;
|
|
4
4
|
|
|
5
5
|
function formatListId(
|
|
6
|
-
id,
|
|
7
|
-
maxLength = DEFAULT_MAX_LENGTH,
|
|
8
|
-
sliceStart = DEFAULT_SLICE_START,
|
|
9
|
-
sliceEndOffset = DEFAULT_SLICE_END_OFFSET,
|
|
10
|
-
) {
|
|
11
|
-
if (
|
|
6
|
+
id: string | undefined | null,
|
|
7
|
+
maxLength: number = DEFAULT_MAX_LENGTH,
|
|
8
|
+
sliceStart: number = DEFAULT_SLICE_START,
|
|
9
|
+
sliceEndOffset: number = DEFAULT_SLICE_END_OFFSET,
|
|
10
|
+
): string {
|
|
11
|
+
if (id === undefined || id === null || id === "") {
|
|
12
12
|
return "";
|
|
13
13
|
}
|
|
14
14
|
if (id.length <= maxLength) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface StatusValues {
|
|
2
|
+
NOT_CREATED: string;
|
|
3
|
+
CREATING: string;
|
|
4
|
+
CREATED: string;
|
|
5
|
+
NOT_CONNECTED: string;
|
|
6
|
+
CONNECTING: string;
|
|
7
|
+
CONNECTED: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Status: StatusValues = {
|
|
11
|
+
NOT_CREATED: "NOT_CREATED",
|
|
12
|
+
CREATING: "CREATING",
|
|
13
|
+
CREATED: "CREATED",
|
|
14
|
+
NOT_CONNECTED: "NOT_CONNECTED",
|
|
15
|
+
CONNECTING: "CONNECTING",
|
|
16
|
+
CONNECTED: "CONNECTED",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { Status };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { appMode } from "@ogw_shared/app_mode";
|
|
2
2
|
import { useInfraStore } from "@ogw_front/stores/infra";
|
|
3
3
|
|
|
4
|
-
function isCloudMode() {
|
|
4
|
+
function isCloudMode(): boolean {
|
|
5
5
|
const infraStore = useInfraStore();
|
|
6
6
|
return infraStore.app_mode === appMode.CLOUD;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
function getRestApiProtocol() {
|
|
9
|
+
function getRestApiProtocol(): string {
|
|
10
10
|
const protocol = isCloudMode() ? "https" : "http";
|
|
11
11
|
return protocol;
|
|
12
12
|
}
|
|
13
|
-
function getRestApiPort(defaultLocalPort) {
|
|
13
|
+
function getRestApiPort(defaultLocalPort: string): string {
|
|
14
14
|
const port = isCloudMode() ? "443" : defaultLocalPort;
|
|
15
15
|
return port;
|
|
16
16
|
}
|
|
17
|
-
function getWebsocketApiProtocol() {
|
|
17
|
+
function getWebsocketApiProtocol(): string {
|
|
18
18
|
const protocol = isCloudMode() ? "wss" : "ws";
|
|
19
19
|
return protocol;
|
|
20
20
|
}
|
|
21
|
-
function getWebsocketApiPort(defaultLocalPort) {
|
|
21
|
+
function getWebsocketApiPort(defaultLocalPort: string): string {
|
|
22
22
|
const port = isCloudMode() ? "443" : defaultLocalPort;
|
|
23
23
|
return port;
|
|
24
24
|
}
|
|
@@ -11,12 +11,12 @@ const DEFAULT_END_CHARS = 6;
|
|
|
11
11
|
* @returns {string} The truncated string.
|
|
12
12
|
*/
|
|
13
13
|
export function middleTruncate(
|
|
14
|
-
text,
|
|
15
|
-
maxLength = DEFAULT_MAX_LENGTH,
|
|
16
|
-
startChars = DEFAULT_START_CHARS,
|
|
17
|
-
endChars = DEFAULT_END_CHARS,
|
|
18
|
-
) {
|
|
19
|
-
if (
|
|
14
|
+
text: string | undefined | null,
|
|
15
|
+
maxLength: number = DEFAULT_MAX_LENGTH,
|
|
16
|
+
startChars: number = DEFAULT_START_CHARS,
|
|
17
|
+
endChars: number = DEFAULT_END_CHARS,
|
|
18
|
+
): string | undefined | null {
|
|
19
|
+
if (text === undefined || text === null || text.length <= maxLength) {
|
|
20
20
|
return text;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
function compareSelections(
|
|
1
|
+
function compareSelections<Item>(
|
|
2
|
+
current: readonly Item[],
|
|
3
|
+
previous: readonly Item[],
|
|
4
|
+
): { added: Item[]; removed: Item[] } {
|
|
2
5
|
const added = current.filter((item) => !previous.includes(item));
|
|
3
6
|
const removed = previous.filter((item) => !current.includes(item));
|
|
4
7
|
return { added, removed };
|
|
@@ -8,7 +8,7 @@ import { modelComponentsRelationTable } from "./tables/model_components_relation
|
|
|
8
8
|
import { modelComponentsTable } from "./tables/model_components";
|
|
9
9
|
|
|
10
10
|
export class BaseDatabase extends Dexie {
|
|
11
|
-
static get initialStores() {
|
|
11
|
+
public static get initialStores(): Record<string, string> {
|
|
12
12
|
return {
|
|
13
13
|
[dataTable.name]: dataTable.schema,
|
|
14
14
|
[modelComponentsTable.name]: modelComponentsTable.schema,
|
|
@@ -21,7 +21,11 @@ export class BaseDatabase extends Dexie {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
clear() {
|
|
25
|
-
|
|
24
|
+
public async clear(): Promise<void> {
|
|
25
|
+
await Promise.all(
|
|
26
|
+
this.tables.map(async (table) => {
|
|
27
|
+
await table.clear();
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
26
30
|
}
|
|
27
31
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Dexie, type Table } from "dexie";
|
|
2
|
+
import { BaseDatabase } from "./base_database";
|
|
3
|
+
import { ExtendedDatabase } from "./extended_database";
|
|
4
|
+
|
|
5
|
+
interface DatabaseContainer {
|
|
6
|
+
instance: Dexie | undefined;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const databaseContainer: DatabaseContainer = { instance: undefined };
|
|
10
|
+
|
|
11
|
+
class Database extends BaseDatabase {
|
|
12
|
+
public constructor() {
|
|
13
|
+
super("Database");
|
|
14
|
+
|
|
15
|
+
this.version(3).stores(BaseDatabase.initialStores);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public static async addTable(tableName: string, schemaDefinition: string): Promise<void> {
|
|
19
|
+
await this.addTables({ [tableName]: schemaDefinition });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public static async addTables(newTables: Record<string, string>): Promise<void> {
|
|
23
|
+
let currentVersion = 1;
|
|
24
|
+
let currentStores: Record<string, string> = { ...BaseDatabase.initialStores };
|
|
25
|
+
|
|
26
|
+
if (await Dexie.exists("Database")) {
|
|
27
|
+
const tempDb = new Dexie("Database");
|
|
28
|
+
await tempDb.open();
|
|
29
|
+
|
|
30
|
+
currentVersion = tempDb.verno;
|
|
31
|
+
currentStores = { ...BaseDatabase.initialStores };
|
|
32
|
+
|
|
33
|
+
for (const table of tempDb.tables) {
|
|
34
|
+
const keyPath = table.schema.primKey.src;
|
|
35
|
+
const indexes = table.schema.indexes.map((index) => index.src);
|
|
36
|
+
const parts = keyPath ? [keyPath, ...indexes] : indexes;
|
|
37
|
+
currentStores[table.name] = parts.join(",");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
tempDb.close();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const allExisting = Object.keys(newTables).every(
|
|
44
|
+
(tableName) => currentStores[tableName] !== undefined,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// Set at module load time below; always defined by the time addTable/addTables runs.
|
|
48
|
+
databaseContainer.instance?.close();
|
|
49
|
+
|
|
50
|
+
if (allExisting) {
|
|
51
|
+
const existingDb = new Dexie("Database");
|
|
52
|
+
for (let version = 1; version <= currentVersion; version += 1) {
|
|
53
|
+
if (version === 1) {
|
|
54
|
+
existingDb.version(1).stores(BaseDatabase.initialStores);
|
|
55
|
+
} else {
|
|
56
|
+
existingDb.version(version).stores(currentStores);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
await existingDb.open();
|
|
60
|
+
databaseContainer.instance = existingDb;
|
|
61
|
+
} else {
|
|
62
|
+
const newDb = new ExtendedDatabase(currentVersion, currentStores, newTables);
|
|
63
|
+
await newDb.open();
|
|
64
|
+
databaseContainer.instance = newDb;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// oxlint-disable-next-line no-top-level-await
|
|
70
|
+
await Dexie.delete("Database");
|
|
71
|
+
const initialDatabase = new Database();
|
|
72
|
+
databaseContainer.instance = initialDatabase;
|
|
73
|
+
// oxlint-disable-next-line no-top-level-await
|
|
74
|
+
await initialDatabase.clear();
|
|
75
|
+
|
|
76
|
+
// The set of tables is assembled dynamically at runtime (Database.addTable/addTables add stores on the fly), so fully modelling this with Dexie's row generics isn't worth it here: the proxy target is typed loosely as "any table name maps to a Dexie Table of loosely-typed rows".
|
|
77
|
+
type DatabaseTables = Record<string, Table<Record<string, unknown>, string>>;
|
|
78
|
+
|
|
79
|
+
const database = new Proxy<DatabaseTables>(
|
|
80
|
+
{},
|
|
81
|
+
{
|
|
82
|
+
get(_target, prop: string | symbol): unknown {
|
|
83
|
+
// The instance is a Dexie subclass whose tables are only known dynamically at runtime.
|
|
84
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
85
|
+
const instance = databaseContainer.instance as unknown as Record<string | symbol, unknown>;
|
|
86
|
+
const value = instance[prop];
|
|
87
|
+
if (typeof value === "function") {
|
|
88
|
+
// oxlint-disable-next-line no-unsafe-return
|
|
89
|
+
return value.bind(databaseContainer.instance);
|
|
90
|
+
}
|
|
91
|
+
return value;
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// The proxy only knows the loose DatabaseTables shape; callers cast to the row type they know a given table holds.
|
|
97
|
+
function getTable<TRow>(tableName: string): Table<TRow, string> {
|
|
98
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
99
|
+
return database[tableName] as unknown as Table<TRow, string>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { Database, database, getTable };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { BaseDatabase } from "./base_database";
|
|
2
2
|
|
|
3
3
|
export class ExtendedDatabase extends BaseDatabase {
|
|
4
|
-
constructor(
|
|
4
|
+
public constructor(
|
|
5
|
+
currentVersion: number,
|
|
6
|
+
currentStores: Record<string, string>,
|
|
7
|
+
newTables: Record<string, string>,
|
|
8
|
+
) {
|
|
5
9
|
super("Database");
|
|
6
10
|
|
|
7
11
|
for (let version = 1; version <= currentVersion; version += 1) {
|