@geode/opengeodeweb-front 10.29.1 → 10.30.0-rc.2

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 (52) hide show
  1. package/app/components/Launcher.vue +1 -1
  2. package/app/stores/app.js +33 -7
  3. package/app/stores/back.js +8 -14
  4. package/app/stores/cloud.js +2 -0
  5. package/app/stores/infra.js +2 -2
  6. package/app/stores/viewer.js +9 -15
  7. package/app/utils/extension.js +30 -3
  8. package/app/utils/stores.js +32 -0
  9. package/internal/utils/api_fetch.js +1 -0
  10. package/internal/utils/upload_file.js +4 -1
  11. package/nuxt.config.js +2 -1
  12. package/package.json +3 -3
  13. package/server/api/local/{project_folder_path.post.js → app/project_folder_path.post.js} +1 -1
  14. package/server/api/local/{run_back.post.js → app/run_back.post.js} +1 -1
  15. package/server/api/local/{run_viewer.post.js → app/run_viewer.post.js} +1 -1
  16. package/server/api/{microservice → local}/extensions/upload.put.js +16 -37
  17. package/server/api/microservice/app/set_app_base_url.post.js +25 -0
  18. package/server/api/microservice/extensions/download.post.js +32 -0
  19. package/server/api/microservice/extensions/kill.post.js +3 -3
  20. package/server/api/microservice/extensions/run.post.js +4 -4
  21. package/server/api/serverless/run_cloud.js +1 -1
  22. package/{app/utils/config.js → server/utils/app_config.js} +28 -3
  23. package/{app/utils/local → server/utils}/path.js +1 -1
  24. package/{app/utils/local → server/utils}/scripts.js +5 -2
  25. package/server/utils/server_config.js +38 -0
  26. package/shared/scripts.js +18 -0
  27. package/tests/integration/setup.js +3 -3
  28. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +1 -1
  29. package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +1 -1
  30. package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +1 -1
  31. package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +1 -1
  32. package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +1 -1
  33. package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +1 -1
  34. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +1 -1
  35. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +1 -1
  36. package/tests/integration/stores/data_style/model/edges.nuxt.test.js +1 -1
  37. package/tests/integration/stores/data_style/model/index.nuxt.test.js +1 -1
  38. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +1 -1
  39. package/tests/integration/stores/data_style/model/points.nuxt.test.js +1 -1
  40. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +1 -1
  41. package/tests/integration/stores/viewer.nuxt.test.js +1 -1
  42. package/tests/unit/composables/project_manager.nuxt.test.js +1 -1
  43. package/tests/unit/stores/back.nuxt.test.js +1 -1
  44. package/tests/unit/stores/cloud.nuxt.test.js +12 -7
  45. package/tests/unit/stores/infra.nuxt.test.js +2 -2
  46. package/tests/unit/stores/viewer.nuxt.test.js +1 -1
  47. package/tests/vitest.config.js +7 -5
  48. /package/server/api/local/{kill.post.js → app/kill.post.js} +0 -0
  49. /package/{app/utils/local → server/utils}/cleanup.js +0 -0
  50. /package/{app/utils/local → server/utils}/microservices.js +0 -0
  51. /package/{app → server}/utils/server.js +0 -0
  52. /package/{app/utils/local → shared}/app_mode.js +0 -0
@@ -2,7 +2,7 @@
2
2
  import Loading from "@ogw_front/components/Loading";
3
3
  import Recaptcha from "@ogw_front/components/Recaptcha";
4
4
  import { Status } from "@ogw_front/utils/status";
5
- import { appMode } from "@ogw_front/utils/local/app_mode";
5
+ import { appMode } from "@ogw_shared/app_mode";
6
6
  import { useInfraStore } from "@ogw_front/stores/infra";
7
7
 
