@geode/opengeodeweb-front 10.43.0-rc.3 → 10.43.1-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,10 @@
1
1
  import Ajv from "ajv";
2
2
  //#region shared/utils/validate_schema.ts
3
3
  function validateSchema(schema, body) {
4
+ if (body instanceof FormData) return {
5
+ valid: true,
6
+ error: "No errors"
7
+ };
4
8
  const ajv = new Ajv();
5
9
  for (const keyword of [
6
10
  "methods",
@@ -8,7 +8,6 @@ import { type TreeviewSnapshot, useTreeviewStore } from "@ogw_front/stores/treev
8
8
  import type { CameraSnapshot } from "@ogw_internal/stores/hybrid_viewer/camera";
9
9
  import type { ModelComponentRecord } from "@ogw_front/stores/data_helpers/mesh.js";
10
10
  import type { ModelComponentRelationRecord } from "@ogw_front/stores/data.js";
11
- import { fetchRaw } from "@ogw_shared/utils/fetch_raw";
12
11
  import { importWorkflowFromSnapshot } from "@ogw_front/utils/import_workflow";
13
12
  import { useAppStore } from "@ogw_front/stores/app";
14
13
  import { useBackStore } from "@ogw_front/stores/back";
@@ -29,23 +28,7 @@ interface ProjectSnapshot {
29
28
  dataStyle?: DataStyleSnapshot;
30
29
  }
31
30
 
32
- // The backend response is an untyped network payload; this is the one place its shape is asserted.
33
- function isImportSnapshotResponse(value: unknown): value is { snapshot?: ProjectSnapshot } {
34
- return typeof value === "object" && value !== null;
35
- }
36
-
37
- function isFileDownloadData(
38
- value: unknown,
39
- ): value is string | ArrayBuffer | ArrayBufferView | Blob {
40
- return (
41
- typeof value === "string" ||
42
- value instanceof ArrayBuffer ||
43
- ArrayBuffer.isView(value) ||
44
- value instanceof Blob
45
- );
46
- }
47
-
48
- async function exportProject(): Promise<{ result: unknown }> {
31
+ async function exportProject(): Promise<{ result: Blob }> {
49
32
  const appStore = useAppStore();
50
33
  const backStore = useBackStore();
51
34
  const feedbackStore = useFeedbackStore();
@@ -53,16 +36,7 @@ async function exportProject(): Promise<{ result: unknown }> {
53
36
  const schema = back_schemas.opengeodeweb_back.export_project;
54
37
  const defaultName = "project.vease";
55
38
  const params = { snapshot, filename: defaultName };
56
- const result = await fetchRaw({
57
- route: schema.$id,
58
- params,
59
- method: schema.methods[0],
60
- baseURL: backStore.base_url,
61
- });
62
-
63
- if (!isFileDownloadData(result)) {
64
- throw new Error("Unexpected export_project response type");
65
- }
39
+ const result = await backStore.request({ schema, params });
66
40
  fileDownload(result, defaultName);
67
41
  feedbackStore.add_success("Project exported successfully");
68
42
  return { result };
@@ -119,13 +93,8 @@ async function importProject(file: File): Promise<void> {
119
93
  }
120
94
  form.append("file", file, originalFileName);
121
95
 
122
- const result = await fetchRaw({
123
- route: importProjectSchema.$id,
124
- params: form,
125
- method: importProjectSchema.methods[0],
126
- baseURL: backStore.base_url,
127
- });
128
- const snapshot = (isImportSnapshotResponse(result) ? result.snapshot : undefined) ?? {};
96
+ const result = await backStore.request({ schema: importProjectSchema, params: form });
97
+ const snapshot: ProjectSnapshot = result.snapshot;
129
98
 
130
99
  treeviewStore.isImporting = true;
131
100
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.43.0-rc.3",
3
+ "version": "10.43.1-rc.1",
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": {
@@ -3,6 +3,10 @@ import Ajv from "ajv";
3
3
  import type { JsonRpcSchema } from "./types.js";
4
4
 
5
5
  function validateSchema(schema: JsonRpcSchema, body: unknown): { valid: boolean; error: string } {
6
+ // A multipart body carries files, not the JSON params the schema describes; the route validates it itself.
7
+ if (body instanceof FormData) {
8
+ return { valid: true, error: "No errors" };
9
+ }
6
10
  const ajv = new Ajv();
7
11
  const list_keywords = ["methods", "route", "max_retry", "rpc", "response"];
8
12
  for (const keyword of list_keywords) {