@geode/opengeodeweb-front 10.35.0-rc.4 → 10.35.0-rc.6
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/server/utils/app_config.js +4 -3
- package/.build/server/utils/cleanup.js +17 -16
- package/.build/server/utils/cloud.js +2 -1
- package/.build/server/utils/microservices.js +12 -11
- package/.build/server/utils/path.js +12 -11
- package/.build/server/utils/scripts.js +12 -11
- package/.build/server/utils/server.js +4 -3
- package/.build/shared/scripts.js +6 -5
- package/.build/shared/utils/call_schema.js +2 -1
- package/.build/shared/utils/fetch_schema.js +2 -1
- package/.build/shared/utils/file.js +2 -1
- package/app/components/InfraConnected.vue +0 -1
- package/app/components/Viewer/ContextMenu/InfoCard.vue +2 -1
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +2 -1
- package/app/composables/hover_highlight.ts +3 -2
- package/app/composables/project_manager.ts +0 -1
- package/app/composables/run_function_when_microservices_connected.ts +0 -2
- package/app/composables/use_adaptive_styles.ts +2 -1
- package/app/composables/use_quick_colormap.ts +2 -1
- package/app/plugins/consola_plain_logs.client.ts +46 -0
- package/app/stores/api.ts +3 -2
- package/app/stores/app.ts +3 -1
- package/app/stores/app_helpers/extension.ts +8 -7
- package/app/stores/cloud.ts +4 -13
- package/app/stores/treeview.ts +3 -2
- package/app/utils/cloud.ts +4 -2
- package/app/utils/extension.ts +7 -6
- package/app/utils/import_workflow.ts +3 -2
- package/app/utils/log.ts +3 -2
- package/internal/utils/api_fetch.ts +2 -1
- package/internal/utils/upload_file.ts +2 -1
- package/internal/utils/ws_client.ts +3 -2
- package/nuxt.config.ts +2 -0
- package/package.json +7 -3
- package/server/api/cloud/extensions/run.post.ts +3 -2
- package/server/api/local/app/kill.post.ts +2 -1
- package/server/api/local/app/project_folder_path.post.ts +2 -1
- package/server/api/local/app/run_back.post.ts +2 -1
- package/server/api/local/app/run_viewer.post.ts +2 -1
- package/server/api/local/extensions/kill.post.ts +3 -2
- package/server/api/local/extensions/run.post.ts +2 -2
- package/server/api/microservice/app/get_is_app_ready.get.ts +3 -2
- package/server/api/microservice/app/set_app_base_url.post.ts +3 -2
- package/server/api/microservice/app/set_back_base_url.post.ts +2 -1
- package/server/api/microservice/app/set_is_app_ready.post.ts +3 -2
- package/server/api/microservice/app/set_viewer_base_url.post.ts +2 -1
- package/server/api/microservice/extensions/download.post.ts +3 -2
- package/server/utils/app_config.ts +4 -3
- package/server/utils/cleanup.ts +17 -16
- package/server/utils/cloud.ts +3 -1
- package/server/utils/extension.ts +4 -3
- package/server/utils/microservices.ts +12 -11
- package/server/utils/path.ts +12 -11
- package/server/utils/scripts.ts +12 -11
- package/server/utils/server.ts +4 -3
- package/shared/scripts.ts +6 -5
- package/shared/utils/call_schema.ts +2 -1
- package/shared/utils/fetch_schema.ts +3 -1
- package/shared/utils/file.ts +2 -1
|
@@ -2,11 +2,12 @@ import path from "node:path";
|
|
|
2
2
|
import { unlink } from "node:fs/promises";
|
|
3
3
|
import Conf from "conf";
|
|
4
4
|
import StreamZip from "node-stream-zip";
|
|
5
|
+
import { consola } from "consola";
|
|
5
6
|
import sanitize from "sanitize-filename";
|
|
6
7
|
//#region server/utils/app_config.ts
|
|
7
8
|
function projectConf(projectName) {
|
|
8
9
|
const projectConfig = new Conf({ projectName });
|
|
9
|
-
|
|
10
|
+
consola.debug(projectConf.name, { projectConfig });
|
|
10
11
|
return projectConfig;
|
|
11
12
|
}
|
|
12
13
|
function confFolderPath(projectName) {
|
|
@@ -30,9 +31,9 @@ async function removeExtensionFromConf(projectName, extensionId) {
|
|
|
30
31
|
const projectConfig = projectConf(projectName);
|
|
31
32
|
const extensionArchivePath = extensionPathFromConf(projectName, extensionId);
|
|
32
33
|
await unlink(extensionArchivePath);
|
|
33
|
-
|
|
34
|
+
consola.info(`${extensionArchivePath} was deleted`);
|
|
34
35
|
projectConfig.delete(`extensions.${extensionId}`);
|
|
35
|
-
|
|
36
|
+
consola.info(`${extensionId} was deleted from ${projectName} config`);
|
|
36
37
|
}
|
|
37
38
|
function isExtensionMetadata(value) {
|
|
38
39
|
return typeof value === "object" && value !== null && "id" in value && typeof value.id === "string";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { consola } from "consola";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import { setTimeout } from "node:timers/promises";
|
|
4
5
|
import { WebSocket } from "ws";
|
|
@@ -8,19 +9,19 @@ import { rimraf } from "rimraf";
|
|
|
8
9
|
const MAX_DELETE_FOLDER_RETRIES = 5;
|
|
9
10
|
async function deleteFolderRecursive(folderPath) {
|
|
10
11
|
if (!fs.existsSync(folderPath)) {
|
|
11
|
-
|
|
12
|
+
consola.info(`Folder ${folderPath} does not exist.`);
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
for (let i = 0; i <= MAX_DELETE_FOLDER_RETRIES; i += 1) try {
|
|
15
|
-
|
|
16
|
+
consola.info(`Deleting folder: ${folderPath}`);
|
|
16
17
|
await rimraf(folderPath);
|
|
17
|
-
|
|
18
|
+
consola.info(`Deleted folder: ${folderPath}`);
|
|
18
19
|
return;
|
|
19
20
|
} catch (error) {
|
|
20
|
-
|
|
21
|
+
consola.error(`Error deleting folder ${folderPath}:`, error);
|
|
21
22
|
const DELAY = 1e3 * (i + 1);
|
|
22
23
|
await setTimeout(DELAY);
|
|
23
|
-
|
|
24
|
+
consola.info("Retrying delete folder");
|
|
24
25
|
}
|
|
25
26
|
throw new Error(`Failed to delete folder ${folderPath} after ${MAX_DELETE_FOLDER_RETRIES} retries`);
|
|
26
27
|
}
|
|
@@ -28,7 +29,7 @@ function isErrorWithMessage(error) {
|
|
|
28
29
|
return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
|
|
29
30
|
}
|
|
30
31
|
async function killHttpMicroservice(microservice) {
|
|
31
|
-
|
|
32
|
+
consola.debug("killHttpMicroservice", { ...microservice });
|
|
32
33
|
const failMessage = `Failed to kill ${microservice.name}`;
|
|
33
34
|
async function do_kill() {
|
|
34
35
|
if (microservice.url === void 0) return;
|
|
@@ -36,7 +37,7 @@ async function killHttpMicroservice(microservice) {
|
|
|
36
37
|
await fetch(microservice.url, { method: microservice.method });
|
|
37
38
|
} catch (error) {
|
|
38
39
|
const message = isErrorWithMessage(error) ? error.message : String(error);
|
|
39
|
-
|
|
40
|
+
consola.info(`Expected error during kill of ${microservice.name}:`, message);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
await pTimeout(do_kill(), {
|
|
@@ -45,7 +46,7 @@ async function killHttpMicroservice(microservice) {
|
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
async function killWebsocketMicroservice(microservice) {
|
|
48
|
-
|
|
49
|
+
consola.debug("killWebsocketMicroservice", { ...microservice });
|
|
49
50
|
const failMessage = `Failed to kill ${microservice.name}`;
|
|
50
51
|
const successMessage = `Disconnected from ${microservice.name} WebSocket server`;
|
|
51
52
|
async function do_kill() {
|
|
@@ -54,7 +55,7 @@ async function killWebsocketMicroservice(microservice) {
|
|
|
54
55
|
await new Promise((resolve) => {
|
|
55
56
|
const socket = new WebSocket(socketUrl);
|
|
56
57
|
socket.on("open", () => {
|
|
57
|
-
|
|
58
|
+
consola.info("Connected to WebSocket server");
|
|
58
59
|
socket.send(JSON.stringify({
|
|
59
60
|
id: "system:hello",
|
|
60
61
|
method: "wslink.hello",
|
|
@@ -63,23 +64,23 @@ async function killWebsocketMicroservice(microservice) {
|
|
|
63
64
|
});
|
|
64
65
|
socket.on("message", (data) => {
|
|
65
66
|
const message = data.toString();
|
|
66
|
-
|
|
67
|
+
consola.debug("Received from server:", message);
|
|
67
68
|
if (message.includes("hello")) {
|
|
68
69
|
socket.send(JSON.stringify({
|
|
69
70
|
id: "application.exit",
|
|
70
71
|
method: "application.exit"
|
|
71
72
|
}));
|
|
72
|
-
|
|
73
|
+
consola.info(successMessage);
|
|
73
74
|
socket.close();
|
|
74
75
|
resolve();
|
|
75
76
|
}
|
|
76
77
|
});
|
|
77
78
|
socket.on("close", () => {
|
|
78
|
-
|
|
79
|
+
consola.info(successMessage);
|
|
79
80
|
resolve();
|
|
80
81
|
});
|
|
81
82
|
socket.on("error", (error) => {
|
|
82
|
-
|
|
83
|
+
consola.error("WebSocket error:", error);
|
|
83
84
|
socket.close();
|
|
84
85
|
resolve();
|
|
85
86
|
});
|
|
@@ -99,7 +100,7 @@ async function killMicroservice(microservice) {
|
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
async function killMicroservices(microservices) {
|
|
102
|
-
|
|
103
|
+
consola.debug("killMicroservices", { microservices });
|
|
103
104
|
const results = await Promise.allSettled(microservices.map(async (microservice) => {
|
|
104
105
|
await killMicroservice(microservice);
|
|
105
106
|
}));
|
|
@@ -112,7 +113,7 @@ function isMicroservicesMetadatas(value) {
|
|
|
112
113
|
return typeof value === "object" && value !== null && Array.isArray(value.microservices);
|
|
113
114
|
}
|
|
114
115
|
function projectMicroservices(projectFolderPath) {
|
|
115
|
-
|
|
116
|
+
consola.debug("projectMicroservices", { projectFolderPath });
|
|
116
117
|
const filePath = microservicesMetadatasPath(projectFolderPath);
|
|
117
118
|
if (!fs.existsSync(filePath)) fs.writeFileSync(filePath, JSON.stringify({ microservices: [] }, void 0, 2), "utf8");
|
|
118
119
|
const parsed = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
@@ -121,7 +122,7 @@ function projectMicroservices(projectFolderPath) {
|
|
|
121
122
|
}
|
|
122
123
|
async function cleanupBackend(projectFolderPath) {
|
|
123
124
|
if (!fs.existsSync(projectFolderPath)) {
|
|
124
|
-
|
|
125
|
+
consola.info(`Folder ${projectFolderPath} does not exist. Skipping cleanup.`);
|
|
125
126
|
return;
|
|
126
127
|
}
|
|
127
128
|
await killMicroservices(projectMicroservices(projectFolderPath));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { consola } from "consola";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import { execFileSync } from "node:child_process";
|
|
4
5
|
//#region server/utils/cloud.ts
|
|
@@ -19,7 +20,7 @@ stderr_logfile_maxbytes=0
|
|
|
19
20
|
execFileSync("supervisorctl", ["reread"]);
|
|
20
21
|
execFileSync("supervisorctl", ["update"]);
|
|
21
22
|
const stdout = execFileSync("supervisorctl", ["start", name]);
|
|
22
|
-
|
|
23
|
+
consola.info("addSupervisorProgram", stdout);
|
|
23
24
|
}
|
|
24
25
|
function buildLocationBlock(routePath, port) {
|
|
25
26
|
if (!routePath.startsWith("/") || !routePath.endsWith("/")) throw new Error(`routePath must start and end with '/', got: ${routePath}`);
|
|
@@ -3,6 +3,7 @@ import { addNginxLocation, addSupervisorProgram } from "./cloud.js";
|
|
|
3
3
|
import { getAvailablePort, waitForReady } from "./scripts.js";
|
|
4
4
|
import { executablePath } from "./path.js";
|
|
5
5
|
import path from "node:path";
|
|
6
|
+
import { consola } from "consola";
|
|
6
7
|
import fs from "node:fs";
|
|
7
8
|
import child_process from "node:child_process";
|
|
8
9
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json" with { type: "json" };
|
|
@@ -13,7 +14,7 @@ const MAX_PORT_RETRIES = 1;
|
|
|
13
14
|
const DEFAULT_RUN_ARGS = { projectFolderPath: "" };
|
|
14
15
|
async function runScript(execPath, execName, args, expectedResponse, timeoutSeconds = DEFAULT_TIMEOUT_SECONDS) {
|
|
15
16
|
const command = executablePath(execPath, execName);
|
|
16
|
-
|
|
17
|
+
consola.debug("runScript", command, args);
|
|
17
18
|
const child = child_process.spawn(command, args, { stdio: [
|
|
18
19
|
"ignore",
|
|
19
20
|
"pipe",
|
|
@@ -21,7 +22,7 @@ async function runScript(execPath, execName, args, expectedResponse, timeoutSeco
|
|
|
21
22
|
] });
|
|
22
23
|
child.name = command.replace(/^.*[\\/]/u, "");
|
|
23
24
|
child.on("spawn", () => {
|
|
24
|
-
|
|
25
|
+
consola.info(`[${child.name}] spawned, pid=${child.pid}`);
|
|
25
26
|
});
|
|
26
27
|
const controller = new AbortController();
|
|
27
28
|
const timer = setTimeout(() => {
|
|
@@ -65,16 +66,16 @@ async function runBack(execName, execPath, args = DEFAULT_RUN_ARGS, attempts = 0
|
|
|
65
66
|
try {
|
|
66
67
|
port = await getAvailablePort();
|
|
67
68
|
const executableArgs = backArgs(args, port);
|
|
68
|
-
|
|
69
|
+
consola.debug("runBack", execPath, execName, executableArgs);
|
|
69
70
|
await runScript(execPath, execName, executableArgs, "Serving Flask app");
|
|
70
71
|
return port;
|
|
71
72
|
} catch (error) {
|
|
72
73
|
if (!isPortInUseError(error)) {
|
|
73
|
-
|
|
74
|
+
consola.error("runBack error", error);
|
|
74
75
|
throw error;
|
|
75
76
|
}
|
|
76
77
|
if (attempts <= MAX_PORT_RETRIES) {
|
|
77
|
-
|
|
78
|
+
consola.info("Retrying runBack on conflicting port", port);
|
|
78
79
|
return await runBack(execName, execPath, args, attempts + 1);
|
|
79
80
|
}
|
|
80
81
|
}
|
|
@@ -94,16 +95,16 @@ async function runViewer(execName, execPath, args = DEFAULT_RUN_ARGS, attempts =
|
|
|
94
95
|
"--timeout",
|
|
95
96
|
"0"
|
|
96
97
|
];
|
|
97
|
-
|
|
98
|
+
consola.debug("runViewer", execPath, execName, viewerArgs);
|
|
98
99
|
await runScript(execPath, execName, viewerArgs, "Starting factory");
|
|
99
100
|
return port;
|
|
100
101
|
} catch (error) {
|
|
101
102
|
if (!isPortInUseError(error)) {
|
|
102
|
-
|
|
103
|
+
consola.error("runViewer error", error);
|
|
103
104
|
throw error;
|
|
104
105
|
}
|
|
105
106
|
if (attempts <= MAX_PORT_RETRIES) {
|
|
106
|
-
|
|
107
|
+
consola.info("Retrying runViewer on conflicting port", port);
|
|
107
108
|
return await runViewer(execName, execPath, args, attempts + 1);
|
|
108
109
|
}
|
|
109
110
|
}
|
|
@@ -115,17 +116,17 @@ async function runExtension(extensionId, execName, execPath, args = DEFAULT_RUN_
|
|
|
115
116
|
port = await getAvailablePort();
|
|
116
117
|
const executableArgs = backArgs(args, port);
|
|
117
118
|
const command = executablePath(execPath, execName);
|
|
118
|
-
|
|
119
|
+
consola.debug("runExtension", execPath, execName, executableArgs);
|
|
119
120
|
addSupervisorProgram(extensionId, command, executableArgs);
|
|
120
121
|
addNginxLocation(extensionId, port);
|
|
121
122
|
return port;
|
|
122
123
|
} catch (error) {
|
|
123
124
|
if (!isPortInUseError(error)) {
|
|
124
|
-
|
|
125
|
+
consola.error("runExtension error", error);
|
|
125
126
|
throw error;
|
|
126
127
|
}
|
|
127
128
|
if (attempts <= MAX_PORT_RETRIES) {
|
|
128
|
-
|
|
129
|
+
consola.info("Retrying runExtension on conflicting port", port);
|
|
129
130
|
return await runExtension(extensionId, execName, execPath, args, attempts + 1);
|
|
130
131
|
}
|
|
131
132
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { appMode } from "../../shared/app_mode.js";
|
|
2
2
|
import { commandExistsSync } from "./scripts.js";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { consola } from "consola";
|
|
4
5
|
import fs from "node:fs";
|
|
5
6
|
import { setTimeout } from "node:timers/promises";
|
|
6
7
|
import os from "node:os";
|
|
@@ -13,22 +14,22 @@ function executableName(execName) {
|
|
|
13
14
|
function findExecutableInDir(baseDir, execName, osExecutableName) {
|
|
14
15
|
const oneFilePath = path.join(baseDir, osExecutableName);
|
|
15
16
|
if (fs.existsSync(oneFilePath) && fs.statSync(oneFilePath).isFile()) {
|
|
16
|
-
|
|
17
|
+
consola.info(`[executablePath] Found OneFile executable: ${oneFilePath}`);
|
|
17
18
|
return oneFilePath;
|
|
18
19
|
}
|
|
19
20
|
const oneDirPath = path.join(baseDir, execName, osExecutableName);
|
|
20
21
|
if (fs.existsSync(oneDirPath) && fs.statSync(oneDirPath).isFile()) {
|
|
21
|
-
|
|
22
|
+
consola.info(`[executablePath] Found OneDir executable: ${oneDirPath}`);
|
|
22
23
|
return oneDirPath;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
consola.info(`[executablePath] Executable not found in ${baseDir} (tried OneFile and OneDir): ${execName}`);
|
|
25
26
|
}
|
|
26
27
|
function executablePath(execPath, execName) {
|
|
27
28
|
const osExecutableName = executableName(execName);
|
|
28
29
|
const resourcesPath = process.env.RESOURCES_PATH;
|
|
29
30
|
const mode = process.env.MODE;
|
|
30
31
|
const nodeEnv = process.env.NODE_ENV;
|
|
31
|
-
|
|
32
|
+
consola.debug("[executablePath]", {
|
|
32
33
|
execPath,
|
|
33
34
|
execName,
|
|
34
35
|
mode,
|
|
@@ -36,7 +37,7 @@ function executablePath(execPath, execName) {
|
|
|
36
37
|
resourcesPath
|
|
37
38
|
});
|
|
38
39
|
if (commandExistsSync(osExecutableName)) {
|
|
39
|
-
|
|
40
|
+
consola.info(`[executablePath] Found executable in PATH: ${osExecutableName}`);
|
|
40
41
|
return osExecutableName;
|
|
41
42
|
}
|
|
42
43
|
const foundAtExecPath = findExecutableInDir(execPath, execName, osExecutableName);
|
|
@@ -53,7 +54,7 @@ function executablePath(execPath, execName) {
|
|
|
53
54
|
function createPath(dirPath) {
|
|
54
55
|
if (!fs.existsSync(dirPath)) {
|
|
55
56
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
56
|
-
|
|
57
|
+
consola.info(`${dirPath} directory created successfully!`);
|
|
57
58
|
}
|
|
58
59
|
return dirPath;
|
|
59
60
|
}
|
|
@@ -67,7 +68,7 @@ async function lookForLocalExtensionDistPath(rootPath, extentionRepoName, fronte
|
|
|
67
68
|
const localExtensionPath = path.join(rootPath, "..", extentionRepoName);
|
|
68
69
|
const localExtensionDistPath = path.join(localExtensionPath, "dist");
|
|
69
70
|
if (!fs.existsSync(localExtensionDistPath)) return;
|
|
70
|
-
|
|
71
|
+
consola.info(`[extensionFrontendPath] Found existing folder: ${localExtensionDistPath}, deleting it...`);
|
|
71
72
|
fs.rmSync(localExtensionDistPath, {
|
|
72
73
|
recursive: true,
|
|
73
74
|
force: true
|
|
@@ -79,15 +80,15 @@ async function lookForLocalExtensionDistPath(rootPath, extentionRepoName, fronte
|
|
|
79
80
|
const MILLISECONDS_PER_RETRY = 1e3;
|
|
80
81
|
for (let i = 0; i <= MAX_DELETE_FOLDER_RETRIES; i += 1) {
|
|
81
82
|
if (fs.existsSync(rebuiltFilePath)) {
|
|
82
|
-
|
|
83
|
+
consola.info(`Found rebuilt file: ${rebuiltFilePath}`);
|
|
83
84
|
return rebuiltFilePath;
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
+
consola.info(`Waiting for rebuild... attempt ${i}/${MAX_DELETE_FOLDER_RETRIES}`);
|
|
86
87
|
await setTimeout(MILLISECONDS_PER_RETRY);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
async function extensionFrontendPath(unzippedExtensionPath, frontendFile, rootPath, extensionId) {
|
|
90
|
-
|
|
91
|
+
consola.debug("[extensionFrontendPath]", {
|
|
91
92
|
unzippedExtensionPath,
|
|
92
93
|
frontendFile,
|
|
93
94
|
rootPath,
|
|
@@ -101,7 +102,7 @@ async function extensionFrontendPath(unzippedExtensionPath, frontendFile, rootPa
|
|
|
101
102
|
}
|
|
102
103
|
function extensionBackendPath(unzippedExtensionPath, backendExecutableName) {
|
|
103
104
|
const backendExecutablePath = path.join(unzippedExtensionPath, executableName(backendExecutableName));
|
|
104
|
-
|
|
105
|
+
consola.debug("runExtensions", { backendExecutablePath });
|
|
105
106
|
return backendExecutablePath;
|
|
106
107
|
}
|
|
107
108
|
//#endregion
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { appMode } from "../../shared/app_mode.js";
|
|
2
2
|
import { setAppBaseUrl } from "../../shared/scripts.js";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { consola } from "consola";
|
|
4
5
|
import fs from "node:fs";
|
|
5
6
|
import child_process from "node:child_process";
|
|
6
7
|
import { on } from "node:events";
|
|
@@ -56,23 +57,23 @@ async function waitForReady(child, expectedResponse, signal) {
|
|
|
56
57
|
function becomeReady() {
|
|
57
58
|
cleanup();
|
|
58
59
|
readlineStdout.on("line", (line) => {
|
|
59
|
-
|
|
60
|
+
consola.info(`[${child.name}] ${line}`);
|
|
60
61
|
});
|
|
61
62
|
readlineStderr.on("line", (line) => {
|
|
62
|
-
|
|
63
|
+
consola.info(`[${child.name}] ${line}`);
|
|
63
64
|
});
|
|
64
65
|
child.once("close", (code) => {
|
|
65
|
-
|
|
66
|
+
consola.info(`[${child.name}] exited with code ${code}`);
|
|
66
67
|
});
|
|
67
68
|
resolve(child);
|
|
68
69
|
}
|
|
69
70
|
onLine = (lineOutput) => {
|
|
70
|
-
|
|
71
|
+
consola.info(`[${child.name}] ${lineOutput}`);
|
|
71
72
|
recordOutput(lineOutput);
|
|
72
73
|
if (lineOutput.includes(expectedResponse)) becomeReady();
|
|
73
74
|
};
|
|
74
75
|
onErrLine = (line) => {
|
|
75
|
-
|
|
76
|
+
consola.info(`[${child.name}] ${line}`);
|
|
76
77
|
recordOutput(line);
|
|
77
78
|
if (line.includes(expectedResponse)) becomeReady();
|
|
78
79
|
};
|
|
@@ -81,7 +82,7 @@ async function waitForReady(child, expectedResponse, signal) {
|
|
|
81
82
|
reject(err);
|
|
82
83
|
};
|
|
83
84
|
onClose = (code) => {
|
|
84
|
-
|
|
85
|
+
consola.info(`[${child.name}] exited with code ${code}`);
|
|
85
86
|
cleanup();
|
|
86
87
|
reject(/* @__PURE__ */ new Error(`[${child.name}] exited with code ${code} before becoming ready.${recentOutput ? `\nRecent output:\n${recentOutput}` : ""}`));
|
|
87
88
|
};
|
|
@@ -98,19 +99,19 @@ async function waitForReady(child, expectedResponse, signal) {
|
|
|
98
99
|
}
|
|
99
100
|
async function waitNuxt(nuxtProcess) {
|
|
100
101
|
nuxtProcess.stderr.on("data", (data) => {
|
|
101
|
-
|
|
102
|
+
consola.info("Nuxt STDERR:", data.toString().trim());
|
|
102
103
|
});
|
|
103
104
|
nuxtProcess.on("close", (code) => {
|
|
104
|
-
|
|
105
|
+
consola.info(`Nuxt process closed with code ${code}`);
|
|
105
106
|
});
|
|
106
107
|
for await (const [data] of on(nuxtProcess.stdout, "data")) {
|
|
107
108
|
const output = String(data);
|
|
108
|
-
|
|
109
|
+
consola.info("Nuxt STDOUT:", output.trim());
|
|
109
110
|
const port = /Listening on http:\/\/\[::\]:(?<port>\d+)/u.exec(output)?.groups?.port;
|
|
110
111
|
if (port !== void 0) {
|
|
111
|
-
|
|
112
|
+
consola.info("Nuxt listening on port", port);
|
|
112
113
|
nuxtProcess.stdout.on("data", (newData) => {
|
|
113
|
-
|
|
114
|
+
consola.info("Nuxt STDOUT:", newData.toString().trim());
|
|
114
115
|
});
|
|
115
116
|
return port;
|
|
116
117
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { consola } from "consola";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import JSZip from "jszip";
|
|
4
5
|
import { extract } from "tar";
|
|
@@ -28,15 +29,15 @@ async function extractTarArchive(archivePath, outputDir) {
|
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
async function unzipFile(zipFilePath, outputDir = zipFilePath.replace(/\.[^/.]+$/u, "")) {
|
|
31
|
-
|
|
32
|
+
consola.info("Unzipping file...", zipFilePath, outputDir);
|
|
32
33
|
try {
|
|
33
34
|
await fs.promises.mkdir(outputDir, { recursive: true });
|
|
34
35
|
if (TAR_ARCHIVE_PATTERN.test(zipFilePath)) await extractTarArchive(zipFilePath, outputDir);
|
|
35
36
|
else await extractZipArchive(zipFilePath, outputDir);
|
|
36
|
-
|
|
37
|
+
consola.info("Extraction complete!");
|
|
37
38
|
return outputDir;
|
|
38
39
|
} catch (error) {
|
|
39
|
-
|
|
40
|
+
consola.error("Error unzipping file:", error);
|
|
40
41
|
throw error;
|
|
41
42
|
}
|
|
42
43
|
}
|
package/.build/shared/scripts.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { fetchSchema } from "./utils/fetch_schema.js";
|
|
2
2
|
import { api } from "../opengeodeweb_front_schemas.js";
|
|
3
|
+
import { consola } from "consola";
|
|
3
4
|
//#region shared/scripts.ts
|
|
4
5
|
async function setAppBaseUrl(appBaseUrl) {
|
|
5
|
-
|
|
6
|
+
consola.info("[API] setAppBaseUrl", appBaseUrl);
|
|
6
7
|
const schema = api.microservice.app.set_app_base_url;
|
|
7
8
|
return await fetchSchema({
|
|
8
9
|
schema,
|
|
@@ -11,7 +12,7 @@ async function setAppBaseUrl(appBaseUrl) {
|
|
|
11
12
|
});
|
|
12
13
|
}
|
|
13
14
|
async function setBackBaseUrl(appBaseUrl, backBaseUrl) {
|
|
14
|
-
|
|
15
|
+
consola.info("[API] setBackBaseUrl", appBaseUrl, backBaseUrl);
|
|
15
16
|
const schema = api.microservice.app.set_back_base_url;
|
|
16
17
|
return await fetchSchema({
|
|
17
18
|
schema,
|
|
@@ -20,7 +21,7 @@ async function setBackBaseUrl(appBaseUrl, backBaseUrl) {
|
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
23
|
async function setViewerBaseUrl(appBaseUrl, viewerBaseUrl) {
|
|
23
|
-
|
|
24
|
+
consola.info("[API] setViewerBaseUrl", appBaseUrl, viewerBaseUrl);
|
|
24
25
|
const schema = api.microservice.app.set_viewer_base_url;
|
|
25
26
|
return await fetchSchema({
|
|
26
27
|
schema,
|
|
@@ -29,7 +30,7 @@ async function setViewerBaseUrl(appBaseUrl, viewerBaseUrl) {
|
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
async function setIsAppReady(appBaseUrl, isReady) {
|
|
32
|
-
|
|
33
|
+
consola.info("[API] setIsAppReady", isReady);
|
|
33
34
|
const schema = api.microservice.app.set_is_app_ready;
|
|
34
35
|
return await fetchSchema({
|
|
35
36
|
schema,
|
|
@@ -38,7 +39,7 @@ async function setIsAppReady(appBaseUrl, isReady) {
|
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
async function getIsAppReady(appBaseUrl) {
|
|
41
|
-
|
|
42
|
+
consola.info("[API] getIsAppReady");
|
|
42
43
|
const schema = api.microservice.app.get_is_app_ready;
|
|
43
44
|
return await fetchSchema({
|
|
44
45
|
schema,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { validateSchema } from "./validate_schema.js";
|
|
2
2
|
import { callRaw } from "./call_raw.js";
|
|
3
|
+
import { consola } from "consola";
|
|
3
4
|
//#region shared/utils/call_schema.ts
|
|
4
5
|
const ERROR_400 = 400;
|
|
5
6
|
async function callSchema({ schema, params = {}, client, timeout }, { request_error_function, response_function, response_error_function, validation_error_function } = {}) {
|
|
6
7
|
const { valid, error: schema_error } = validateSchema(schema, params);
|
|
7
8
|
if (!valid) {
|
|
8
|
-
if (process.env.NODE_ENV !== "production")
|
|
9
|
+
if (process.env.NODE_ENV !== "production") consola.error("Bad request", schema_error, schema, params);
|
|
9
10
|
if (validation_error_function) validation_error_function({
|
|
10
11
|
code: ERROR_400,
|
|
11
12
|
name: "Bad request",
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { fetchRaw } from "./fetch_raw.js";
|
|
2
2
|
import { validateSchema } from "./validate_schema.js";
|
|
3
|
+
import { consola } from "consola";
|
|
3
4
|
//#region shared/utils/fetch_schema.ts
|
|
4
5
|
const ERROR_400 = 400;
|
|
5
6
|
async function fetchSchema({ schema, params = {}, baseURL, headers, timeout, expectEvent = false }, { request_error_function, response_function, response_error_function, validation_error_function } = {}) {
|
|
6
7
|
const { valid, error: schema_error } = validateSchema(schema, params);
|
|
7
8
|
if (!valid) {
|
|
8
|
-
if (process.env.NODE_ENV !== "production")
|
|
9
|
+
if (process.env.NODE_ENV !== "production") consola.error("Bad request", schema_error, schema, params);
|
|
9
10
|
if (validation_error_function) validation_error_function({
|
|
10
11
|
code: ERROR_400,
|
|
11
12
|
name: "Bad request",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { consola } from "consola";
|
|
1
2
|
import _ from "lodash";
|
|
2
3
|
//#region shared/utils/file.ts
|
|
3
4
|
const BYTES_PER_KIBIBYTE = 1024;
|
|
4
5
|
const CHUNK_SIZE_BYTES = 8192 * BYTES_PER_KIBIBYTE;
|
|
5
6
|
function assertFile(file) {
|
|
6
|
-
|
|
7
|
+
consola.debug("[ASSERT_FILE] Asserting file", { file });
|
|
7
8
|
if (!(file instanceof File)) throw new Error("file must be an instance of File");
|
|
8
9
|
}
|
|
9
10
|
function hasBody(params) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import GlassCard from "@ogw_front/components/GlassCard.vue";
|
|
3
|
+
import { consola } from "consola";
|
|
3
4
|
import { middleTruncate } from "@ogw_front/utils/string";
|
|
4
5
|
import { useCopyToClipboard } from "@ogw_front/composables/copy_to_clipboard";
|
|
5
6
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
@@ -110,7 +111,7 @@ async function copyId(targetId: string | undefined): Promise<void> {
|
|
|
110
111
|
await copy(targetId);
|
|
111
112
|
copiedId.value = targetId;
|
|
112
113
|
} catch (error) {
|
|
113
|
-
|
|
114
|
+
consola.error("Failed to copy ID:", error);
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
|
|
@@ -4,6 +4,7 @@ import type { DisplayItem } from "@ogw_front/composables/virtual_tree";
|
|
|
4
4
|
import ObjectTreeControls from "@ogw_front/components/Viewer/ObjectTree/Base/Controls.vue";
|
|
5
5
|
import ObjectTreeItemLabel from "@ogw_front/components/Viewer/ObjectTree/Base/ItemLabel.vue";
|
|
6
6
|
import { compareSelections } from "@ogw_front/utils/treeview";
|
|
7
|
+
import { consola } from "consola";
|
|
7
8
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
8
9
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
9
10
|
import { useHoverhighlight } from "@ogw_front/composables/hover_highlight";
|
|
@@ -105,7 +106,7 @@ watch(
|
|
|
105
106
|
const hasCollections = await dataStore.hasCollectionComponents(model.id);
|
|
106
107
|
hasCollectionsMap[model.id] = hasCollections;
|
|
107
108
|
} catch (error) {
|
|
108
|
-
|
|
109
|
+
consola.error("Failed to check collections", error);
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { JsonRpcSchema } from "@ogw_shared/utils/types";
|
|
2
|
+
import { consola } from "consola";
|
|
2
3
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
3
4
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
4
5
|
import vtk_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
@@ -60,7 +61,7 @@ export function useHoverhighlight(): {
|
|
|
60
61
|
try {
|
|
61
62
|
await viewerStore.request({ schema, params });
|
|
62
63
|
} catch (error) {
|
|
63
|
-
|
|
64
|
+
consola.error(`Highlight failed for ${type} ${id}:`, error);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -95,7 +96,7 @@ export function useHoverhighlight(): {
|
|
|
95
96
|
try {
|
|
96
97
|
await viewerStore.request(request);
|
|
97
98
|
} catch (error) {
|
|
98
|
-
|
|
99
|
+
consola.error(`Unhighlight failed for ${type} ${id}:`, error);
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
|
|
@@ -3,7 +3,6 @@ import { useInfraStore } from "@ogw_front/stores/infra";
|
|
|
3
3
|
export function runFunctionWhenMicroservicesConnected(functionToRun: () => void): void {
|
|
4
4
|
const infraStore = useInfraStore();
|
|
5
5
|
const { microservices_connected } = storeToRefs(infraStore);
|
|
6
|
-
console.log("inside microservices_connected", microservices_connected.value);
|
|
7
6
|
if (microservices_connected.value) {
|
|
8
7
|
functionToRun();
|
|
9
8
|
}
|
|
@@ -11,7 +10,6 @@ export function runFunctionWhenMicroservicesConnected(functionToRun: () => void)
|
|
|
11
10
|
microservices_connected,
|
|
12
11
|
(value) => {
|
|
13
12
|
if (value) {
|
|
14
|
-
console.log("watch microservices_connected", value);
|
|
15
13
|
functionToRun();
|
|
16
14
|
}
|
|
17
15
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MaybeComputedElementRef } from "@vueuse/core";
|
|
2
|
+
import { consola } from "consola";
|
|
2
3
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
3
4
|
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
4
5
|
|
|
@@ -156,7 +157,7 @@ export function useAdaptiveStyles(
|
|
|
156
157
|
try {
|
|
157
158
|
await forceRefresh();
|
|
158
159
|
} catch (error) {
|
|
159
|
-
|
|
160
|
+
consola.error("forceRefresh failed:", error);
|
|
160
161
|
}
|
|
161
162
|
});
|
|
162
163
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { consola } from "consola";
|
|
1
2
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
2
3
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
3
4
|
|
|
@@ -46,7 +47,7 @@ export function useQuickColormap(): {
|
|
|
46
47
|
return true;
|
|
47
48
|
}
|
|
48
49
|
} catch (error) {
|
|
49
|
-
|
|
50
|
+
consola.error("Error picking colormap:", error);
|
|
50
51
|
}
|
|
51
52
|
return false;
|
|
52
53
|
}
|