8
8
  const { appName, email, isUserAuthenticated, logo } = defineProps({
package/app/stores/app.js CHANGED
@@ -1,13 +1,29 @@
1
1
  // Local imports
2
+ import { getRestApiPort, getRestApiProtocol, isCloudMode } from "@ogw_front/utils/stores.js";
3
+ import { Status } from "@ogw_front/utils/status";
2
4
  import { api_fetch } from "@ogw_internal/utils/api_fetch.js";
3
- import { upload_file } from "@ogw_internal/utils/upload_file.js";
4
-
5
5
  import { killExtension } from "@ogw_front/utils/extension.js";
6
+ import { upload_file } from "@ogw_internal/utils/upload_file.js";
6
7
  import { useInfraStore } from "@ogw_front/stores/infra";
7
8
 
8
9
  // oxlint-disable-next-line max-lines-per-function, max-statements
9
10
  export const useAppStore = defineStore("app", () => {
10
11
  const stores = [];
12
+ const default_local_port = ref(globalThis.location.port);
13
+ const status = ref(Status.NOT_CONNECTED);
14
+
15
+ const protocol = computed(() => getRestApiProtocol());
16
+
17
+ const port = computed(() => getRestApiPort(default_local_port.value));
18
+
19
+ const base_url = computed(() => {
20
+ const infraStore = useInfraStore();
21
+ let app_url = `${protocol.value}://${infraStore.domain_name}:${port.value}`;
22
+ if (isCloudMode()) {
23
+ app_url += `/server`;
24
+ }
25
+ return app_url;
26
+ });
11
27
 
12
28
  function registerStore(store) {
13
29
  const isAlreadyRegistered = stores.some((registeredStore) => registeredStore.$id === store.$id);
@@ -91,7 +107,7 @@ export const useAppStore = defineStore("app", () => {
91
107
  return loadedExtensions.value.get(id);
92
108
  }
93
109
 
94
- async function loadExtension(path, port, backendPath = undefined) {
110
+ async function loadExtension(path, extensionPort, backendPath = undefined) {
95
111
  try {
96
112
  let finalURL = path;
97
113
 
@@ -108,7 +124,7 @@ export const useAppStore = defineStore("app", () => {
108
124
  // oxlint-disable-next-line no-inline-comments
109
125
  const extensionModule = await import(/* @vite-ignore */ finalURL);
110
126
  const store = extensionModule.metadata.store();
111
- store.$patch({ default_local_port: port });
127
+ store.$patch({ default_local_port: extensionPort });
112
128
 
113
129
  if (finalURL !== path && finalURL.startsWith("blob:")) {
114
130
  URL.revokeObjectURL(finalURL);
@@ -196,11 +212,13 @@ export const useAppStore = defineStore("app", () => {
196
212
  }
197
213
 
198
214
  function upload(file, callbacks = {}) {
199
- const route = "/api/microservice/extensions/upload";
215
+ const route = "/api/local/extensions/upload";
200
216
  const store = useAppStore();
217
+ const { PROJECT: projectName } = useRuntimeConfig().public;
218
+ const params = { projectName };
201
219
  return upload_file(
202
220
  store,
203
- { route, file },
221
+ { route, file, params },
204
222
  {
205
223
  ...callbacks,
206
224
  response_function: async (response) => {
@@ -239,12 +257,13 @@ export const useAppStore = defineStore("app", () => {
239
257
  function stop_request() {
240
258
  request_counter.value -= 1;
241
259
  }
260
+ const is_busy = computed(() => request_counter.value > 0);
242
261
 
243
262
  const projectFolderPath = ref("");
244
263
  function createProjectFolder() {
245
264
  const { PROJECT } = useRuntimeConfig().public;
246
265
  const schema = {
247
- $id: "/api/local/project_folder_path",
266
+ $id: "/api/local/app/project_folder_path",
248
267
  methods: ["POST"],
249
268
  type: "object",
250
269
  properties: { PROJECT: { type: "string" } },
@@ -265,6 +284,13 @@ export const useAppStore = defineStore("app", () => {
265
284
 
266
285
  return {
267
286
  stores,
287
+ default_local_port,
288
+ request_counter,
289
+ status,
290
+ protocol,
291
+ port,
292
+ base_url,
293
+ is_busy,
268
294
  registerStore,
269
295
  exportStores,
270
296
  importStores,
@@ -1,6 +1,6 @@
1
+ import { getRestApiPort, getRestApiProtocol, isCloudMode } from "@ogw_front/utils/stores";
1
2
  import { Status } from "@ogw_front/utils/status";
2
3
  import { api_fetch } from "@ogw_internal/utils/api_fetch";
3
- import { appMode } from "@ogw_front/utils/local/app_mode";
4
4
  import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json";
5
5
  import { upload_file } from "@ogw_internal/utils/upload_file.js";
6
6
  import { useAppStore } from "@ogw_front/stores/app";
@@ -19,24 +19,18 @@ export const useBackStore = defineStore("back", {
19
19
  }),
20
20
  getters: {
21
21
  protocol() {
22
- if (useInfraStore().app_mode === appMode.CLOUD) {
23
- return "https";
24
- }
25
- return "http";
22
+ return getRestApiProtocol();
26
23
  },
27
24
  port() {
28
- if (useInfraStore().app_mode === appMode.CLOUD) {
29
- return "443";
30
- }
31
- return this.default_local_port;
25
+ return getRestApiPort(this.default_local_port);
32
26
  },
33
27
  base_url() {
34
28
  const infraStore = useInfraStore();
35
- let geode_url = `${this.protocol}://${infraStore.domain_name}:${this.port}`;
36
- if (infraStore.app_mode === appMode.CLOUD) {
37
- geode_url += `/geode`;
29
+ let back_url = `${this.protocol}://${infraStore.domain_name}:${this.port}`;
30
+ if (isCloudMode()) {
31
+ back_url += `/geode`;
38
32
  }
39
- return geode_url;
33
+ return back_url;
40
34
  },
41
35
  is_busy() {
42
36
  return this.request_counter > 0;
@@ -81,7 +75,7 @@ export const useBackStore = defineStore("back", {
81
75
  const appStore = useAppStore();
82
76
  const { COMMAND_BACK, NUXT_ROOT_PATH } = useRuntimeConfig().public;
83
77
  const schema = {
84
- $id: "/api/local/run_back",
78
+ $id: "/api/local/app/run_back",
85
79
  methods: ["POST"],
86
80
  type: "object",
87
81
  properties: {
@@ -1,4 +1,5 @@
1
1
  import { Status } from "@ogw_front/utils/status";
2
+ import { setAppBaseUrl } from "@ogw_shared/scripts";
2
3
  import { useAppStore } from "./app";
3
4
  import { useFeedbackStore } from "./feedback";
4
5
  import { useInfraStore } from "./infra";
@@ -40,6 +41,7 @@ export const useCloudStore = defineStore("cloud", {
40
41
  infraStore.$patch({
41
42
  domain_name: response.url,
42
43
  });
44
+ setAppBaseUrl(appStore.base_url);
43
45
  },
44
46
  response_error_function: () => {
45
47
  feedbackStore.$patch({ server_error: true });
@@ -1,5 +1,5 @@
1
1
  import { Status } from "@ogw_front/utils/status";
2
- import { appMode } from "@ogw_front/utils/local/app_mode";
2
+ import { appMode } from "@ogw_shared/app_mode";
3
3
  import { registerRunningExtensions } from "@ogw_front/utils/extension";
4
4
  import { useAppStore } from "@ogw_front/stores/app";
5
5
  import { useCloudStore } from "@ogw_front/stores/cloud";
@@ -9,7 +9,7 @@ export const useInfraStore = defineStore("infra", {
9
9
  app_mode: useRuntimeConfig().public.MODE,
10
10
  status: Status.NOT_CREATED,
11
11
  microservices: [],
12
- domain_name: "localhost",
12
+ domain_name: globalThis.location.hostname,
13
13
  }),
14
14
  getters: {
15
15
  microservices_connected() {
@@ -8,8 +8,12 @@ import { connectImageStream } from "@kitware/vtk.js/Rendering/Misc/RemoteView";
8
8
  import schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
9
9
 
10
10
  // Local imports
11
+ import {
12
+ getWebsocketApiPort,
13
+ getWebsocketApiProtocol,
14
+ isCloudMode,
15
+ } from "@ogw_front/utils/stores.js";
11
16
  import { Status } from "@ogw_front/utils/status";
12
- import { appMode } from "@ogw_front/utils/local/app_mode";
13
17
  import { useAppStore } from "@ogw_front/stores/app";
14
18
  import { useInfraStore } from "@ogw_front/stores/infra";
15
19
  import { viewer_call } from "@ogw_internal/utils/viewer_call";
@@ -33,23 +37,13 @@ export const useViewerStore = defineStore(
33
37
  const version = ref("0.0.0");
34
38
  const busy = ref(0);
35
39
 
36
- const protocol = computed(() => {
37
- if (infraStore.app_mode === appMode.CLOUD) {
38
- return "wss";
39
- }
40
- return "ws";
41
- });
40
+ const protocol = computed(() => getWebsocketApiProtocol());
42
41
 
43
- const port = computed(() => {
44
- if (infraStore.app_mode === appMode.CLOUD) {
45
- return "443";
46
- }
47
- return default_local_port.value;
48
- });
42
+ const port = computed(() => getWebsocketApiPort(default_local_port.value));
49
43
 
50
44
  const base_url = computed(() => {
51
45
  let viewer_url = `${protocol.value}://${infraStore.domain_name}:${port.value}`;
52
- if (infraStore.app_mode === appMode.CLOUD) {
46
+ if (isCloudMode()) {
53
47
  viewer_url += `/viewer`;
54
48
  }
55
49
  viewer_url += "/ws";
@@ -133,7 +127,7 @@ export const useViewerStore = defineStore(
133
127
 
134
128
  const { COMMAND_VIEWER, NUXT_ROOT_PATH } = useRuntimeConfig().public;
135
129
  const schema = {
136
- $id: "/api/local/run_viewer",
130
+ $id: "/api/local/app/run_viewer",
137
131
  methods: ["POST"],
138
132
  type: "object",
139
133
  properties: { COMMAND_VIEWER: { type: "string" }, NUXT_ROOT_PATH: { type: "string" } },
@@ -12,6 +12,11 @@ async function importExtensionFile(file) {
12
12
  return registerRunningExtensions();
13
13
  }
14
14
 
15
+ async function importExtensionURL(url) {
16
+ await downloadExtension(url);
17
+ return registerRunningExtensions();
18
+ }
19
+
15
20
  async function registerRunningExtensions() {
16
21
  const appStore = useAppStore();
17
22
  const infraStore = useInfraStore();
@@ -74,6 +79,27 @@ async function uploadExtension(file) {
74
79
  await appStore.upload(file);
75
80
  }
76
81
 
82
+ function downloadExtension({ url, extensionFileName }) {
83
+ const appStore = useAppStore();
84
+ const { PROJECT: projectName } = useRuntimeConfig().public;
85
+ const params = { projectName, url, extensionFileName };
86
+
87
+ const schema = {
88
+ $id: "/api/microservice/extensions/download",
89
+ methods: ["POST"],
90
+ type: "object",
91
+ properties: {
92
+ extensionFileName: { type: "string" },
93
+ projectName: { type: "string" },
94
+ url: { type: "string" },
95
+ },
96
+ required: ["extensionFileName", "projectName", "url"],
97
+ additionalProperties: false,
98
+ };
99
+
100
+ return appStore.request({ schema, params });
101
+ }
102
+
77
103
  function runExtensions() {
78
104
  const appStore = useAppStore();
79
105
  const { projectFolderPath } = appStore;
@@ -121,9 +147,10 @@ function killExtension(extensionId) {
121
147
 
122
148
  export {
123
149
  importExtensionFile,
124
- unloadExtension,
125
- uploadExtension,
150
+ importExtensionURL,
151
+ killExtension,
126
152
  registerRunningExtensions,
127
153
  runExtensions,
128
- killExtension,
154
+ unloadExtension,
155
+ uploadExtension,
129
156
  };
@@ -0,0 +1,32 @@
1
+ import { appMode } from "@ogw_shared/app_mode";
2
+ import { useInfraStore } from "@ogw_front/stores/infra";
3
+
4
+ function isCloudMode() {
5
+ const infraStore = useInfraStore();
6
+ return infraStore.app_mode === appMode.CLOUD;
7
+ }
8
+
9
+ function getRestApiProtocol() {
10
+ const protocol = isCloudMode() ? "https" : "http";
11
+ return protocol;
12
+ }
13
+ function getRestApiPort(defaultLocalPort) {
14
+ const port = isCloudMode() ? "443" : defaultLocalPort;
15
+ return port;
16
+ }
17
+ function getWebsocketApiProtocol() {
18
+ const protocol = isCloudMode() ? "wss" : "ws";
19
+ return protocol;
20
+ }
21
+ function getWebsocketApiPort(defaultLocalPort) {
22
+ const port = isCloudMode() ? "443" : defaultLocalPort;
23
+ return port;
24
+ }
25
+
26
+ export {
27
+ isCloudMode,
28
+ getRestApiPort,
29
+ getRestApiProtocol,
30
+ getWebsocketApiProtocol,
31
+ getWebsocketApiPort,
32
+ };
@@ -9,6 +9,7 @@ export function api_fetch(
9
9
  { schema, params, headers },
10
10
  { request_error_function, response_function, response_error_function, timeout } = {},
11
11
  ) {
12
+ console.log("[API] Fetching", microservice.base_url);
12
13
  const feedbackStore = useFeedbackStore();
13
14
 
14
15
  const body = params || {};
@@ -2,7 +2,7 @@ import { useFeedbackStore } from "@ogw_front/stores/feedback.js";
2
2
 
3
3
  async function upload_file(
4
4
  microservice,
5
- { route, file },
5
+ { route, file, params = {} },
6
6
  { request_error_function, response_function, response_error_function } = {},
7
7
  ) {
8
8
  console.log("[UPLOAD_FILE] Uploading file", { route, file });
@@ -12,6 +12,9 @@ async function upload_file(
12
12
  }
13
13
 
14
14
  const body = new FormData();
15
+ for (const [key, value] of Object.entries(params)) {
16
+ body.append(key, value);
17
+ }
15
18
  body.append("file", file);
16
19
 
17
20
  const request_options = {
package/nuxt.config.js CHANGED
@@ -27,8 +27,9 @@ export default defineNuxtConfig({
27
27
  alias: {
28
28
  "@ogw_front": path.resolve(__dirname, "app"),
29
29
  "@ogw_internal": path.resolve(__dirname, "internal"),
30
- "@ogw_server": path.resolve(__dirname, "server"),
31
30
  "@ogw_tests": path.resolve(__dirname, "tests"),
31
+ "@ogw_shared": path.resolve(__dirname, "shared"),
32
+ "@ogw_server": path.resolve(__dirname, "server"),
32
33
  },
33
34
 
34
35
  // ** Global CSS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.29.1",
3
+ "version": "10.30.0-rc.2",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {
@@ -34,8 +34,8 @@
34
34
  "build": ""
35
35
  },
36
36
  "dependencies": {
37
- "@geode/opengeodeweb-back": "latest",
38
- "@geode/opengeodeweb-viewer": "latest",
37
+ "@geode/opengeodeweb-back": "next",
38
+ "@geode/opengeodeweb-viewer": "next",
39
39
  "@google-cloud/run": "3.2.0",
40
40
  "@kitware/vtk.js": "33.3.0",
41
41
  "@mdi/font": "7.4.47",
@@ -7,7 +7,7 @@ import { createError, defineEventHandler, readBody } from "h3";
7
7
  import {
8
8
  createPath,
9
9
  generateProjectFolderPath,
10
- } from "@geode/opengeodeweb-front/app/utils/local/path.js";
10
+ } from "@geode/opengeodeweb-front/server/utils/path.js";
11
11
 
12
12
  export default defineEventHandler(async (event) => {
13
13
  try {
@@ -7,7 +7,7 @@ import { createError, defineEventHandler, readBody } from "h3";
7
7
  import {
8
8
  addMicroserviceMetadatas,
9
9
  runBack,
10
- } from "@geode/opengeodeweb-front/app/utils/local/microservices.js";
10
+ } from "@geode/opengeodeweb-front/server/utils/microservices.js";
11
11
 
12
12
  export default defineEventHandler(async (event) => {
13
13
  try {
@@ -7,7 +7,7 @@ import { createError, defineEventHandler, readBody } from "h3";
7
7
  import {
8
8
  addMicroserviceMetadatas,
9
9
  runViewer,
10
- } from "@geode/opengeodeweb-front/app/utils/local/microservices.js";
10
+ } from "@geode/opengeodeweb-front/server/utils/microservices.js";
11
11
 
12
12
  export default defineEventHandler(async (event) => {
13
13
  try {
@@ -2,27 +2,26 @@
2
2
  import { finished, pipeline } from "node:stream/promises";
3
3
  import { Readable } from "node:stream";
4
4
  import fs from "node:fs";
5
- import path from "node:path";
6
5
 
7
6
  // Third party imports
8
7
  import { createError, defineEventHandler, getRequestHeaders, getRequestWebStream } from "h3";
9
- import StreamZip from "node-stream-zip";
10
8
  import busboy from "busboy";
11
- import sanitize from "sanitize-filename";
12
9
 
13
10
  // Local imports
14
- import { addExtensionToConf, confFolderPath } from "@geode/opengeodeweb-front/app/utils/config.js";
11
+ import {
12
+ registerExtensionFile,
13
+ targetExtensionFilePath,
14
+ } from "@geode/opengeodeweb-front/server/utils/app_config.js";
15
15
 
16
16
  const CODE_201 = 201;
17
- const FILE_SIZE_LIMIT = 107_374_182;
17
+ const BYTES_PER_KIBIBYTE = 1024;
18
+ const MAX_FILE_MEGABYTES = 500;
19
+ const FILE_SIZE_LIMIT = MAX_FILE_MEGABYTES * BYTES_PER_KIBIBYTE * BYTES_PER_KIBIBYTE;
18
20
 
19
21
  export default defineEventHandler(async (event) => {
20
- const projectName = "vease";
21
22
  const writePromises = [];
22
23
  const savedFiles = [];
23
24
 
24
- const configFolderPath = confFolderPath(projectName);
25
-
26
25
  const busboyInstance = busboy({
27
26
  headers: getRequestHeaders(event),
28
27
  limits: {
@@ -30,6 +29,13 @@ export default defineEventHandler(async (event) => {
30
29
  files: 1,
31
30
  },
32
31
  });
32
+ let projectName = "";
33
+ busboyInstance.on("field", (name, value) => {
34
+ console.log(`Field ${name}: ${value}`);
35
+ if (name === "projectName") {
36
+ projectName = value;
37
+ }
38
+ });
33
39
 
34
40
  busboyInstance.on("file", (fieldname, fileStream, info) => {
35
41
  if (fieldname !== "file") {
@@ -37,57 +43,30 @@ export default defineEventHandler(async (event) => {
37
43
  fileStream.resume();
38
44
  return;
39
45
  }
40
-
41
- const safeFilename = sanitize(info.filename);
42
- const targetPath = path.join(configFolderPath, safeFilename);
43
-
46
+ const targetPath = targetExtensionFilePath(projectName, info.filename);
44
47
  const writePromise = (async () => {
45
48
  const writeStream = fs.createWriteStream(targetPath);
46
49
  await pipeline(fileStream, writeStream);
47
50
  savedFiles.push(targetPath);
48
51
  console.log("File written:", targetPath);
49
52
  })();
50
-
51
53
  writePromises.push(writePromise);
52
54
  fileStream.on("limit", () => busboyInstance.destroy(new Error("File too large")));
53
55
  });
54
56
 
55
- busboyInstance.on("field", (name, value) => {
56
- console.log(`Field ${name}: ${value}`);
57
- });
58
-
59
57
  busboyInstance.on("filesLimit", () => busboyInstance.destroy(new Error("Too many files")));
60
58
  busboyInstance.on("partsLimit", () => busboyInstance.destroy(new Error("Too many parts")));
61
59
 
62
60
  const webStream = getRequestWebStream(event);
63
61
  Readable.fromWeb(webStream).pipe(busboyInstance);
64
62
  await finished(busboyInstance);
65
-
66
63
  if (writePromises.length > 0) {
67
64
  await Promise.all(writePromises);
68
65
  console.log("All disk writes completed");
69
66
  }
70
-
71
67
  if (savedFiles.length === 0) {
72
68
  throw createError({ statusCode: 400, message: "No file received" });
73
69
  }
74
-
75
- await Promise.all(
76
- savedFiles.map(async (file) => {
77
- const StreamZipAsync = StreamZip.async;
78
- const zip = new StreamZipAsync({
79
- file,
80
- storeEntries: true,
81
- });
82
- const metadataJson = await zip.entryData("metadata.json");
83
- const metadata = JSON.parse(metadataJson);
84
- const { id } = metadata;
85
- await addExtensionToConf(projectName, {
86
- extensionId: id,
87
- extensionPath: file,
88
- });
89
- }),
90
- );
91
-
70
+ await Promise.all(savedFiles.map(async (file) => await registerExtensionFile(projectName, file)));
92
71
  return { statusCode: CODE_201 };
93
72
  });
@@ -0,0 +1,25 @@
1
+ // Third party imports
2
+ import { createError, defineEventHandler, readBody } from "h3";
3
+
4
+ // Local imports
5
+ import { setAppBaseUrl } from "@geode/opengeodeweb-front/server/utils/server_config.js";
6
+
7
+ export default defineEventHandler(async (event) => {
8
+ try {
9
+ const { baseUrl } = await readBody(event);
10
+ if (!baseUrl) {
11
+ throw createError({ statusCode: 400, statusMessage: "baseUrl is required" });
12
+ }
13
+
14
+ await setAppBaseUrl(baseUrl);
15
+ console.log(`Updated APP_BASE_URL to ${baseUrl}`);
16
+
17
+ return { statusCode: 200, baseUrl };
18
+ } catch (error) {
19
+ console.log(error);
20
+ throw createError({
21
+ statusCode: error.statusCode,
22
+ statusMessage: error.statusMessage ?? error.message,
23
+ });
24
+ }
25
+ });
@@ -0,0 +1,32 @@
1
+ // Node imports
2
+ import { promises as fs } from "node:fs";
3
+
4
+ // Third party imports
5
+ import { createError, defineEventHandler, readBody } from "h3";
6
+
7
+ // Local imports
8
+ import {
9
+ registerExtensionFile,
10
+ targetExtensionFilePath,
11
+ } from "@geode/opengeodeweb-front/server/utils/app_config.js";
12
+
13
+ export default defineEventHandler(async (event) => {
14
+ try {
15
+ const body = await readBody(event);
16
+ const { projectName, url, extensionFileName } = body;
17
+ console.log({ projectName, url, extensionFileName });
18
+ const fileBuffer = await fetch(url).then((file) => file.arrayBuffer());
19
+ const filePath = targetExtensionFilePath(projectName, extensionFileName);
20
+ await fs.writeFile(filePath, Buffer.from(fileBuffer));
21
+ await registerExtensionFile(projectName, filePath);
22
+ return {
23
+ statusCode: 200,
24
+ };
25
+ } catch (error) {
26
+ console.error("Error downloading extension:", error);
27
+ throw createError({
28
+ statusCode: 500,
29
+ statusMessage: error.message,
30
+ });
31
+ }
32
+ });
@@ -9,9 +9,9 @@ import {
9
9
  getMicroserviceByName,
10
10
  killMicroservice,
11
11
  projectMicroservices,
12
- } from "@geode/opengeodeweb-front/app/utils/local/cleanup.js";
13
- import { extensionFolderPath } from "@geode/opengeodeweb-front/app/utils/local/path.js";
14
- import { removeExtensionFromConf } from "@geode/opengeodeweb-front/app/utils/config.js";
12
+ } from "@geode/opengeodeweb-front/server/utils/cleanup.js";
13
+ import { extensionFolderPath } from "@geode/opengeodeweb-front/server/utils/path.js";
14
+ import { removeExtensionFromConf } from "@geode/opengeodeweb-front/server/utils/app_config.js";
15
15
 
16
16
  export default defineEventHandler(async (event) => {
17
17
  try {
@@ -9,14 +9,14 @@ import { createError, defineEventHandler, readBody } from "h3";
9
9
  import {
10
10
  addMicroserviceMetadatas,
11
11
  runBack,
12
- } from "@geode/opengeodeweb-front/app/utils/local/microservices.js";
12
+ } from "@geode/opengeodeweb-front/server/utils/microservices.js";
13
13
  import {
14
14
  executableName,
15
15
  extensionFolderPath,
16
16
  extensionFrontendPath,
17
- } from "@geode/opengeodeweb-front/app/utils/local/path.js";
18
- import { extensionsConf } from "@geode/opengeodeweb-front/app/utils/config.js";
19
- import { unzipFile } from "@geode/opengeodeweb-front/app/utils/server.js";
17
+ } from "@geode/opengeodeweb-front/server/utils/path.js";
18
+ import { extensionsConf } from "@geode/opengeodeweb-front/server/utils/app_config.js";
19
+ import { unzipFile } from "@geode/opengeodeweb-front/server/utils/server.js";
20
20
 
21
21
  export default defineEventHandler(async (event) => {
22
22
  try {
@@ -6,7 +6,7 @@ import { GoogleAuth } from "google-auth-library";
6
6
  import { ServicesClient } from "@google-cloud/run";
7
7
 
8
8
  // Local imports
9
- import { artifactImage, requestConfig } from "@ogw_server/utils/cloud";
9
+ import { artifactImage, requestConfig } from "@geode/opengeodeweb-front/server/utils/cloud";
10
10
 
11
11
  export default defineEventHandler(async (event) => {
12
12
  try {
@@ -4,6 +4,8 @@ import { unlink } from "node:fs";
4
4
 
5
5
  // Third party imports
6
6
  import Conf from "conf";
7
+ import StreamZip from "node-stream-zip";
8
+ import sanitize from "sanitize-filename";
7
9
 
8
10
  // Local imports
9
11
 
@@ -18,6 +20,12 @@ function confFolderPath(projectName) {
18
20
  return path.dirname(projectConfig.path);
19
21
  }
20
22
 
23
+ function targetExtensionFilePath(projectName, filename) {
24
+ const safeFilename = sanitize(filename);
25
+ const targetPath = path.join(confFolderPath(projectName), safeFilename);
26
+ return targetPath;
27
+ }
28
+
21
29
  function extensionsConf(projectName) {
22
30
  const projectConfig = projectConf(projectName);
23
31
  if (!projectConfig.has("extensions")) {
@@ -51,11 +59,28 @@ function extensionPathFromConf(projectName, extensionId) {
51
59
  return projectConfig.get(`extensions.${extensionId}.path`);
52
60
  }
53
61
 
62
+ async function registerExtensionFile(projectName, file) {
63
+ const StreamZipAsync = StreamZip.async;
64
+ const zip = new StreamZipAsync({
65
+ file,
66
+ storeEntries: true,
67
+ });
68
+ const metadataJson = await zip.entryData("metadata.json");
69
+ const metadata = JSON.parse(metadataJson);
70
+ const { id } = metadata;
71
+ addExtensionToConf(projectName, {
72
+ extensionId: id,
73
+ extensionPath: file,
74
+ });
75
+ }
76
+
54
77
  export {
78
+ addExtensionToConf,
55
79
  confFolderPath,
56
- projectConf,
80
+ extensionPathFromConf,
57
81
  extensionsConf,
58
- addExtensionToConf,
82
+ projectConf,
83
+ registerExtensionFile,
59
84
  removeExtensionFromConf,
60
- extensionPathFromConf,
85
+ targetExtensionFilePath,
61
86
  };
@@ -8,7 +8,7 @@ import { setTimeout } from "node:timers/promises";
8
8
  import { v4 as uuidv4 } from "uuid";
9
9
 
10
10
  // Local imports
11
- import { appMode } from "./app_mode.js";
11
+ import { appMode } from "@geode/opengeodeweb-front/shared/app_mode.js";
12
12
  import { commandExistsSync } from "./scripts.js";
13
13
 
14
14
  function findExecutableInDir(baseDir, execName, osExecutableName) {
@@ -9,7 +9,8 @@ import readline from "node:readline";
9
9
  import { getPort } from "get-port-please";
10
10
 
11
11
  // Local imports
12
- import { appMode } from "./app_mode.js";
12
+ import { appMode } from "@geode/opengeodeweb-front/shared/app_mode.js";
13
+ import { setAppBaseUrl } from "@geode/opengeodeweb-front/shared/scripts.js";
13
14
 
14
15
  const BYTES_PER_KIBIBYTE = 1024;
15
16
  const MAX_ERROR_BUFFER_KIBIBYTES = 64;
@@ -164,7 +165,9 @@ async function runBrowser(scriptName) {
164
165
  PORT: port,
165
166
  },
166
167
  });
167
- return await waitNuxt(nuxtProcess);
168
+ await waitNuxt(nuxtProcess);
169
+ await setAppBaseUrl(`http://localhost:${port}`);
170
+ return port;
168
171
  }
169
172
 
170
173
  export { commandExistsSync, getAvailablePort, runBrowser, waitForReady };
@@ -0,0 +1,38 @@
1
+ import { useStorage } from "#imports";
2
+
3
+ function getConfig() {
4
+ return useStorage("config");
5
+ }
6
+ function getAppBaseUrl() {
7
+ const config = getConfig();
8
+ return config.getItem("APP_BASE_URL");
9
+ }
10
+ function setAppBaseUrl(baseUrl) {
11
+ const config = getConfig();
12
+ return config.setItem("APP_BASE_URL", baseUrl);
13
+ }
14
+ function getBackBaseUrl() {
15
+ const config = getConfig();
16
+ return config.getItem("BACK_BASE_URL");
17
+ }
18
+ function setBackBaseUrl(baseUrl) {
19
+ const config = getConfig();
20
+ return config.setItem("BACK_BASE_URL", baseUrl);
21
+ }
22
+ function getViewerBaseUrl() {
23
+ const config = getConfig();
24
+ return config.getItem("VIEWER_BASE_URL");
25
+ }
26
+ function setViewerBaseUrl(baseUrl) {
27
+ const config = getConfig();
28
+ return config.setItem("VIEWER_BASE_URL", baseUrl);
29
+ }
30
+
31
+ export {
32
+ getAppBaseUrl,
33
+ setAppBaseUrl,
34
+ getBackBaseUrl,
35
+ getViewerBaseUrl,
36
+ setBackBaseUrl,
37
+ setViewerBaseUrl,
38
+ };
@@ -0,0 +1,18 @@
1
+ // Node imports
2
+
3
+ // Third party imports
4
+
5
+ // Local imports
6
+
7
+ function setAppBaseUrl(baseUrl) {
8
+ console.log(`Setting APP_BASE_URL to ${baseUrl}`);
9
+ return fetch(`${baseUrl}/api/microservice/app/set_app_base_url`, {
10
+ method: "POST",
11
+ headers: {
12
+ "Content-Type": "application/json",
13
+ },
14
+ body: JSON.stringify({ baseUrl }),
15
+ });
16
+ }
17
+
18
+ export { setAppBaseUrl };
@@ -8,10 +8,10 @@ import path from "node:path";
8
8
  import { afterAll, beforeAll, expect, vi } from "vitest";
9
9
 
10
10
  // Local imports
11
- import { addMicroserviceMetadatas, runBack, runViewer } from "@ogw_front/utils/local/microservices";
12
- import { createPath, generateProjectFolderPath } from "@ogw_front/utils/local/path";
11
+ import { addMicroserviceMetadatas, runBack, runViewer } from "@ogw_server/utils/microservices";
12
+ import { createPath, generateProjectFolderPath } from "@ogw_server/utils/path";
13
13
  import { Status } from "@ogw_front/utils/status";
14
- import { appMode } from "@ogw_front/utils/local/app_mode";
14
+ import { appMode } from "@ogw_shared/app_mode";
15
15
  import { importFile } from "@ogw_front/utils/import_workflow";
16
16
  import { setupActivePinia } from "@ogw_tests/utils";
17
17
  import { useBackStore } from "@ogw_front/stores/back";
@@ -6,7 +6,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
6
6
  // Local imports
7
7
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
8
8
  import { Status } from "@ogw_front/utils/status";
9
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
9
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
10
10
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
11
11
  import { isMeshCellsVertexAttributeValid } from "@ogw_internal/stores/data_style/mesh/cells/vertex";
12
12
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
@@ -5,7 +5,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
5
5
  // Local imports
6
6
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
7
7
  import { Status } from "@ogw_front/utils/status";
8
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
8
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
9
9
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
10
10
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
11
11
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -5,7 +5,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
5
5
  // Local imports
6
6
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
7
7
  import { Status } from "@ogw_front/utils/status";
8
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
8
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
9
9
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
10
10
  import { useViewerStore } from "@ogw_front/stores/viewer";
11
11
 
@@ -5,7 +5,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
5
5
  // Local imports
6
6
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
7
7
  import { Status } from "@ogw_front/utils/status";
8
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
8
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
9
9
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
10
10
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
11
11
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -5,7 +5,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
5
5
  // Local imports
6
6
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
7
7
  import { Status } from "@ogw_front/utils/status";
8
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
8
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
9
9
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
10
10
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
11
11
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -5,7 +5,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
5
5
  // Local imports
6
6
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
7
7
  import { Status } from "@ogw_front/utils/status";
8
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
8
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
9
9
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
10
10
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
11
11
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -6,7 +6,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
6
6
  // Local imports
7
7
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
8
8
  import { Status } from "@ogw_front/utils/status";
9
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
9
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
10
10
  import { useDataStore } from "@ogw_front/stores/data";
11
11
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
12
12
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -5,7 +5,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
5
5
  // Local imports
6
6
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
7
7
  import { Status } from "@ogw_front/utils/status";
8
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
8
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
9
9
  import { useDataStore } from "@ogw_front/stores/data";
10
10
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
11
11
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -5,7 +5,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
5
5
  // Local imports
6
6
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
7
7
  import { Status } from "@ogw_front/utils/status";
8
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
8
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
9
9
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
10
10
  import { useViewerStore } from "@ogw_front/stores/viewer";
11
11
 
@@ -5,7 +5,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
5
5
  // Local imports
6
6
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
7
7
  import { Status } from "@ogw_front/utils/status";
8
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
8
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
9
9
  import { useDataStore } from "@ogw_front/stores/data";
10
10
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
11
11
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -6,7 +6,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
6
6
  // Local imports
7
7
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
8
8
  import { Status } from "@ogw_front/utils/status";
9
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
9
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
10
10
  import { useDataStore } from "@ogw_front/stores/data";
11
11
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
12
12
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -5,7 +5,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
5
5
  // Local imports
6
6
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
7
7
  import { Status } from "@ogw_front/utils/status";
8
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
8
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
9
9
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
10
10
  import { useViewerStore } from "@ogw_front/stores/viewer";
11
11
 
@@ -6,7 +6,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
6
6
  // Local imports
7
7
  import { beforeAllTimeout, setupIntegrationTests } from "@ogw_tests/integration/setup";
8
8
  import { Status } from "@ogw_front/utils/status";
9
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
9
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
10
10
  import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
11
11
  import { isModelSurfacesPolygonAttributeValid } from "@ogw_internal/stores/data_style/model/surfaces/polygon";
12
12
  import { isModelSurfacesVertexAttributeValid } from "@ogw_internal/stores/data_style/model/surfaces/vertex";
@@ -7,7 +7,7 @@ import opengeodeweb_viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb
7
7
  // Local imports
8
8
  import { beforeAllTimeout, runMicroservices } from "@ogw_tests/integration/setup";
9
9
  import { Status } from "@ogw_front/utils/status";
10
- import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
10
+ import { cleanupBackend } from "@ogw_server/utils/cleanup";
11
11
  import { setupActivePinia } from "@ogw_tests/utils";
12
12
  import { useViewerStore } from "@ogw_front/stores/viewer";
13
13
 
@@ -5,7 +5,7 @@
5
5
  import { beforeEach, describe, expect, test, vi } from "vitest";
6
6
 
7
7
  import { exportProject, importProject } from "@ogw_front/composables/project_manager";
8
- import { appMode } from "@ogw_front/utils/local/app_mode";
8
+ import { appMode } from "@ogw_shared/app_mode";
9
9
  import { setupActivePinia } from "@ogw_tests/utils";
10
10
 
11
11
  // Constants
@@ -5,7 +5,7 @@ import { registerEndpoint } from "@nuxt/test-utils/runtime";
5
5
 
6
6
  // Local imports
7
7
  import { Status } from "@ogw_front/utils/status";
8
- import { appMode } from "@ogw_front/utils/local/app_mode";
8
+ import { appMode } from "@ogw_shared/app_mode";
9
9
  import { setupActivePinia } from "@ogw_tests/utils";
10
10
  import { useBackStore } from "@ogw_front/stores/back";
11
11
  import { useInfraStore } from "@ogw_front/stores/infra";
@@ -38,16 +38,21 @@ describe("cloud store", () => {
38
38
  const cloudStore = useCloudStore();
39
39
  const feedbackStore = useFeedbackStore();
40
40
 
41
- registerEndpoint("/api/serverless/run_cloud", {
41
+ registerEndpoint("https://localhost:443/server/api/serverless/run_cloud", {
42
42
  method: "POST",
43
43
  handler: postFakeCall,
44
44
  });
45
45
 
46
- postFakeCall.mockReturnValue({
47
- url: "http://test.com",
46
+ registerEndpoint("https://test.com:443/server/api/microservice/app/set_app_base_url", {
47
+ method: "POST",
48
+ handler: () => console.log("coucou from endpoint"),
48
49
  });
49
50
 
50
- await cloudStore.launch("", "", false);
51
+ postFakeCall.mockReturnValue({
52
+ url: "test.com",
53
+ });
54
+ const email = "noreply@example.com";
55
+ await cloudStore.launch(email);
51
56
 
52
57
  expect(cloudStore.status).toBe(Status.CONNECTED);
53
58
  expect(feedbackStore.server_error).toBe(false);
@@ -58,7 +63,7 @@ describe("cloud store", () => {
58
63
  const cloudStore = useCloudStore();
59
64
  const feedbackStore = useFeedbackStore();
60
65
 
61
- registerEndpoint("/api/serverless/run_cloud", {
66
+ registerEndpoint("https://localhost:443/server/api/serverless/run_cloud", {
62
67
  method: "POST",
63
68
  handler: postFakeCall,
64
69
  });
@@ -69,8 +74,8 @@ describe("cloud store", () => {
69
74
  statusMessage: "Internal Server Error",
70
75
  });
71
76
  });
72
-
73
- await expect(cloudStore.launch("", "", false)).rejects.toThrow("500 Internal Server Error");
77
+ const email = "noreply@example.com";
78
+ await expect(cloudStore.launch(email)).rejects.toThrow("500 Internal Server Error");
74
79
 
75
80
  expect(cloudStore.status).toBe(Status.NOT_CONNECTED);
76
81
  expect(feedbackStore.server_error).toBe(true);
@@ -4,7 +4,7 @@ import { registerEndpoint } from "@nuxt/test-utils/runtime";
4
4
 
5
5
  // Local imports
6
6
  import { Status } from "@ogw_front/utils/status";
7
- import { appMode } from "@ogw_front/utils/local/app_mode";
7
+ import { appMode } from "@ogw_shared/app_mode";
8
8
  import { setupActivePinia } from "@ogw_tests/utils";
9
9
  import { useBackStore } from "@ogw_front/stores/back";
10
10
  import { useInfraStore } from "@ogw_front/stores/infra";
@@ -291,7 +291,7 @@ describe("infra store", () => {
291
291
 
292
292
  infraStore.app_mode = appMode.CLOUD;
293
293
  const url = "test.com";
294
- registerEndpoint("/api/serverless/run_cloud", {
294
+ registerEndpoint("https://localhost:443/server/api/serverless/run_cloud", {
295
295
  method: "POST",
296
296
  handler: () => ({ url }),
297
297
  });
@@ -3,7 +3,7 @@ import { afterAll, beforeAll, beforeEach, describe, expect, expectTypeOf, test,
3
3
 
4
4
  import { WebSocket } from "ws";
5
5
  // Local imports
6
- import { appMode } from "@ogw_front/utils/local/app_mode";
6
+ import { appMode } from "@ogw_shared/app_mode";
7
7
  import { setupActivePinia } from "@ogw_tests/utils";
8
8
  import { useInfraStore } from "@ogw_front/stores/infra";
9
9
  import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -15,13 +15,13 @@ const CI_WORKERS = 2;
15
15
  const globalRetry = process.env.CI ? RETRIES : DEFAULT_RETRY;
16
16
  const maxWorkers = process.env.CI ? CI_WORKERS : 3;
17
17
 
18
+ const aliases = {
19
+ "@ogw_tests": path.resolve(__dirname, "."),
20
+ "@geode/opengeodeweb-front/shared": path.resolve(__dirname, "..", "shared"),
21
+ };
22
+
18
23
  // oxlint-disable-next-line import/no-default-export
19
24
  export default defineConfig({
20
- resolve: {
21
- alias: {
22
- "@ogw_tests": path.resolve(__dirname, "."),
23
- },
24
- },
25
25
  test: {
26
26
  setupFiles: [path.resolve(__dirname, "./setup_indexeddb.js")],
27
27
  projects: [
@@ -32,6 +32,7 @@ export default defineConfig({
32
32
  include: ["tests/unit/**/*.test.js"],
33
33
  globals: true,
34
34
  environment: "nuxt",
35
+ alias: aliases,
35
36
  testTimeout: TIMEOUTS.unit,
36
37
  setupFiles: [path.resolve(__dirname, "./setup_indexeddb.js")],
37
38
  server: {
@@ -49,6 +50,7 @@ export default defineConfig({
49
50
  include: ["tests/integration/**/*.test.js"],
50
51
  globals: true,
51
52
  environment: "nuxt",
53
+ alias: aliases,
52
54
  maxWorkers,
53
55
  testTimeout: TIMEOUTS.integration,
54
56
  setupFiles: [path.resolve(__dirname, "./setup_indexeddb.js")],
File without changes
File without changes
File without changes