@geode/opengeodeweb-front 10.6.2 → 10.6.3-rc.1

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 (235) hide show
  1. package/.eslintrc.cjs +1 -1
  2. package/.oxlintrc.json +3 -22
  3. package/app/assets/geode_objects.js +26 -26
  4. package/app/components/Carousel.vue +62 -66
  5. package/app/components/CrsSelector.vue +48 -52
  6. package/app/components/DeleteDialog.vue +21 -37
  7. package/app/components/DragAndDrop.vue +35 -41
  8. package/app/components/ExtensionSelector.vue +50 -63
  9. package/app/components/FeedBack/ErrorBanner.vue +7 -10
  10. package/app/components/FeedBack/Snackers.vue +12 -14
  11. package/app/components/FetchingData.vue +1 -6
  12. package/app/components/FileSelector.vue +41 -47
  13. package/app/components/FileUploader.vue +62 -79
  14. package/app/components/GlassCard.vue +19 -19
  15. package/app/components/HybridRenderingView.vue +37 -38
  16. package/app/components/InfraConnected.vue +3 -3
  17. package/app/components/Inspector/InspectionButton.vue +27 -31
  18. package/app/components/Inspector/ResultPanel.vue +13 -24
  19. package/app/components/Launcher.vue +13 -13
  20. package/app/components/Loading.vue +63 -69
  21. package/app/components/MissingFilesSelector.vue +53 -73
  22. package/app/components/ObjectSelector.vue +81 -99
  23. package/app/components/PackagesVersions.vue +27 -30
  24. package/app/components/Recaptcha.vue +60 -71
  25. package/app/components/RemoteRenderingView.vue +102 -108
  26. package/app/components/Screenshot.vue +36 -42
  27. package/app/components/SearchBar.vue +5 -5
  28. package/app/components/Step.vue +37 -44
  29. package/app/components/Stepper.vue +29 -35
  30. package/app/components/VeaseViewToolbar.vue +69 -78
  31. package/app/components/ViewToolbar.vue +41 -45
  32. package/app/components/Viewer/BreadCrumb.vue +18 -30
  33. package/app/components/Viewer/ContextMenu.vue +176 -179
  34. package/app/components/Viewer/ContextMenuItem.vue +105 -117
  35. package/app/components/Viewer/EdgedCurve/PointsOptions.vue +6 -9
  36. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +82 -93
  37. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +84 -99
  38. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +83 -98
  39. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +62 -73
  40. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +84 -108
  41. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +82 -105
  42. package/app/components/Viewer/Generic/Model/EdgesOptions.vue +19 -23
  43. package/app/components/Viewer/Generic/Model/PointsOptions.vue +26 -30
  44. package/app/components/Viewer/Grid/2D/CellsOptions.vue +5 -5
  45. package/app/components/Viewer/Grid/2D/EdgesOptions.vue +6 -9
  46. package/app/components/Viewer/Grid/2D/PointsOptions.vue +6 -9
  47. package/app/components/Viewer/Grid/3D/CellsOptions.vue +5 -5
  48. package/app/components/Viewer/Grid/3D/EdgesOptions.vue +6 -9
  49. package/app/components/Viewer/Grid/3D/FacetsOptions.vue +5 -5
  50. package/app/components/Viewer/Grid/3D/PointsOptions.vue +6 -9
  51. package/app/components/Viewer/HybridSolid/EdgesOptions.vue +6 -9
  52. package/app/components/Viewer/HybridSolid/PointsOptions.vue +6 -9
  53. package/app/components/Viewer/HybridSolid/PolygonsOptions.vue +6 -9
  54. package/app/components/Viewer/HybridSolid/PolyhedraOptions.vue +6 -9
  55. package/app/components/Viewer/Options/AttributeColorBar.vue +8 -8
  56. package/app/components/Viewer/Options/AttributeSelector.vue +73 -78
  57. package/app/components/Viewer/Options/ColorMapList.vue +115 -140
  58. package/app/components/Viewer/Options/ColorMapPicker.vue +128 -142
  59. package/app/components/Viewer/Options/ColorPicker.vue +9 -9
  60. package/app/components/Viewer/Options/ColoringTypeSelector.vue +77 -91
  61. package/app/components/Viewer/Options/TextureItem.vue +54 -58
  62. package/app/components/Viewer/Options/TexturesSelector.vue +22 -26
  63. package/app/components/Viewer/Options/VisibilitySwitch.vue +1 -1
  64. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +61 -68
  65. package/app/components/Viewer/PolygonalSurface/EdgesOptions.vue +6 -9
  66. package/app/components/Viewer/PolygonalSurface/PointsOptions.vue +6 -9
  67. package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +83 -103
  68. package/app/components/Viewer/Solid/EdgesOptions.vue +6 -9
  69. package/app/components/Viewer/Solid/PointsOptions.vue +6 -9
  70. package/app/components/Viewer/Solid/PolygonsOptions.vue +6 -9
  71. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +82 -105
  72. package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +5 -5
  73. package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +5 -5
  74. package/app/components/Viewer/Tree/ObjectTree.vue +80 -89
  75. package/app/components/Viewer/TreeComponent.vue +43 -49
  76. package/app/components/Viewer/TreeObject.vue +48 -50
  77. package/app/components/Viewer/TriangulatedSurface/EdgesOptions.vue +6 -9
  78. package/app/components/Viewer/TriangulatedSurface/PointsOptions.vue +5 -5
  79. package/app/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +5 -5
  80. package/app/components/Wrapper.vue +8 -8
  81. package/app/components/ZScaling.vue +18 -27
  82. package/app/composables/project_manager.js +57 -67
  83. package/app/composables/run_function_when_microservices_connected.js +8 -8
  84. package/app/plugins/auto_store_register.js +11 -13
  85. package/app/stores/app.js +118 -138
  86. package/app/stores/data.js +52 -68
  87. package/app/stores/data_style.js +36 -36
  88. package/app/stores/feedback.js +17 -20
  89. package/app/stores/geode.js +54 -55
  90. package/app/stores/hybrid_viewer.js +164 -177
  91. package/app/stores/infra.js +45 -55
  92. package/app/stores/lambda.js +26 -26
  93. package/app/stores/menu.js +78 -85
  94. package/app/stores/treeview.js +57 -65
  95. package/app/stores/viewer.js +92 -104
  96. package/app/utils/colormap.js +3 -3
  97. package/app/utils/config.js +16 -22
  98. package/app/utils/default_styles.js +50 -62
  99. package/app/utils/extension.js +44 -44
  100. package/app/utils/file_import_workflow.js +50 -64
  101. package/app/utils/local/app_mode.js +2 -2
  102. package/app/utils/local/cleanup.js +66 -72
  103. package/app/utils/local/microservices.js +61 -71
  104. package/app/utils/local/path.js +16 -19
  105. package/app/utils/local/scripts.js +22 -22
  106. package/app/utils/recaptcha.js +6 -6
  107. package/app/utils/server.js +21 -24
  108. package/app/utils/status.js +2 -2
  109. package/app/utils/treeview.js +4 -4
  110. package/app/utils/validate_schema.js +7 -7
  111. package/commitlint.config.js +2 -2
  112. package/eslint.config.js +4 -4
  113. package/internal/database/database.js +38 -46
  114. package/internal/database/extended_database.js +9 -10
  115. package/internal/database/tables/data.js +2 -3
  116. package/internal/database/tables/model_components.js +1 -1
  117. package/internal/database/tables/model_components_relation.js +1 -1
  118. package/internal/stores/data_style/mesh/cells/cell.js +47 -63
  119. package/internal/stores/data_style/mesh/cells/color.js +11 -16
  120. package/internal/stores/data_style/mesh/cells/common.js +6 -6
  121. package/internal/stores/data_style/mesh/cells/index.js +37 -47
  122. package/internal/stores/data_style/mesh/cells/textures.js +11 -12
  123. package/internal/stores/data_style/mesh/cells/vertex.js +47 -58
  124. package/internal/stores/data_style/mesh/cells/visibility.js +11 -16
  125. package/internal/stores/data_style/mesh/edges/color.js +11 -16
  126. package/internal/stores/data_style/mesh/edges/common.js +6 -6
  127. package/internal/stores/data_style/mesh/edges/edge.js +47 -63
  128. package/internal/stores/data_style/mesh/edges/index.js +38 -52
  129. package/internal/stores/data_style/mesh/edges/vertex.js +47 -58
  130. package/internal/stores/data_style/mesh/edges/visibility.js +11 -16
  131. package/internal/stores/data_style/mesh/edges/width.js +11 -16
  132. package/internal/stores/data_style/mesh/index.js +34 -34
  133. package/internal/stores/data_style/mesh/points/color.js +11 -16
  134. package/internal/stores/data_style/mesh/points/common.js +6 -6
  135. package/internal/stores/data_style/mesh/points/index.js +35 -49
  136. package/internal/stores/data_style/mesh/points/size.js +11 -16
  137. package/internal/stores/data_style/mesh/points/vertex.js +47 -58
  138. package/internal/stores/data_style/mesh/points/visibility.js +11 -16
  139. package/internal/stores/data_style/mesh/polygons/color.js +11 -16
  140. package/internal/stores/data_style/mesh/polygons/common.js +6 -6
  141. package/internal/stores/data_style/mesh/polygons/index.js +36 -45
  142. package/internal/stores/data_style/mesh/polygons/polygon.js +45 -56
  143. package/internal/stores/data_style/mesh/polygons/textures.js +11 -16
  144. package/internal/stores/data_style/mesh/polygons/vertex.js +47 -58
  145. package/internal/stores/data_style/mesh/polygons/visibility.js +11 -16
  146. package/internal/stores/data_style/mesh/polyhedra/color.js +11 -16
  147. package/internal/stores/data_style/mesh/polyhedra/common.js +6 -6
  148. package/internal/stores/data_style/mesh/polyhedra/index.js +29 -42
  149. package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +43 -47
  150. package/internal/stores/data_style/mesh/polyhedra/vertex.js +47 -58
  151. package/internal/stores/data_style/mesh/polyhedra/visibility.js +11 -17
  152. package/internal/stores/data_style/model/blocks/color.js +21 -24
  153. package/internal/stores/data_style/model/blocks/common.js +6 -6
  154. package/internal/stores/data_style/model/blocks/index.js +13 -17
  155. package/internal/stores/data_style/model/blocks/visibility.js +21 -24
  156. package/internal/stores/data_style/model/corners/color.js +21 -24
  157. package/internal/stores/data_style/model/corners/common.js +6 -6
  158. package/internal/stores/data_style/model/corners/index.js +14 -18
  159. package/internal/stores/data_style/model/corners/visibility.js +21 -25
  160. package/internal/stores/data_style/model/edges/common.js +4 -4
  161. package/internal/stores/data_style/model/edges/index.js +7 -7
  162. package/internal/stores/data_style/model/edges/visibility.js +11 -15
  163. package/internal/stores/data_style/model/index.js +84 -100
  164. package/internal/stores/data_style/model/lines/color.js +21 -24
  165. package/internal/stores/data_style/model/lines/common.js +6 -6
  166. package/internal/stores/data_style/model/lines/index.js +13 -17
  167. package/internal/stores/data_style/model/lines/visibility.js +21 -24
  168. package/internal/stores/data_style/model/points/common.js +4 -4
  169. package/internal/stores/data_style/model/points/index.js +9 -9
  170. package/internal/stores/data_style/model/points/size.js +11 -11
  171. package/internal/stores/data_style/model/points/visibility.js +11 -15
  172. package/internal/stores/data_style/model/surfaces/color.js +21 -24
  173. package/internal/stores/data_style/model/surfaces/common.js +6 -6
  174. package/internal/stores/data_style/model/surfaces/index.js +14 -22
  175. package/internal/stores/data_style/model/surfaces/visibility.js +18 -22
  176. package/internal/stores/data_style/state.js +11 -11
  177. package/internal/utils/api_fetch.js +24 -34
  178. package/internal/utils/upload_file.js +19 -24
  179. package/internal/utils/viewer_call.js +23 -36
  180. package/nuxt.config.js +7 -11
  181. package/package.json +3 -3
  182. package/scripts/generate_geode_objects.js +14 -16
  183. package/server/api/app/kill.post.js +4 -4
  184. package/server/api/app/project_folder_path.post.js +11 -11
  185. package/server/api/app/run_back.post.js +12 -12
  186. package/server/api/app/run_viewer.post.js +12 -12
  187. package/server/api/extensions/run.post.js +34 -41
  188. package/server/api/extensions/upload.put.js +48 -62
  189. package/tests/integration/setup.js +43 -53
  190. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +90 -116
  191. package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +81 -107
  192. package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +38 -41
  193. package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +85 -101
  194. package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +89 -113
  195. package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +81 -105
  196. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +56 -73
  197. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +59 -76
  198. package/tests/integration/stores/data_style/model/edges.nuxt.test.js +39 -42
  199. package/tests/integration/stores/data_style/model/index.nuxt.test.js +31 -34
  200. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +60 -73
  201. package/tests/integration/stores/data_style/model/points.nuxt.test.js +52 -55
  202. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +59 -80
  203. package/tests/integration/stores/viewer.nuxt.test.js +35 -38
  204. package/tests/setup_indexeddb.js +2 -2
  205. package/tests/unit/components/CrsSelector.nuxt.test.js +28 -28
  206. package/tests/unit/components/ExtensionSelector.nuxt.test.js +33 -35
  207. package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +23 -23
  208. package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +18 -18
  209. package/tests/unit/components/FileSelector.nuxt.test.js +57 -59
  210. package/tests/unit/components/FileUploader.nuxt.test.js +35 -39
  211. package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +28 -28
  212. package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +22 -27
  213. package/tests/unit/components/Launcher.nuxt.test.js +20 -22
  214. package/tests/unit/components/MissingFilesSelector.nuxt.test.js +37 -37
  215. package/tests/unit/components/ObjectSelector.nuxt.test.js +62 -62
  216. package/tests/unit/components/PackagesVersions.nuxt.test.js +16 -16
  217. package/tests/unit/components/Step.nuxt.test.js +18 -19
  218. package/tests/unit/components/Stepper.nuxt.test.js +18 -18
  219. package/tests/unit/composables/api_fetch.nuxt.test.js +34 -36
  220. package/tests/unit/composables/project_manager.nuxt.test.js +93 -112
  221. package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +36 -36
  222. package/tests/unit/composables/upload_file.nuxt.test.js +27 -29
  223. package/tests/unit/plugins/project_load.nuxt.test.js +31 -33
  224. package/tests/unit/stores/app.nuxt.test.js +90 -92
  225. package/tests/unit/stores/feedback.nuxt.test.js +47 -57
  226. package/tests/unit/stores/geode.nuxt.test.js +111 -115
  227. package/tests/unit/stores/infra.nuxt.test.js +148 -148
  228. package/tests/unit/stores/lambda.nuxt.test.js +72 -74
  229. package/tests/unit/stores/treeview.nuxt.test.js +19 -21
  230. package/tests/unit/stores/viewer.nuxt.test.js +109 -122
  231. package/tests/unit/utils/recaptcha.nuxt.test.js +25 -29
  232. package/tests/unit/utils/validate_schema.nuxt.test.js +17 -17
  233. package/tests/utils.js +11 -11
  234. package/tests/vitest.config.js +9 -9
  235. package/vuetify_config.js +2 -2
