@geode/opengeodeweb-front 10.40.0 → 10.41.0-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.
@@ -72,7 +72,7 @@ interface UseModelBlocksPolyhedronAttributeReturn {
72
72
  modelId: string,
73
73
  blockIds: string[],
74
74
  timeStep: number,
75
- ) => Promise<void>;
75
+ ) => Promise<boolean>;
76
76
  modelBlocksPolyhedronAttributeColorMap: (modelId: string, blockId?: string) => string | undefined;
77
77
  modelBlocksPolyhedronAttributeStoredConfig: (
78
78
  modelId: string,
@@ -89,29 +89,29 @@ interface UseModelBlocksPolyhedronAttributeReturn {
89
89
  modelId: string,
90
90
  blockIds: string[],
91
91
  name: string,
92
- ) => Promise<unknown>;
92
+ ) => Promise<boolean>;
93
93
  setModelBlocksPolyhedronAttributeItem: (
94
94
  modelId: string,
95
95
  blockIds: string[],
96
96
  item: number,
97
- ) => Promise<unknown>;
97
+ ) => Promise<boolean>;
98
98
  setModelBlocksPolyhedronAttributeRange: (
99
99
  modelId: string,
100
100
  blockIds: string[],
101
101
  minimum: number,
102
102
  maximum: number,
103
- ) => Promise<unknown>;
103
+ ) => Promise<boolean>;
104
104
  setModelBlocksPolyhedronAttributeColorMap: (
105
105
  modelId: string,
106
106
  blockIds: string[],
107
107
  colorMap: string | undefined,
108
- ) => Promise<unknown>;
108
+ ) => Promise<boolean>;
109
109
  modelBlocksPolyhedronAttributeNoDataColor: (modelId: string, blockId?: string) => RGBAColor;
110
110
  setModelBlocksPolyhedronAttributeNoDataColor: (
111
111
  modelId: string,
112
112
  blockIds: string[],
113
113
  no_data_color: RGBAColor,
114
- ) => Promise<unknown>;
114
+ ) => Promise<boolean>;
115
115
  }
116
116
 
117
117
  // oxlint-disable-next-line max-lines-per-function
@@ -281,7 +281,8 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
281
281
  params,
282
282
  });
283
283
  }
