@eodash/eodash 5.3.2 → 5.4.0

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 (67) hide show
  1. package/core/client/composables/DefineEodash.js +3 -1
  2. package/core/client/eodashSTAC/EodashCollection.js +29 -43
  3. package/core/client/eodashSTAC/auth.js +19 -15
  4. package/core/client/eodashSTAC/createLayers.js +318 -163
  5. package/core/client/eodashSTAC/helpers.js +64 -42
  6. package/core/client/eodashSTAC/parquet.js +1 -0
  7. package/core/client/eodashSTAC/triggers.js +7 -6
  8. package/core/client/store/states.js +1 -1
  9. package/core/client/types.ts +15 -9
  10. package/core/client/utils/states.js +32 -0
  11. package/dist/client/{DashboardLayout-BHQnHqWW.js → DashboardLayout-CQOGHPW_.js} +2 -2
  12. package/dist/client/{DynamicWebComponent-B4PdeZ9P.js → DynamicWebComponent-CoLO8FEf.js} +1 -1
  13. package/dist/client/{EodashDatePicker-Ch_AXVas.js → EodashDatePicker-BZeQ6bcu.js} +3 -3
  14. package/dist/client/{EodashItemFilter-lTuzCl08.js → EodashItemFilter-CmZkk7GK.js} +1 -1
  15. package/dist/client/{EodashLayerControl-CBSGRlIi.js → EodashLayerControl-D54fY-bX.js} +2 -2
  16. package/dist/client/{EodashLayoutSwitcher-DdwQYoI4.js → EodashLayoutSwitcher-BCP3FvDb.js} +3 -3
  17. package/dist/client/{EodashMapBtns-B910ylV6.js → EodashMapBtns-D-HulIl1.js} +14 -9
  18. package/dist/client/{EodashStacInfo-CeHGMZ8x.js → EodashStacInfo-BZbmT8vT.js} +1 -1
  19. package/dist/client/{EodashTimeSlider-BApJJK0u.js → EodashTimeSlider-DIcAJr6D.js} +2 -2
  20. package/dist/client/{EodashTools-CJVm0k-Q.js → EodashTools-Cz6X6hsF.js} +4 -4
  21. package/dist/client/{ExportState-NXzNGWYq.js → ExportState-DFVFAgKz.js} +4 -4
  22. package/dist/client/{Footer-DfXUC8IK.js → Footer-DLzQcjkI.js} +1 -1
  23. package/dist/client/{Header-BHgaNMEH.js → Header-_D9Z-zFJ.js} +2 -2
  24. package/dist/client/{MobileLayout-B77RzrNe.js → MobileLayout-3Ko9XSfO.js} +2 -2
  25. package/dist/client/{PopUp-BJwqRDNq.js → PopUp-DwI8V2gW.js} +2 -2
  26. package/dist/client/{ProcessList-BFvV4RvS.js → ProcessList-C9eAg2Sb.js} +20 -8
  27. package/dist/client/{VImg-RGGIQ_yA.js → VImg-COXTnCWE.js} +2 -2
  28. package/dist/client/{VMain-CniQR94B.js → VMain-C74l1bv-.js} +1 -1
  29. package/dist/client/{VTooltip-D5dnTfem.js → VTooltip-BLS-cQ9N.js} +2 -2
  30. package/dist/client/{WidgetsContainer-CvnR4J1T.js → WidgetsContainer-D-VfMRxE.js} +1 -1
  31. package/dist/client/{asWebComponent-Dptqds6-.js → asWebComponent-Bw03Jutr.js} +390 -220
  32. package/dist/client/{async-C1hb39Tc.js → async-D4G-FOIc.js} +13 -3
  33. package/dist/client/eo-dash.js +1 -1
  34. package/dist/client/{forwardRefs-CiSZZEn2.js → forwardRefs-CRMFoNYN.js} +2 -2
  35. package/dist/client/{handling-CZ537GCL.js → handling-DTAhQuPh.js} +94 -10
  36. package/dist/client/{helpers-DoQGyrvY.js → helpers-CsjKHAcK.js} +72 -50
  37. package/dist/client/{index-4sC2BIcK.js → index-BHilH1qx.js} +17 -13
  38. package/dist/client/{index-wcTqj0PZ.js → index-BIcmbjr0.js} +55 -16
  39. package/dist/client/{index--uKz-mt4.js → index-BoCcZ0l4.js} +3 -3
  40. package/dist/client/{index-DTxo2ysK.js → index-DEmHaCL3.js} +2 -2
  41. package/dist/client/templates.js +6 -2
  42. package/dist/client/{transition-CFfv5MCB.js → transition-6MJLK-_H.js} +1 -1
  43. package/dist/types/core/client/composables/DefineEodash.d.ts +1 -1
  44. package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +28 -11
  45. package/dist/types/core/client/eodashSTAC/auth.d.ts +5 -5
  46. package/dist/types/core/client/eodashSTAC/createLayers.d.ts +30 -23
  47. package/dist/types/core/client/eodashSTAC/helpers.d.ts +19 -4
  48. package/dist/types/core/client/types.d.ts +2 -1
  49. package/dist/types/core/client/utils/states.d.ts +28 -0
  50. package/dist/types/templates/index.d.ts +1 -0
  51. package/dist/types/widgets/EodashMap/EodashMapBtns.vue.d.ts +2 -0
  52. package/dist/types/widgets/EodashMap/index.vue.d.ts +2 -0
  53. package/dist/types/widgets/EodashProcess/methods/handling.d.ts +13 -0
  54. package/dist/types/widgets/EodashProcess/methods/utils.d.ts +1 -0
  55. package/package.json +2 -2
  56. package/templates/expert.js +4 -0
  57. package/templates/index.js +2 -0
  58. package/widgets/EodashMap/EodashMapBtns.vue +15 -0
  59. package/widgets/EodashMap/index.vue +17 -4
  60. package/widgets/EodashMap/methods/create-layers-config.js +23 -0
  61. package/widgets/EodashMap/methods/index.js +9 -7
  62. package/widgets/EodashProcess/ProcessList.vue +10 -2
  63. package/widgets/EodashProcess/index.vue +1 -9
  64. package/widgets/EodashProcess/methods/composables.js +13 -1
  65. package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +15 -6
  66. package/widgets/EodashProcess/methods/handling.js +77 -0
  67. package/widgets/EodashProcess/methods/utils.js +10 -0