@@ -1,300 +1,300 @@
1
1
  // Third party imports
2
- import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest"
3
- import { registerEndpoint } from "@nuxt/test-utils/runtime"
2
+ import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest";
3
+ import { registerEndpoint } from "@nuxt/test-utils/runtime";
4
4
 
5
5
  // Local imports
6
- import { Status } from "@ogw_front/utils/status"
7
- import { appMode } from "@ogw_front/utils/local/app_mode"
8
- import { setupActivePinia } from "@ogw_tests/utils"
9
- import { useGeodeStore } from "@ogw_front/stores/geode"
10
- import { useInfraStore } from "@ogw_front/stores/infra"
11
- import { useLambdaStore } from "@ogw_front/stores/lambda"
12
- import { useViewerStore } from "@ogw_front/stores/viewer"
6
+ import { Status } from "@ogw_front/utils/status";
7
+ import { appMode } from "@ogw_front/utils/local/app_mode";
8
+ import { setupActivePinia } from "@ogw_tests/utils";
9
+ import { useGeodeStore } from "@ogw_front/stores/geode";
10
+ import { useInfraStore } from "@ogw_front/stores/infra";
11
+ import { useLambdaStore } from "@ogw_front/stores/lambda";
12
+ import { useViewerStore } from "@ogw_front/stores/viewer";
13
13
 