284
- async function applyPolyhedronAttribute(modelId: string, blockIds: string[]): Promise<unknown> {
284
+ // True when the attribute was sent to the viewer, so the caller knows a render is needed
285
+ async function applyPolyhedronAttribute(modelId: string, blockIds: string[]): Promise<boolean> {
285
286
  const name = modelBlocksPolyhedronAttributeName(modelId, blockIds[0]);
286
287
  const item = modelBlocksPolyhedronAttributeItem(modelId, blockIds[0]);
287
288
  const storedConfig = modelBlocksPolyhedronAttributeStoredConfig(
@@ -298,17 +299,17 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
298
299
  colorMap: storedConfig.colorMap,
299
300
  no_data_color: storedConfig.no_data_color,
300
301
  };
301
- if (isModelBlocksPolyhedronAttributeValid(attribute)) {
302
- const result = await setModelBlocksPolyhedronAttribute(modelId, blockIds, attribute);
303
- return result;
302
+ if (!isModelBlocksPolyhedronAttributeValid(attribute)) {
303
+ return false;
304
304
  }
305
- return undefined;
305
+ await setModelBlocksPolyhedronAttribute(modelId, blockIds, attribute);
306
+ return true;
306
307
  }
307
308
  async function setModelBlocksPolyhedronAttributeName(
308
309
  modelId: string,
309
310
  blockIds: string[],
310
311
  name: string,
311
- ): Promise<unknown> {
312
+ ): Promise<boolean> {
312
313
  const item = modelBlocksPolyhedronAttributeLastItem(modelId, blockIds[0], name);
313
314
  await mutateModelBlocksPolyhedronStyle(modelId, blockIds, {
314
315
  name,
@@ -320,7 +321,7 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
320
321
  modelId: string,
321
322
  blockIds: string[],
322
323
  item: number,
323
- ): Promise<unknown> {
324
+ ): Promise<boolean> {
324
325
  await mutateModelBlocksPolyhedronStyle(modelId, blockIds, {
325
326
  item,
326
327
  });
@@ -330,13 +331,14 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
330
331
  modelId: string,
331
332
  blockIds: string[],
332
333
  timeStep: number,
333
- ): Promise<void> {
334
+ ): Promise<boolean> {
334
335
  const name = modelBlocksPolyhedronAttributeName(modelId, blockIds[0]);
335
336
  if (name === undefined) {
336
- return;
337
+ return false;
337
338
  }
338
339
  await setAttributeTimeStep(modelId, modelBlockPolyhedronAttributeSchema.$id, name, timeStep);
339
- await Promise.all([
340
+ let reapplied = false;
341
+ const [applied] = await Promise.all([
340
342
  applyPolyhedronAttribute(modelId, blockIds),
341
343
  reapplySameSeries(
342
344
  await dataStore.getBlocksGeodeIds(modelId),
@@ -352,17 +354,18 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
352
354
  ].join("|")
353
355
  : undefined,
354
356
  async (ids) => {
355
- await applyPolyhedronAttribute(modelId, ids);
357
+ reapplied = (await applyPolyhedronAttribute(modelId, ids)) || reapplied;
356
358
  },
357
359
  ),
358
360
  ]);
361
+ return applied || reapplied;
359
362
  }
360
363
  async function setModelBlocksPolyhedronAttributeRange(
361
364
  modelId: string,
362
365
  blockIds: string[],
363
366
  minimum: number,
364
367
  maximum: number,
365
- ): Promise<unknown> {
368
+ ): Promise<boolean> {
366
369
  const name = modelBlocksPolyhedronAttributeName(modelId, blockIds[0]);
367
370
  const item = modelBlocksPolyhedronAttributeItem(modelId, blockIds[0]);
368
371
  await setModelBlocksPolyhedronAttributeStoredConfig(modelId, blockIds, name, item, {
@@ -375,7 +378,7 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
375
378
  modelId: string,
376
379
  blockIds: string[],
377
380
  colorMap: string | undefined,
378
- ): Promise<unknown> {
381
+ ): Promise<boolean> {
379
382
  const name = modelBlocksPolyhedronAttributeName(modelId, blockIds[0]);
380
383
  const item = modelBlocksPolyhedronAttributeItem(modelId, blockIds[0]);
381
384
  await setModelBlocksPolyhedronAttributeStoredConfig(modelId, blockIds, name, item, {
@@ -387,7 +390,7 @@ function useModelBlocksPolyhedronAttribute(): UseModelBlocksPolyhedronAttributeR
387
390
  modelId: string,
388
391
  blockIds: string[],
389
392
  no_data_color: RGBAColor,
390
- ): Promise<unknown> {
393
+ ): Promise<boolean> {
391
394
  const name = modelBlocksPolyhedronAttributeName(modelId, blockIds[0]);
392
395
  const item = modelBlocksPolyhedronAttributeItem(modelId, blockIds[0]);
393
396
  const storedConfig = modelBlocksPolyhedronAttributeStoredConfig(
@@ -44,7 +44,7 @@ async function upload_file(
44
44
  const feedbackStore = useFeedbackStore();
45
45
 
46
46
  if (!(file instanceof File)) {
47
- throw new Error("file must be an instance of File");
47
+ throw new TypeError("file must be an instance of File");
48
48
  }
49
49
 
50
50
  const route = schema.$id;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.40.0",
3
+ "version": "10.41.0-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": {
@@ -64,9 +64,9 @@
64
64
  "prepublishOnly": "npm run build"
65
65
  },
66
66
  "dependencies": {
67
- "@geode/cloud-api": "latest",
68
- "@geode/opengeodeweb-back": "latest",
69
- "@geode/opengeodeweb-viewer": "latest",
67
+ "@geode/cloud-api": "next",
68
+ "@geode/opengeodeweb-back": "next",
69
+ "@geode/opengeodeweb-viewer": "next",
70
70
  "@kitware/vtk.js": "33.3.0",
71
71
  "@mdi/font": "7.4.47",
72
72
  "@msgpack/msgpack": "2.8.0",
@@ -10,7 +10,7 @@ const CHUNK_SIZE_BYTES = CHUNK_SIZE_MEBIBYTES * KIBIBYTES_PER_MEBIBYTE * BYTES_P
10
10
  function assertFile(file: unknown): asserts file is File {
11
11
  consola.debug("[ASSERT_FILE] Asserting file", { file });
12
12
  if (!(file instanceof File)) {
13
- throw new Error("file must be an instance of File");
13
+ throw new TypeError("file must be an instance of File");
14
14
  }
15
15
  }
16
16
 
@@ -106,4 +106,40 @@ function resolveAllowedObjects(
106
106
  };
107
107
  }
108
108
 
109
- export { resolveAllowedObjects, getFileExtension };
109
+ interface FileAllowedObjects {
110
+ readonly filename: string;
111
+ // Loadable types only, sorted by best is_loadable then best object_priority
112
+ readonly candidates: string[];
113
+ readonly selectedGeodeObject: string | undefined;
114
+ }
115
+
116
+ function sortCandidates(objectMap: AllowedObjectMap): string[] {
117
+ return Object.keys(objectMap)
118
+ .filter((key) => getObject(objectMap, key).is_loadable > 0)
119
+ .toSorted((keyA, keyB) => {
120
+ const objectA = getObject(objectMap, keyA);
121
+ const objectB = getObject(objectMap, keyB);
122
+ if (objectA.is_loadable !== objectB.is_loadable) {
123
+ return objectB.is_loadable - objectA.is_loadable;
124
+ }
125
+ return (objectB.object_priority ?? -Infinity) - (objectA.object_priority ?? -Infinity);
126
+ });
127
+ }
128
+
129
+ // Each file gets its own geode object type; files are no longer required to share one
130
+ function resolveAllowedObjectsPerFile(
131
+ filenames: readonly string[],
132
+ allowedObjectsList: readonly AllowedObjectMap[],
133
+ ): FileAllowedObjects[] {
134
+ return filenames.map((filename, index) => {
135
+ const objectMap = allowedObjectsList[index] ?? {};
136
+ return {
137
+ filename,
138
+ candidates: sortCandidates(objectMap),
139
+ selectedGeodeObject: selectGeodeObject(objectMap),
140
+ };
141
+ });
142
+ }
143
+
144
+ export { resolveAllowedObjects, resolveAllowedObjectsPerFile, getFileExtension };
145
+ export type { FileAllowedObjects };