@@ -10,7 +10,9 @@ import { inject, reactive } from "vue";
10
10
  * @returns {Promise<import("@/types").Eodash | null | undefined>}
11
11
  * @see {@linkplain '@/eodash.js'}
12
12
  */
13
- export const useEodashRuntime = async (runtimeConfig) => {
13
+ export const useEodashRuntime = async (
14
+ runtimeConfig = process.env.EODASH_RUNTIME_CONFIG,
15
+ ) => {
14
16
  let eodashConfig;
15
17
  const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
16
18
 
@@ -28,6 +28,8 @@ import {
28
28
  import axios from "@/plugins/axios";
29
29
  import log from "loglevel";
30
30
  import { dataThemesBrands } from "@/utils/states";
31
+ import { useEventBus } from "@vueuse/core";
32
+ import { eoxLayersKey } from "@/utils/keys";
31
33
 
32
34
  export class EodashCollection {
33
35
  #collectionUrl = "";
@@ -130,25 +132,19 @@ export class EodashCollection {
130
132
  this.selectedItem = item;
131
133
  const title = this.#collectionStac?.title || this.#collectionStac?.id || "";
132
134
  layersJson.unshift(
133
- ...(await this.buildJsonArray(
134
- item,
135
- stacItemUrl,
136
- title,
137
- isObservationPoint,
138
- )),
135
+ ...(await this.buildJsonArray(item, title, isObservationPoint)),
139
136
  );
140
137
  return layersJson;
141
138
  };
142
139
 
143
140
  /**
144
141
  * @param {import("stac-ts").StacItem} item
145
- * @param {string} itemUrl
146
142
  * @param {string} title
147
143
  * @param {boolean} isObservationPoint
148
144
  * @param {string} [itemDatetime]
149
145
  * @returns {Promise<Record<string,any>[]>} layers
150
146
  * */
151
- async buildJsonArray(item, itemUrl, title, isObservationPoint, itemDatetime) {
147
+ async buildJsonArray(item, title, isObservationPoint, itemDatetime) {
152
148
  if (!item) {
153
149
  console.warn("[eodash] no item provided to buildJsonArray");
154
150
  return [];
@@ -157,7 +153,6 @@ export class EodashCollection {
157
153
  log.debug(
158
154
  "Building JSON array",
159
155
  item,
160
- itemUrl,
161
156
  title,
162
157
  isObservationPoint,
163
158
  itemDatetime,
@@ -184,19 +179,6 @@ export class EodashCollection {
184
179
  // will try to extract anything it supports but for which we have
185
180
  // less control.
186
181
 
187
- const rasterformURL = /** @type {string|undefined} */ (
188
- this.#collectionStac?.["eodash:rasterform"]
189
- );
190
- /** @type {import("@/types").EodashRasterJSONForm|undefined} */
191
- const rasterForm = rasterformURL
192
- ? await axios.get(rasterformURL).then((resp) => resp.data)
193
- : undefined;
194
- let { layerConfig, style } = extractLayerConfig(
195
- this.#collectionStac?.id ?? "",
196
- await fetchStyle(item, itemUrl),
197
- rasterForm,
198
- );
199
-
200
182
  const { layerDatetime, timeControlValues } = extractLayerTimeValues(
201
183
  await this.getItems(),
202
184
  item.properties?.datetime ??
@@ -210,9 +192,11 @@ export class EodashCollection {
210
192
  }
211
193
  return data;
212
194
  }, /** @type {Record<string,import('stac-ts').StacAsset>} */ ({}));
195
+
213
196
  const isSupported =
214
- item.links.some((link) => ["wms", "xyz", "wmts", "vector-tile"].includes(link.rel)) ||
215
- Object.keys(dataAssets).length;
197
+ item.links.some((link) =>
198
+ ["wms", "xyz", "wmts", "vector-tile"].includes(link.rel),
199
+ ) || Object.keys(dataAssets).length;
216
200
 
217
201
  if (isSupported) {
218
202
  // Checking for potential legend asset
@@ -230,20 +214,19 @@ export class EodashCollection {
230
214
  this.#collectionStac?.id ?? "",
231
215
  title,
232
216
  item,
233
- itemUrl,
234
217
  layerDatetime,
235
218
  extraProperties,
219
+ this.#collectionStac,
236
220
  );
237
221
 
238
222
  jsonArray.push(
239
223
  ...((this.rasterEndpoint &&
240
- createLayerFromRender(
224
+ await createLayerFromRender(
241
225
  this.rasterEndpoint,
242
226
  this.#collectionStac,
243
227
  item,
244
228
  {
245
229
  ...extraProperties,
246
- ...(layerConfig && { layerConfig }),
247
230
  ...(layerDatetime && { layerDatetime }),
248
231
  },
249
232
  )) ||
@@ -253,8 +236,6 @@ export class EodashCollection {
253
236
  title || this.#collectionStac?.title || item.id,
254
237
  dataAssets,
255
238
  item,
256
- style,
257
- layerConfig,
258
239
  layerDatetime,
259
240
  extraProperties,
260
241
  )),
@@ -262,6 +243,10 @@ export class EodashCollection {
262
243
  ...links,
263
244
  );
264
245
  } else {
246
+ // get the correct style which is not attached to a link
247
+ const id = this.#collectionStac?.id ?? "";
248
+ const styles = await fetchStyle(item);
249
+ let { layerConfig, style } = extractLayerConfig(id, styles);
265
250
  // fallback to STAC
266
251
  const json = {
267
252
  type: "STAC",
@@ -269,7 +254,7 @@ export class EodashCollection {
269
254
  displayFootprint: false,
270
255
  data: item,
271
256
  properties: {
272
- id: this.#collectionStac?.id ?? "",
257
+ id,
273
258
  title: title || item.id,
274
259
  layerConfig,
275
260
  },
@@ -403,17 +388,14 @@ export class EodashCollection {
403
388
  return [];
404
389
  }
405
390
  // get all style links, which could contribute by tooltip config and aggregate them
406
- const styles = await fetchAllStyles(
407
- this.selectedItem,
408
- `${this.#collectionUrl}/${this.selectedItem.id}`,
409
- );
391
+ const styles = await fetchAllStyles(this.selectedItem);
410
392
  // get only unique ids to avoid duplicates
411
393
  const aggregatedTooltips = [
412
394
  ...new Map(
413
395
  styles
414
- .flatMap(style => style.tooltip || [])
415
- .map(entry => [entry.id, entry])
416
- ).values()
396
+ .flatMap((style) => style.tooltip || [])
397
+ .map((entry) => [entry.id, entry]),
398
+ ).values(),
417
399
  ];
418
400
  this.#tooltipProperties = aggregatedTooltips ?? [];
419
401
  return this.#tooltipProperties;
@@ -450,7 +432,6 @@ export class EodashCollection {
450
432
  // if specifiedLink is an item, we create layers from it
451
433
  newLayers = await this.buildJsonArray(
452
434
  specifiedLink,
453
- this.#collectionUrl + `/items/${specifiedLink.id}`,
454
435
  this.#collectionStac?.title || this.#collectionStac?.id || "",
455
436
  this.#collectionStac?.endpointtype === "GeoDB" ||
456
437
  !!this.#collectionStac?.locations,
@@ -466,16 +447,22 @@ export class EodashCollection {
466
447
  currentLayers = getCompareLayers();
467
448
  }
468
449
 
469
-
470
450
  const oldLayer = findLayer(currentLayers, layer);
471
451
 
472
-
473
452
  const toBeReplacedLayers = findLayersByLayerPrefix(currentLayers, oldLayer);
474
453
 
475
454
  if (!toBeReplacedLayers) {
476
455
  return;
477
456
  }
478
- const updatedLayers = replaceLayersInStructure(currentLayers, toBeReplacedLayers, newLayers);
457
+ const updatedLayers = replaceLayersInStructure(
458
+ currentLayers,
459
+ toBeReplacedLayers,
460
+ newLayers,
461
+ );
462
+
463
+ // Emit event to update potential widget dependencies such as process layer ids
464
+ const layersEvents = useEventBus(eoxLayersKey);
465
+ layersEvents.emit("layertime:updated", newLayers);
479
466
 
480
467
  return updatedLayers;
481
468
  }
@@ -499,17 +486,16 @@ export class EodashCollection {
499
486
  );
500
487
 
501
488
  return [
502
- //@ts-expect-error indicator instead of item
503
489
  ...(await createLayersFromLinks(
504
490
  indicator?.id ?? "",
505
491
  indicator?.title || indicator.id,
492
+ //@ts-expect-error indicator instead of item
506
493
  indicator,
507
494
  )),
508
495
  ...(await createLayersFromAssets(
509
496
  indicator?.id ?? "",
510
497
  indicator?.title || indicator.id,
511
498
  indicatorAssets,
512
- //@ts-expect-error indicator instead of item
513
499
  indicator,
514
500
  )),
515
501
  ];
@@ -1,13 +1,13 @@
1
1
  /**
2
- * Generic handler for possible authentications schemes as defined in STAC authentication extension.
3
- * @param {import("@/types").StacAuthItem } item
4
- * @param {import("@/types").StacAuthLink | import("@/types").StacAuthAsset} linkOrAsset
5
- * @returns {string}
6
- */
2
+ * Generic handler for possible authentications schemes as defined in STAC authentication extension.
3
+ * @param {import("@/types").StacAuthItem } item
4
+ * @param {import("@/types").StacAuthLink | import("@/types").StacAuthAsset} linkOrAsset
5
+ * @returns {string}
6
+ */
7
7
  export function handleAuthenticationOfLink(item, linkOrAsset) {
8
8
  // browse through all authentication refs on a link to find a first one we support
9
9
  for (const authRef of linkOrAsset["auth:refs"] || []) {
10
- const authSchemes = item["auth:schemes"];
10
+ const authSchemes = item["auth:schemes"];
11
11
  if (authRef in authSchemes) {
12
12
  switch (authSchemes[authRef].type) {
13
13
  case "apiKey": {
@@ -22,18 +22,20 @@ export function handleAuthenticationOfLink(item, linkOrAsset) {
22
22
  // case "oauth2":
23
23
  // todo add more handlers when needed
24
24
  default:
25
- console.error(`eodash does not support referenced authentication scheme ${authRef}`);
25
+ console.error(
26
+ `eodash does not support referenced authentication scheme ${authRef}`,
27
+ );
26
28
  }
27
29
  }
28
30
  }
29
31
  return linkOrAsset.href;
30
32
  }
31
33
  /**
32
- * Generic handler for possible authentications schemes as defined in STAC authentication extension.
33
- * @param {import("@/types").ApiKeyAuthScheme } schemeDef
34
- * @param { string } href
35
- * @returns { string }
36
- */
34
+ * Generic handler for possible authentications schemes as defined in STAC authentication extension.
35
+ * @param {import("@/types").ApiKeyAuthScheme } schemeDef
36
+ * @param { string } href
37
+ * @returns { string }
38
+ */
37
39
  function handleApiKeyBasedAuth(schemeDef, href) {
38
40
  // add token to query parameters of href
39
41
  let url = href;
@@ -45,12 +47,14 @@ function handleApiKeyBasedAuth(schemeDef, href) {
45
47
  if (envValue) {
46
48
  url = setQueryParam(href, apiKey, envValue);
47
49
  } else {
48
- console.error(`env variable ${envVar} for authentication parameter ${apiKey} not set`);
50
+ console.error(
51
+ `env variable ${envVar} for authentication parameter ${apiKey} not set`,
52
+ );
49
53
  }
50
- break
54
+ break;
51
55
  }
52
56
  default:
53
- console.error('eodash does not support any referenced handler');
57
+ console.error("eodash does not support any referenced handler");
54
58
  }
55
59
  return url;
56
60
  }