14
14
  // Mock navigator.locks API
15
15
  const mockLockRequest = vi
16
16
  .fn()
17
- .mockImplementation(async (name, handler) => await handler({ name }))
17
+ .mockImplementation(async (name, handler) => await handler({ name }));
18
18
 
19
19
  vi.stubGlobal("navigator", {
20
20
  ...navigator,
21
21
  locks: {
22
22
  request: mockLockRequest,
23
23
  },
24
- })
24
+ });
25
25
 
26
26
  beforeEach(() => {
27
- setupActivePinia()
28
- })
27
+ setupActivePinia();
28
+ });
29
29
 
30
30
  describe("Infra Store", () => {
31
31
  describe("state", () => {
32
32
  test("initial state", () => {
33
- const infraStore = useInfraStore()
34
- expectTypeOf(infraStore.ID).toBeString()
35
- expectTypeOf(infraStore.is_captcha_validated).toBeBoolean()
36
- expectTypeOf(infraStore.status).toBeString()
37
- })
38
- })
33
+ const infraStore = useInfraStore();
34
+ expectTypeOf(infraStore.ID).toBeString();
35
+ expectTypeOf(infraStore.is_captcha_validated).toBeBoolean();
36
+ expectTypeOf(infraStore.status).toBeString();
37
+ });
38
+ });
39
39
  describe("getters", () => {
40
40
  describe("app_mode", () => {
41
41
  test("test type", () => {
42
- const infraStore = useInfraStore()
43
- expectTypeOf(infraStore.app_mode).toBeString()
44
- })
45
- })
42
+ const infraStore = useInfraStore();
43
+ expectTypeOf(infraStore.app_mode).toBeString();
44
+ });
45
+ });
46
46
 
