@geode/opengeodeweb-front 10.44.0-rc.2 → 10.44.0-rc.4
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/cleanup.js +7 -2
- package/.build/server/utils/microservices.js +9 -81
- package/.build/server/utils/microservices_process.js +85 -0
- package/.build/server/utils/typed_handler.js +5 -1
- package/.build/server/utils/ws_client.js +7 -2
- package/.build/shared/utils/fetch_raw.js +2 -2
- package/.build/shared/utils/parse_boolean.js +2 -1
- package/app/components/ClippingPlanes.vue +22 -78
- package/app/components/DragAndDrop.vue +16 -79
- package/app/components/FileSelector.vue +9 -6
- package/app/components/HybridViewerTooltip.vue +8 -2
- package/app/components/MissingFilesSelector.vue +10 -6
- package/app/components/ObjectSelector.vue +6 -3
- package/app/components/Screenshot.vue +9 -2
- package/app/components/ThresholdCard.vue +205 -0
- package/app/components/ThresholdFilter.vue +81 -216
- package/app/components/ViewToolbar.vue +15 -231
- package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
- package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +228 -0
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
- package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
- package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +234 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
- package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +7 -5
- package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
- package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -292
- package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
- package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +13 -425
- package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
- package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +12 -10
- package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +12 -10
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +9 -5
- package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +6 -1
- package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
- package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
- package/app/components/Viewer/Options/ColorPicker.vue +4 -1
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +36 -74
- package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
- package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
- package/app/components/Viewer/Surface/PolygonsColoring.vue +231 -0
- package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
- package/app/components/csv-preview/CsvPreviewer.vue +4 -1
- package/app/composables/attribute_coloring_style.ts +8 -2
- package/app/composables/attribute_selector.ts +126 -0
- package/app/composables/clipping_slices.ts +166 -0
- package/app/composables/global_attribute_style.ts +4 -3
- package/app/composables/hover_highlight.ts +6 -5
- package/app/composables/project_manager.ts +5 -5
- package/app/composables/stepper_tree.ts +10 -2
- package/app/composables/tree_filter.ts +11 -2
- package/app/composables/tree_keyboard_nav.ts +4 -2
- package/app/composables/use_overlapping_picker.ts +5 -5
- package/app/composables/view_toolbar_options.ts +126 -0
- package/app/composables/view_toolbar_tool_options.ts +115 -0
- package/app/composables/view_toolbar_tools.ts +108 -0
- package/app/composables/virtual_tree.ts +20 -131
- package/app/composables/virtual_tree_flatten.ts +86 -0
- package/app/composables/virtual_tree_types.ts +81 -0
- package/app/stores/app.ts +8 -55
- package/app/stores/app_helpers/extension.ts +1 -1
- package/app/stores/app_helpers/registry.ts +69 -0
- package/app/stores/feedback.ts +2 -2
- package/app/stores/hybrid_viewer.ts +1 -1
- package/app/stores/menu.ts +1 -124
- package/app/stores/menu_helpers/menus_data.ts +127 -0
- package/app/stores/treeview.ts +17 -10
- package/app/stores/viewer.ts +17 -78
- package/app/stores/viewer_helpers/actions.ts +68 -0
- package/app/stores/viewer_helpers/request.ts +61 -0
- package/app/utils/clipping_planes.ts +4 -131
- package/app/utils/clipping_planes_scene.ts +131 -0
- package/app/utils/coloring_styles.ts +101 -0
- package/app/utils/default_styles/mesh_components.ts +168 -0
- package/app/utils/default_styles/meshes.ts +13 -153
- package/app/utils/default_styles/model_components.ts +170 -0
- package/app/utils/default_styles/models.ts +16 -153
- package/app/utils/drag_and_drop.ts +80 -0
- package/app/utils/extension.ts +1 -1
- package/app/utils/import_workflow.ts +6 -4
- package/app/utils/model_component_coloring.ts +46 -0
- package/app/utils/threshold.ts +33 -0
- package/app/utils/threshold_sources.ts +51 -0
- package/app/utils/upload_path.ts +15 -9
- package/internal/database/database.ts +4 -1
- package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
- package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
- package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
- package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
- package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
- package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
- package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
- package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/blocks/index.ts +12 -140
- package/internal/stores/data_style/model/blocks/polyhedron.ts +14 -10
- package/internal/stores/data_style/model/blocks/vertex.ts +14 -10
- package/internal/stores/data_style/model/common.ts +10 -119
- package/internal/stores/data_style/model/common_mutations.ts +184 -0
- package/internal/stores/data_style/model/corners/vertex.ts +14 -10
- package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
- package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/lines/edge.ts +14 -10
- package/internal/stores/data_style/model/lines/index.ts +10 -134
- package/internal/stores/data_style/model/lines/vertex.ts +14 -10
- package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
- package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/surfaces/index.ts +16 -160
- package/internal/stores/data_style/model/surfaces/polygon.ts +14 -10
- package/internal/stores/data_style/model/surfaces/vertex.ts +14 -10
- package/internal/stores/data_style/model/visibility.ts +3 -156
- package/internal/stores/data_style/model/visibility_dispatch.ts +160 -0
- package/internal/stores/data_style/state.ts +1 -181
- package/internal/stores/data_style/state_shared.ts +191 -0
- package/internal/stores/hybrid_viewer/brightness.ts +8 -2
- package/internal/stores/hybrid_viewer/camera.ts +7 -161
- package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
- package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
- package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
- package/internal/stores/hybrid_viewer/filters.ts +54 -11
- package/internal/stores/hybrid_viewer/highlight.ts +10 -9
- package/internal/stores/hybrid_viewer/ruler.ts +4 -3
- package/internal/utils/ws_client.ts +8 -1
- package/package.json +2 -2
- package/server/api/local/extensions/run.post.ts +6 -4
- package/server/utils/cleanup.ts +12 -2
- package/server/utils/microservices.ts +10 -102
- package/server/utils/microservices_process.ts +127 -0
- package/server/utils/typed_handler.ts +8 -1
- package/server/utils/ws_client.ts +15 -2
- package/shared/utils/fetch_raw.ts +2 -2
- package/shared/utils/parse_boolean.ts +4 -1
|
@@ -1,94 +1,25 @@
|
|
|
1
1
|
// Node imports
|
|
2
2
|
import child_process from "node:child_process";
|
|
3
3
|
import fs from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
5
4
|
|
|
6
5
|
// Third party imports
|
|
7
6
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json" with { type: "json" };
|
|
8
7
|
import { consola } from "consola";
|
|
9
8
|
|
|
10
9
|
// Local imports
|
|
10
|
+
import {
|
|
11
|
+
DEFAULT_RUN_ARGS,
|
|
12
|
+
MAX_PORT_RETRIES,
|
|
13
|
+
type RunArgs,
|
|
14
|
+
backArgs,
|
|
15
|
+
isPortInUseError,
|
|
16
|
+
runScript,
|
|
17
|
+
waitUntilListening,
|
|
18
|
+
} from "./microservices_process.js";
|
|
11
19
|
import { type Microservice, microservicesMetadatasPath, projectMicroservices } from "./cleanup.js";
|
|
12
|
-
import { type NamedChildProcess, getAvailablePort, waitForReady } from "./scripts.js";
|
|
13
20
|
import { addNginxLocation, addSupervisorProgram } from "./cloud.js";
|
|
14
21
|
import { executablePath } from "./path.js";
|
|
15
|
-
|
|
16
|
-
interface RunArgs {
|
|
17
|
-
projectFolderPath: string;
|
|
18
|
-
uploadFolderPath?: string;
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const MILLISECONDS_PER_SECOND = 1000;
|
|
23
|
-
const DEFAULT_TIMEOUT_SECONDS = 120;
|
|
24
|
-
const MAX_PORT_RETRIES = 1;
|
|
25
|
-
const DEFAULT_RUN_ARGS: RunArgs = { projectFolderPath: "" };
|
|
26
|
-
const LISTENING_LOG_PATTERN = /^Listening on https?:\/\/.+:\d+\/?\s*$/mu;
|
|
27
|
-
|
|
28
|
-
async function runScript(
|
|
29
|
-
execPath: string,
|
|
30
|
-
execName: string,
|
|
31
|
-
args: readonly string[],
|
|
32
|
-
expectedResponse: string,
|
|
33
|
-
timeoutSeconds = DEFAULT_TIMEOUT_SECONDS,
|
|
34
|
-
): Promise<NamedChildProcess> {
|
|
35
|
-
const command = executablePath(execPath, execName);
|
|
36
|
-
consola.debug("runScript", command, args);
|
|
37
|
-
const child = child_process.spawn(command, args, {
|
|
38
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
39
|
-
}) as NamedChildProcess;
|
|
40
|
-
child.name = command.replace(/^.*[\\/]/u, "");
|
|
41
|
-
child.on("spawn", () => {
|
|
42
|
-
consola.info(`[${child.name}] spawned, pid=${child.pid}`);
|
|
43
|
-
});
|
|
44
|
-
const controller = new AbortController();
|
|
45
|
-
const timer = setTimeout(() => {
|
|
46
|
-
controller.abort();
|
|
47
|
-
}, timeoutSeconds * MILLISECONDS_PER_SECOND);
|
|
48
|
-
if (typeof timer.unref === "function") {
|
|
49
|
-
timer.unref();
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
const result = await waitForReady(child, expectedResponse, controller.signal);
|
|
53
|
-
clearTimeout(timer);
|
|
54
|
-
return result;
|
|
55
|
-
} catch (error) {
|
|
56
|
-
clearTimeout(timer);
|
|
57
|
-
child.kill();
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function isPortInUseError(error: unknown): boolean {
|
|
63
|
-
return /EADDRINUSE|address already in use|port already in use/iu.test(String(error));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function backArgs(args: RunArgs, port: number): string[] {
|
|
67
|
-
const { projectFolderPath } = args;
|
|
68
|
-
if (!projectFolderPath) {
|
|
69
|
-
throw new Error("projectFolderPath is required");
|
|
70
|
-
}
|
|
71
|
-
const uploadFolderPath =
|
|
72
|
-
args.uploadFolderPath !== undefined && args.uploadFolderPath !== ""
|
|
73
|
-
? args.uploadFolderPath
|
|
74
|
-
: path.join(projectFolderPath, "uploads");
|
|
75
|
-
const executableArgs = [
|
|
76
|
-
"--port",
|
|
77
|
-
String(port),
|
|
78
|
-
"--project_folder_path",
|
|
79
|
-
projectFolderPath,
|
|
80
|
-
"--upload_folder_path",
|
|
81
|
-
uploadFolderPath,
|
|
82
|
-
"--allowed_origins",
|
|
83
|
-
"http://localhost:*",
|
|
84
|
-
"--timeout",
|
|
85
|
-
"0",
|
|
86
|
-
];
|
|
87
|
-
if (process.env.NODE_ENV === undefined || process.env.NODE_ENV === "development") {
|
|
88
|
-
executableArgs.push("--debug");
|
|
89
|
-
}
|
|
90
|
-
return executableArgs;
|
|
91
|
-
}
|
|
22
|
+
import { getAvailablePort } from "./scripts.js";
|
|
92
23
|
|
|
93
24
|
async function runBack(
|
|
94
25
|
execName: string,
|
|
@@ -184,29 +115,6 @@ async function runExtension(
|
|
|
184
115
|
}
|
|
185
116
|
throw new Error(`runExtension failed to run ${extensionId}`);
|
|
186
117
|
}
|
|
187
|
-
async function waitUntilListening(
|
|
188
|
-
child: child_process.ChildProcessWithoutNullStreams,
|
|
189
|
-
): Promise<void> {
|
|
190
|
-
child.stderr.on("data", (data: Buffer) => {
|
|
191
|
-
consola.info(`[${child.spawnfile}] STDERR:`, data.toString().trim());
|
|
192
|
-
});
|
|
193
|
-
child.on("close", (code) => {
|
|
194
|
-
consola.info(`[${child.spawnfile}] exited with code ${code}`);
|
|
195
|
-
});
|
|
196
|
-
// oxlint-disable-next-line typescript/no-unnecessary-condition
|
|
197
|
-
for await (const chunk of child.stdout) {
|
|
198
|
-
const output = String(chunk);
|
|
199
|
-
consola.info(`[${child.spawnfile}] STDOUT:`, output.trim());
|
|
200
|
-
if (LISTENING_LOG_PATTERN.test(output)) {
|
|
201
|
-
child.stdout.on("data", (data: Buffer) => {
|
|
202
|
-
consola.info(`[${child.spawnfile}] STDOUT:`, data.toString().trim());
|
|
203
|
-
});
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
throw new Error(`${child.spawnfile} exited before becoming ready`);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
118
|
async function runExtensionServer(entryPath: string, attempts = 0): Promise<number> {
|
|
211
119
|
let port: number | undefined = undefined;
|
|
212
120
|
try {
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Node imports
|
|
2
|
+
import child_process from "node:child_process";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
// Third party imports
|
|
6
|
+
import { consola } from "consola";
|
|
7
|
+
|
|
8
|
+
// Local imports
|
|
9
|
+
import { type NamedChildProcess, waitForReady } from "./scripts.js";
|
|
10
|
+
import { executablePath } from "./path.js";
|
|
11
|
+
|
|
12
|
+
interface RunArgs {
|
|
13
|
+
projectFolderPath: string;
|
|
14
|
+
uploadFolderPath?: string;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const MILLISECONDS_PER_SECOND = 1000;
|
|
19
|
+
const DEFAULT_TIMEOUT_SECONDS = 120;
|
|
20
|
+
const MAX_PORT_RETRIES = 1;
|
|
21
|
+
const DEFAULT_RUN_ARGS: RunArgs = { projectFolderPath: "" };
|
|
22
|
+
const LISTENING_LOG_PATTERN = /^Listening on https?:\/\/.+:\d+\/?\s*$/mu;
|
|
23
|
+
|
|
24
|
+
async function runScript(
|
|
25
|
+
execPath: string,
|
|
26
|
+
execName: string,
|
|
27
|
+
args: readonly string[],
|
|
28
|
+
expectedResponse: string,
|
|
29
|
+
timeoutSeconds = DEFAULT_TIMEOUT_SECONDS,
|
|
30
|
+
): Promise<NamedChildProcess> {
|
|
31
|
+
const command = executablePath(execPath, execName);
|
|
32
|
+
consola.debug("runScript", command, args);
|
|
33
|
+
const child = child_process.spawn(command, args, {
|
|
34
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
35
|
+
}) as NamedChildProcess;
|
|
36
|
+
child.name = command.replace(/^.*[\\/]/u, "");
|
|
37
|
+
child.on("spawn", () => {
|
|
38
|
+
consola.info(`[${child.name}] spawned, pid=${child.pid}`);
|
|
39
|
+
});
|
|
40
|
+
const controller = new AbortController();
|
|
41
|
+
const timer = setTimeout(() => {
|
|
42
|
+
controller.abort();
|
|
43
|
+
}, timeoutSeconds * MILLISECONDS_PER_SECOND);
|
|
44
|
+
if (typeof timer.unref === "function") {
|
|
45
|
+
timer.unref();
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const result = await waitForReady(child, expectedResponse, controller.signal);
|
|
49
|
+
clearTimeout(timer);
|
|
50
|
+
return result;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
clearTimeout(timer);
|
|
53
|
+
child.kill();
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function isPortInUseError(error: unknown): boolean {
|
|
59
|
+
return /EADDRINUSE|address already in use|port already in use/iu.test(String(error));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function resolveUploadFolderPath(
|
|
63
|
+
projectFolderPath: string,
|
|
64
|
+
uploadFolderPath: string | undefined,
|
|
65
|
+
): string {
|
|
66
|
+
if (uploadFolderPath !== undefined && uploadFolderPath !== "") {
|
|
67
|
+
return uploadFolderPath;
|
|
68
|
+
}
|
|
69
|
+
return path.join(projectFolderPath, "uploads");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function backArgs(args: RunArgs, port: number): string[] {
|
|
73
|
+
const { projectFolderPath } = args;
|
|
74
|
+
if (!projectFolderPath) {
|
|
75
|
+
throw new Error("projectFolderPath is required");
|
|
76
|
+
}
|
|
77
|
+
const uploadFolderPath = resolveUploadFolderPath(projectFolderPath, args.uploadFolderPath);
|
|
78
|
+
const executableArgs = [
|
|
79
|
+
"--port",
|
|
80
|
+
String(port),
|
|
81
|
+
"--project_folder_path",
|
|
82
|
+
projectFolderPath,
|
|
83
|
+
"--upload_folder_path",
|
|
84
|
+
uploadFolderPath,
|
|
85
|
+
"--allowed_origins",
|
|
86
|
+
"http://localhost:*",
|
|
87
|
+
"--timeout",
|
|
88
|
+
"0",
|
|
89
|
+
];
|
|
90
|
+
if (process.env.NODE_ENV === undefined || process.env.NODE_ENV === "development") {
|
|
91
|
+
executableArgs.push("--debug");
|
|
92
|
+
}
|
|
93
|
+
return executableArgs;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function waitUntilListening(
|
|
97
|
+
child: child_process.ChildProcessWithoutNullStreams,
|
|
98
|
+
): Promise<void> {
|
|
99
|
+
child.stderr.on("data", (data: Buffer) => {
|
|
100
|
+
consola.info(`[${child.spawnfile}] STDERR:`, data.toString().trim());
|
|
101
|
+
});
|
|
102
|
+
child.on("close", (code) => {
|
|
103
|
+
consola.info(`[${child.spawnfile}] exited with code ${code}`);
|
|
104
|
+
});
|
|
105
|
+
// oxlint-disable-next-line typescript/no-unnecessary-condition
|
|
106
|
+
for await (const chunk of child.stdout) {
|
|
107
|
+
const output = String(chunk);
|
|
108
|
+
consola.info(`[${child.spawnfile}] STDOUT:`, output.trim());
|
|
109
|
+
if (LISTENING_LOG_PATTERN.test(output)) {
|
|
110
|
+
child.stdout.on("data", (data: Buffer) => {
|
|
111
|
+
consola.info(`[${child.spawnfile}] STDOUT:`, data.toString().trim());
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
throw new Error(`${child.spawnfile} exited before becoming ready`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
DEFAULT_RUN_ARGS,
|
|
121
|
+
MAX_PORT_RETRIES,
|
|
122
|
+
backArgs,
|
|
123
|
+
isPortInUseError,
|
|
124
|
+
runScript,
|
|
125
|
+
waitUntilListening,
|
|
126
|
+
};
|
|
127
|
+
export type { RunArgs };
|
|
@@ -27,6 +27,13 @@ const INTERNAL_SERVER_ERROR = 500;
|
|
|
27
27
|
type RouteSchema = JsonRpcSchema & { readonly response?: object };
|
|
28
28
|
|
|
29
29
|
// Same body as the Flask microservices' errors, so the client reads every error the same way
|
|
30
|
+
function describeError(error: unknown): string {
|
|
31
|
+
if (error instanceof Error) {
|
|
32
|
+
return error.message;
|
|
33
|
+
}
|
|
34
|
+
return String(error);
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
function toErrorResponse(error: unknown): ErrorResponse {
|
|
31
38
|
if (isError(error)) {
|
|
32
39
|
return {
|
|
@@ -38,7 +45,7 @@ function toErrorResponse(error: unknown): ErrorResponse {
|
|
|
38
45
|
return {
|
|
39
46
|
code: INTERNAL_SERVER_ERROR,
|
|
40
47
|
name: "Internal Server Error",
|
|
41
|
-
description:
|
|
48
|
+
description: describeError(error),
|
|
42
49
|
};
|
|
43
50
|
}
|
|
44
51
|
|
|
@@ -31,7 +31,20 @@ function rawDataToBlob(raw: WebSocket.RawData): Blob {
|
|
|
31
31
|
if (raw instanceof ArrayBuffer) {
|
|
32
32
|
return new Blob([raw]);
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
if (Array.isArray(raw)) {
|
|
35
|
+
return new Blob([Uint8Array.from(Buffer.concat(raw))]);
|
|
36
|
+
}
|
|
37
|
+
return new Blob([Uint8Array.from(raw)]);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function findPendingCall(
|
|
41
|
+
pending: ReadonlyMap<string, PendingCall>,
|
|
42
|
+
id: string | undefined,
|
|
43
|
+
): PendingCall | undefined {
|
|
44
|
+
if (id === undefined) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
return pending.get(id);
|
|
35
48
|
}
|
|
36
49
|
|
|
37
50
|
interface ServerWsRpcClient {
|
|
@@ -98,7 +111,7 @@ function createServerWsRpcClient(baseUrl: string): ServerWsRpcClient {
|
|
|
98
111
|
return;
|
|
99
112
|
}
|
|
100
113
|
|
|
101
|
-
const entry =
|
|
114
|
+
const entry = findPendingCall(pending, message.id);
|
|
102
115
|
if (!entry || message.id === undefined) {
|
|
103
116
|
return;
|
|
104
117
|
}
|
|
@@ -58,8 +58,8 @@ async function performFetch({
|
|
|
58
58
|
baseURL,
|
|
59
59
|
method,
|
|
60
60
|
headers,
|
|
61
|
-
...(hasBody(params)
|
|
62
|
-
...(max_retry
|
|
61
|
+
...(hasBody(params) && { body: params }),
|
|
62
|
+
...(max_retry !== undefined && { retry: max_retry }),
|
|
63
63
|
async onRequestError({ error }: { error: unknown }) {
|
|
64
64
|
if (request_error_function) {
|
|
65
65
|
await request_error_function(error);
|
|
@@ -2,7 +2,10 @@ const TRUTHY_VALUES = new Set([true, 1, "1", "true", "yes"]);
|
|
|
2
2
|
const FALSY_VALUES = new Set([false, 0, "0", "false", "no"]);
|
|
3
3
|
|
|
4
4
|
function parseBoolean(value: string | number | boolean): boolean {
|
|
5
|
-
|
|
5
|
+
let normalized: string | number | boolean = value;
|
|
6
|
+
if (typeof value === "string") {
|
|
7
|
+
normalized = value.trim().toLowerCase();
|
|
8
|
+
}
|
|
6
9
|
|
|
7
10
|
if (TRUTHY_VALUES.has(normalized)) {
|
|
8
11
|
return true;
|