47
47
  describe("domain_name", () => {
48
48
  test("test app_mode BROWSER", () => {
49
- const infraStore = useInfraStore()
50
- infraStore.app_mode = appMode.BROWSER
51
- expect(infraStore.domain_name).toBe("localhost")
52
- })
49
+ const infraStore = useInfraStore();
50
+ infraStore.app_mode = appMode.BROWSER;
51
+ expect(infraStore.domain_name).toBe("localhost");
52
+ });
53
53
  test("test app_mode DESKTOP", () => {
54
- const infraStore = useInfraStore()
55
- infraStore.app_mode = appMode.DESKTOP
56
- expect(infraStore.domain_name).toBe("localhost")
57
- })
54
+ const infraStore = useInfraStore();
55
+ infraStore.app_mode = appMode.DESKTOP;
56
+ expect(infraStore.domain_name).toBe("localhost");
57
+ });
58
58
  test("test app_mode CLOUD", () => {
59
- const infraStore = useInfraStore()
60
- infraStore.app_mode = appMode.CLOUD
61
- expect(infraStore.domain_name).toBe("api.geode-solutions.com")
62
- })
63
- })
59
+ const infraStore = useInfraStore();
60
+ infraStore.app_mode = appMode.CLOUD;
61
+ expect(infraStore.domain_name).toBe("api.geode-solutions.com");
62
+ });
63
+ });
64
64
 
65
65
  describe("microservices_connected", () => {
66
66
  test("test no microservices registered", () => {
67
- const infraStore = useInfraStore()
68
- expect(infraStore.microservices_connected).toBeTruthy()
69
- })
67
+ const infraStore = useInfraStore();
68
+ expect(infraStore.microservices_connected).toBeTruthy();
69
+ });
70
70
  test("test geode false & viewer false", () => {
71
- const infraStore = useInfraStore()
72
- const geodeStore = useGeodeStore()
73
- const viewerStore = useViewerStore()
71
+ const infraStore = useInfraStore();
72
+ const geodeStore = useGeodeStore();
73
+ const viewerStore = useViewerStore();
74
74
 
75
75
  infraStore.register_microservice(geodeStore, {
76
76
  request: vi.fn(),
77
77
  connect: vi.fn(),
78
78
  launch: vi.fn(),
79
- })
79
+ });
80
80
  infraStore.register_microservice(viewerStore, {
81
81
  request: vi.fn(),
82
82
  connect: vi.fn(),
83
83
  launch: vi.fn(),
84
- })
84
+ });
85
85
 
86
- geodeStore.$patch({ status: Status.NOT_CONNECTED })
87
- viewerStore.$patch({ status: Status.NOT_CONNECTED })
88
- expect(infraStore.microservices_connected).toBeFalsy()
89
- })
86
+ geodeStore.$patch({ status: Status.NOT_CONNECTED });
87
+ viewerStore.$patch({ status: Status.NOT_CONNECTED });
88
+ expect(infraStore.microservices_connected).toBeFalsy();
89
+ });
90
90
  test("test geode true & viewer false", () => {
91
- const infraStore = useInfraStore()
92
- const geodeStore = useGeodeStore()
93
- const viewerStore = useViewerStore()
91
+ const infraStore = useInfraStore();
92
+ const geodeStore = useGeodeStore();
93
+ const viewerStore = useViewerStore();
94
94
 
95
95
  infraStore.register_microservice(geodeStore, {
96
96
  request: vi.fn(),
97
97
  connect: vi.fn(),
98
98
  launch: vi.fn(),
99
- })
99
+ });
100
100
  infraStore.register_microservice(viewerStore, {
101
101
  request: vi.fn(),
102
102
  connect: vi.fn(),
103
103
  launch: vi.fn(),
104
- })
104
+ });
105
105
 
106
- geodeStore.$patch({ status: Status.CONNECTED })
107
- viewerStore.$patch({ status: Status.NOT_CONNECTED })
108
- expect(infraStore.microservices_connected).toBeFalsy()
109
- })
106
+ geodeStore.$patch({ status: Status.CONNECTED });
107
+ viewerStore.$patch({ status: Status.NOT_CONNECTED });
108
+ expect(infraStore.microservices_connected).toBeFalsy();
109
+ });
110
110
  test("test geode false & viewer true", () => {
111
- const infraStore = useInfraStore()
112
- const geodeStore = useGeodeStore()
113
- const viewerStore = useViewerStore()
111
+ const infraStore = useInfraStore();
112
+ const geodeStore = useGeodeStore();
113
+ const viewerStore = useViewerStore();
114
114
 
115
115
  infraStore.register_microservice(geodeStore, {
116
116
  request: vi.fn(),
117
117
  connect: vi.fn(),
118
118
  launch: vi.fn(),
119
- })
119
+ });
120
120
  infraStore.register_microservice(viewerStore, {
121
121
  request: vi.fn(),
122
122
  connect: vi.fn(),
123
123
  launch: vi.fn(),
124
- })
124
+ });
125
125
 
126
- geodeStore.$patch({ status: Status.NOT_CONNECTED })
127
- viewerStore.$patch({ status: Status.CONNECTED })
128
- expect(infraStore.microservices_connected).toBeFalsy()
129
- })
126
+ geodeStore.$patch({ status: Status.NOT_CONNECTED });
127
+ viewerStore.$patch({ status: Status.CONNECTED });
128
+ expect(infraStore.microservices_connected).toBeFalsy();
129
+ });
130
130
  test("test geode true & viewer true", () => {
131
- const infraStore = useInfraStore()
132
- const geodeStore = useGeodeStore()
133
- const viewerStore = useViewerStore()
131
+ const infraStore = useInfraStore();
132
+ const geodeStore = useGeodeStore();
133
+ const viewerStore = useViewerStore();
134
134
 
135
135
  infraStore.register_microservice(geodeStore, {
136
136
  request: vi.fn(),
137
137
  connect: vi.fn(),
138
138
  launch: vi.fn(),
139
- })
139
+ });
140
140
  infraStore.register_microservice(viewerStore, {
141
141
  request: vi.fn(),
142
142
  connect: vi.fn(),
143
143
  launch: vi.fn(),
144
- })
144
+ });
145
145
 
146
- geodeStore.$patch({ status: Status.CONNECTED })
147
- viewerStore.$patch({ status: Status.CONNECTED })
148
- expect(infraStore.microservices_connected).toBeTruthy()
149
- })
150
- })
146
+ geodeStore.$patch({ status: Status.CONNECTED });
147
+ viewerStore.$patch({ status: Status.CONNECTED });
148
+ expect(infraStore.microservices_connected).toBeTruthy();
149
+ });
150
+ });
151
151
 
152
152
  describe("microservices_busy", () => {
153
153
  test("test no microservices registered", () => {
154
- const infraStore = useInfraStore()
155
- expect(infraStore.microservices_busy).toBeFalsy()
156
- })
154
+ const infraStore = useInfraStore();
155
+ expect(infraStore.microservices_busy).toBeFalsy();
156
+ });
157
157
  test("test geode false & viewer false", () => {
158
- const infraStore = useInfraStore()
159
- const geodeStore = useGeodeStore()
160
- const viewerStore = useViewerStore()
158
+ const infraStore = useInfraStore();
159
+ const geodeStore = useGeodeStore();
160
+ const viewerStore = useViewerStore();
161
161
 
162
162
  infraStore.register_microservice(geodeStore, {
163
163
  request: vi.fn(),
164
164
  connect: vi.fn(),
165
165
  launch: vi.fn(),
166
- })
166
+ });
167
167
  infraStore.register_microservice(viewerStore, {
168
168
  request: vi.fn(),
169
169
  connect: vi.fn(),
170
170
  launch: vi.fn(),
171
- })
171
+ });
172
172
 
173
- geodeStore.$patch({ request_counter: 0 })
174
- viewerStore.$patch({ request_counter: 0 })
175
- expect(infraStore.microservices_busy).toBeFalsy()
176
- })
173
+ geodeStore.$patch({ request_counter: 0 });
174
+ viewerStore.$patch({ request_counter: 0 });
175
+ expect(infraStore.microservices_busy).toBeFalsy();
176
+ });
177
177
  test("test geode true & viewer false", () => {
178
- const infraStore = useInfraStore()
179
- const geodeStore = useGeodeStore()
180
- const viewerStore = useViewerStore()
178
+ const infraStore = useInfraStore();
179
+ const geodeStore = useGeodeStore();
180
+ const viewerStore = useViewerStore();
181
181
 
182
182
  infraStore.register_microservice(geodeStore, {
183
183
  request: vi.fn(),
184
184
  connect: vi.fn(),
185
185
  launch: vi.fn(),
186
- })
186
+ });
187
187
  infraStore.register_microservice(viewerStore, {
188
188
  request: vi.fn(),
189
189
  connect: vi.fn(),
190
190
  launch: vi.fn(),
191
- })
191
+ });
192
192
 
193
- geodeStore.$patch({ request_counter: 1 })
194
- viewerStore.$patch({ request_counter: 0 })
195
- expect(infraStore.microservices_busy).toBeTruthy()
196
- })
193
+ geodeStore.$patch({ request_counter: 1 });
194
+ viewerStore.$patch({ request_counter: 0 });
195
+ expect(infraStore.microservices_busy).toBeTruthy();
196
+ });
197
197
  test("test geode false & viewer true", () => {
198
- const infraStore = useInfraStore()
199
- const geodeStore = useGeodeStore()
200
- const viewerStore = useViewerStore()
198
+ const infraStore = useInfraStore();
199
+ const geodeStore = useGeodeStore();
200
+ const viewerStore = useViewerStore();
201
201
 
202
202
  infraStore.register_microservice(geodeStore, {
203
203
  request: vi.fn(),
204
204
  connect: vi.fn(),
205
205
  launch: vi.fn(),
206
- })
206
+ });
207
207
  infraStore.register_microservice(viewerStore, {
208
208
  request: vi.fn(),
209
209
  connect: vi.fn(),
210
210
  launch: vi.fn(),
211
- })
211
+ });
212
212
 
213
- geodeStore.$patch({ request_counter: 0 })
214
- viewerStore.$patch({ request_counter: 1 })
215
- expect(infraStore.microservices_busy).toBeTruthy()
216
- })
213
+ geodeStore.$patch({ request_counter: 0 });
214
+ viewerStore.$patch({ request_counter: 1 });
215
+ expect(infraStore.microservices_busy).toBeTruthy();
216
+ });
217
217
  test("test geode true & viewer true", () => {
218
- const infraStore = useInfraStore()
219
- const geodeStore = useGeodeStore()
220
- const viewerStore = useViewerStore()
218
+ const infraStore = useInfraStore();
219
+ const geodeStore = useGeodeStore();
220
+ const viewerStore = useViewerStore();
221
221
 
222
222
  infraStore.register_microservice(geodeStore, {
223
223
  request: vi.fn(),
224
224
  connect: vi.fn(),
225
225
  launch: vi.fn(),
226
- })
226
+ });
227
227
  infraStore.register_microservice(viewerStore, {
228
228
  request: vi.fn(),
229
229
  connect: vi.fn(),
230
230
  launch: vi.fn(),
231
- })
231
+ });
232
232
 
233
- geodeStore.$patch({ request_counter: 1 })
234
- viewerStore.$patch({ request_counter: 1 })
235
- expect(infraStore.microservices_busy).toBeTruthy()
236
- })
237
- })
238
- })
233
+ geodeStore.$patch({ request_counter: 1 });
234
+ viewerStore.$patch({ request_counter: 1 });
235
+ expect(infraStore.microservices_busy).toBeTruthy();
236
+ });
237
+ });
238
+ });
239
239
 
240
240
  describe("actions", () => {
241
241
  describe("register_microservice", () => {
242
242
  test("register geode microservice", () => {
243
- const infraStore = useInfraStore()
244
- const geodeStore = useGeodeStore()
243
+ const infraStore = useInfraStore();
244
+ const geodeStore = useGeodeStore();
245
245
 
246
246
  infraStore.register_microservice(geodeStore, {
247
247
  request: vi.fn(),
248
248
  connect: vi.fn(),
249
249
  launch: vi.fn(),
250
- })
250
+ });
251
251
 
252
- expect(infraStore.microservices.length).toBe(1)
253
- expect(infraStore.microservices[0].$id).toBe("geode")
254
- })
252
+ expect(infraStore.microservices.length).toBe(1);
253
+ expect(infraStore.microservices[0].$id).toBe("geode");
254
+ });
255
255
 
256
256
  test("register multiple microservices", () => {
257
- const infraStore = useInfraStore()
258
- const geodeStore = useGeodeStore()
259
- const viewerStore = useViewerStore()
257
+ const infraStore = useInfraStore();
258
+ const geodeStore = useGeodeStore();
259
+ const viewerStore = useViewerStore();
260
260
 
261
261
  infraStore.register_microservice(geodeStore, {
262
262
  request: vi.fn(),
263
263
  connect: vi.fn(),
264
264
  launch: vi.fn(),
265
- })
265
+ });
266
266
 
267
267
  infraStore.register_microservice(viewerStore, {
268
268
  request: vi.fn(),
269
269
  connect: vi.fn(),
270
270
  launch: vi.fn(),
271
- })
271
+ });
272
272
 
273
- expect(infraStore.microservices.length).toBe(2)
274
- })
275
- })
273
+ expect(infraStore.microservices.length).toBe(2);
274
+ });
275
+ });
276
276
 
277
277
  describe("create_backend", () => {
278
278
  // Test without microservices
279
279
  test("test with end-point", async () => {
280
- const infraStore = useInfraStore()
281
- const geodeStore = useGeodeStore()
282
- const viewerStore = useViewerStore()
283
- const lambdaStore = useLambdaStore()
280
+ const infraStore = useInfraStore();
281
+ const geodeStore = useGeodeStore();
282
+ const viewerStore = useViewerStore();
283
+ const lambdaStore = useLambdaStore();
284
284
 
285
- infraStore.app_mode = appMode.CLOUD
286
- const ID = "123456"
285
+ infraStore.app_mode = appMode.CLOUD;
286
+ const ID = "123456";
287
287
  registerEndpoint(lambdaStore.base_url, {
288
288
  method: "POST",
289
289
  handler: () => ({ ID }),
290
- })
291
- await infraStore.create_backend()
292
- expect(infraStore.status).toBe(Status.CREATED)
293
- expect(infraStore.ID).toBe(ID)
294
-
295
- expect(geodeStore.status).toBe(Status.NOT_CONNECTED)
296
- expect(viewerStore.status).toBe(Status.NOT_CONNECTED)
297
- })
298
- })
299
- })
300
- })
290
+ });
291
+ await infraStore.create_backend();
292
+ expect(infraStore.status).toBe(Status.CREATED);
293
+ expect(infraStore.ID).toBe(ID);
294
+
295
+ expect(geodeStore.status).toBe(Status.NOT_CONNECTED);
296
+ expect(viewerStore.status).toBe(Status.NOT_CONNECTED);
297
+ });
298
+ });
299
+ });
300
+ });
@@ -1,132 +1,130 @@
1
1
  // Third party imports
2
- import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest"
3
- import { registerEndpoint } from "@nuxt/test-utils/runtime"
2
+ import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest";
3
+ import { registerEndpoint } from "@nuxt/test-utils/runtime";
4
4
 
5
5
  // Local imports
6
- import { Status } from "@ogw_front/utils/status"
7
- import { setupActivePinia } from "@ogw_tests/utils"
8
- import { useFeedbackStore } from "@ogw_front/stores/feedback"
9
- import { useLambdaStore } from "@ogw_front/stores/lambda"
6
+ import { Status } from "@ogw_front/utils/status";
7
+ import { setupActivePinia } from "@ogw_tests/utils";
8
+ import { useFeedbackStore } from "@ogw_front/stores/feedback";
9
+ import { useLambdaStore } from "@ogw_front/stores/lambda";
10
10
 
11
11
  // CONSTANTS
12
- const PORT_443 = "443"
13
- const API_URL = "api.example.com"
14
- const SITE_BRANCH = "/test"
15
- const PROJECT = "project"
16
- const TEST_ID = "test-id-123456"
17
- const STATUS_500 = 500
12
+ const PORT_443 = "443";
13
+ const API_URL = "api.example.com";
14
+ const SITE_BRANCH = "/test";
15
+ const PROJECT = "project";
16
+ const TEST_ID = "test-id-123456";
17
+ const STATUS_500 = 500;
18
18
 
19
- beforeEach(async () => {
20
- setupActivePinia()
21
- })
19
+ beforeEach(() => {
20
+ setupActivePinia();
21
+ });
22
22
 
23
23
  function setupConfig() {
24
- const config = useRuntimeConfig()
25
- config.public.API_URL = API_URL
26
- config.public.SITE_BRANCH = SITE_BRANCH
27
- config.public.PROJECT = PROJECT
24
+ const config = useRuntimeConfig();
25
+ config.public.API_URL = API_URL;
26
+ config.public.SITE_BRANCH = SITE_BRANCH;
27
+ config.public.PROJECT = PROJECT;
28
28
  }
29
29
 
30
30
  describe("Lambda Store", () => {
31
31
  describe("state", () => {
32
32
  test("initial state", () => {
33
- const lambdaStore = useLambdaStore()
34
- expectTypeOf(lambdaStore.status).toBeString()
35
- expect(lambdaStore.status).toBe(Status.NOT_CONNECTED)
36
- })
37
- })
33
+ const lambdaStore = useLambdaStore();
34
+ expectTypeOf(lambdaStore.status).toBeString();
35
+ expect(lambdaStore.status).toBe(Status.NOT_CONNECTED);
36
+ });
37
+ });
38
38
 
39
39
  describe("getters", () => {
40
40
  describe("protocol", () => {
41
41
  test("test protocol is always https", () => {
42
- const lambdaStore = useLambdaStore()
43
- expect(lambdaStore.protocol).toBe("https")
44
- })
45
- })
42
+ const lambdaStore = useLambdaStore();
43
+ expect(lambdaStore.protocol).toBe("https");
44
+ });
45
+ });
46
46
 
47
47
  describe("port", () => {
48
48
  test("test port is always 443", () => {
49
- const lambdaStore = useLambdaStore()
50
- expect(lambdaStore.port).toBe(PORT_443)
51
- })
52
- })
49
+ const lambdaStore = useLambdaStore();
50
+ expect(lambdaStore.port).toBe(PORT_443);
51
+ });
52
+ });
53
53
 
54
54
  describe("base_url", () => {
55
55
  test("test base_url construction", () => {
56
- setupConfig()
57
- const lambdaStore = useLambdaStore()
56
+ setupConfig();
57
+ const lambdaStore = useLambdaStore();
58
58
  expect(lambdaStore.base_url).toBe(
59
59
  `https://${API_URL}:${PORT_443}${SITE_BRANCH}/${PROJECT}/createbackend`,
60
- )
61
- })
62
- })
60
+ );
61
+ });
62
+ });
63
63
 
64
64
  describe("is_busy", () => {
65
65
  test("test is_busy is always false", () => {
66
- const lambdaStore = useLambdaStore()
67
- expect(lambdaStore.is_busy).toBeFalsy()
68
- })
69
- })
70
- })
66
+ const lambdaStore = useLambdaStore();
67
+ expect(lambdaStore.is_busy).toBeFalsy();
68
+ });
69
+ });
70
+ });
71
71
 
72
72
  describe("actions", () => {
73
73
  describe("launch", () => {
74
- const postFakeCall = vi.fn()
74
+ const postFakeCall = vi.fn();
75
75
 
76
76
  test("successful launch", async () => {
77
- setupConfig()
78
- const lambdaStore = useLambdaStore()
79
- const feedbackStore = useFeedbackStore()
77
+ setupConfig();
78
+ const lambdaStore = useLambdaStore();
79
+ const feedbackStore = useFeedbackStore();
80
80
 
81
- lambdaStore.base_url = "test-base-url"
81
+ lambdaStore.base_url = "test-base-url";
82
82
  registerEndpoint(lambdaStore.base_url, {
83
83
  method: "POST",
84
84
  handler: postFakeCall,
85
- })
85
+ });
86
86
 
87
87
  postFakeCall.mockImplementation(() => ({
88
88
  ID: TEST_ID,
89
- }))
89
+ }));
90
90
 
91
- const id = await lambdaStore.launch()
91
+ const id = await lambdaStore.launch();
92
92
 
93
- expect(lambdaStore.status).toBe(Status.CONNECTED)
94
- expect(id).toBe(TEST_ID)
95
- expect(feedbackStore.server_error).toBeFalsy()
96
- })
93
+ expect(lambdaStore.status).toBe(Status.CONNECTED);
94
+ expect(id).toBe(TEST_ID);
95
+ expect(feedbackStore.server_error).toBeFalsy();
96
+ });
97
97
 
98
98
  test("failed launch - error response", async () => {
99
- setupConfig()
100
- const lambdaStore = useLambdaStore()
101
- const feedbackStore = useFeedbackStore()
99
+ setupConfig();
100
+ const lambdaStore = useLambdaStore();
101
+ const feedbackStore = useFeedbackStore();
102
102
 
103
103
  registerEndpoint(lambdaStore.base_url, {
104
104
  method: "POST",
105
105
  handler: postFakeCall,
106
- })
106
+ });
107
107
 
108
108
  postFakeCall.mockImplementation(() => {
109
109
  throw createError({
110
110
  status: STATUS_500,
111
111
  statusMessage: "Internal Server Error",
112
- })
113
- })
112
+ });
113
+ });
114
114
 
115
- await expect(lambdaStore.launch()).rejects.toThrow(
116
- "Failed to launch lambda backend",
117
- )
115
+ await expect(lambdaStore.launch()).rejects.toThrow("Failed to launch lambda backend");
118
116
 
119
- expect(lambdaStore.status).toBe(Status.NOT_CONNECTED)
120
- expect(feedbackStore.server_error).toBeTruthy()
121
- })
122
- })
117
+ expect(lambdaStore.status).toBe(Status.NOT_CONNECTED);
118
+ expect(feedbackStore.server_error).toBeTruthy();
119
+ });
120
+ });
123
121
 
124
122
  describe("connect", () => {
125
123
  test("successful connect", async () => {
126
- const lambdaStore = useLambdaStore()
127
- await lambdaStore.connect()
128
- expect(lambdaStore.status).toBe(Status.CONNECTED)
129
- })
130
- })
131
- })
132
- })
124
+ const lambdaStore = useLambdaStore();
125
+ await lambdaStore.connect();
126
+ expect(lambdaStore.status).toBe(Status.CONNECTED);
127
+ });
128
+ });
129
+ });
130
+ });