@equinor/fusion-framework-vite-plugin-spa 3.1.2 → 3.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @equinor/fusion-framework-vite-plugin-spa
2
2
 
3
+ ## 3.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`434ce70`](https://github.com/equinor/fusion-framework/commit/434ce707d237b399f8438eebe742641b2a81b11f)]:
8
+ - @equinor/fusion-framework-module-service-discovery@9.1.0
9
+
10
+ ## 3.1.3
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies []:
15
+ - @equinor/fusion-framework-module-telemetry@4.6.2
16
+
3
17
  ## 3.1.2
4
18
 
5
19
  ### Patch Changes
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '3.1.2';
2
+ export const version = '3.1.4';
3
3
  //# sourceMappingURL=version.js.map
@@ -23160,7 +23160,7 @@ class TelemetryConfigurator extends BaseConfigBuilder {
23160
23160
  }
23161
23161
 
23162
23162
  // Generated by genversion.
23163
- const version$5 = '4.6.1';
23163
+ const version$5 = '4.6.2';
23164
23164
 
23165
23165
  /**
23166
23166
  * Enum representing the severity levels of telemetry items.
@@ -23293,10 +23293,9 @@ const TelemetryCustomEventSchema = TelemetryEventSchema.extend({
23293
23293
  * with custom details and behavior. It allows you to:
23294
23294
  *
23295
23295
  * - Specify the event type and initial event details
23296
- * - Access the event details, including the original details and any updates
23296
+ * - Access the event details
23297
23297
  * - Check if the event is cancelable and whether it has been canceled
23298
23298
  * - Control whether the event can bubble up the event hierarchy
23299
- * - Update the event details during the event lifecycle
23300
23299
  *
23301
23300
  * The `FrameworkEvent` class is designed to be used as a base class for creating custom event types that fit the needs
23302
23301
  * of your application or framework.
@@ -23308,18 +23307,14 @@ const TelemetryCustomEventSchema = TelemetryEventSchema.extend({
23308
23307
  class FrameworkEvent {
23309
23308
  __type;
23310
23309
  #detail;
23311
- #originalDetail;
23312
23310
  #source;
23313
23311
  #canceled = false;
23314
23312
  #cancelable;
23315
- #mutableDetails;
23316
23313
  #canBubble;
23317
23314
  #created = Date.now();
23318
23315
  constructor(__type, args) {
23319
23316
  this.__type = __type;
23320
23317
  this.#detail = args.detail;
23321
- this.#originalDetail = structuredClone(args.detail);
23322
- this.#mutableDetails = !!args.mutableDetails;
23323
23318
  this.#source = args.source;
23324
23319
  this.#cancelable = !!args.cancelable;
23325
23320
  this.#canBubble = args.canBubble === undefined ? true : args.canBubble;
@@ -23362,14 +23357,6 @@ class FrameworkEvent {
23362
23357
  get detail() {
23363
23358
  return this.#detail;
23364
23359
  }
23365
- /**
23366
- * Gets the original event details that were passed to the `FrameworkEvent` constructor.
23367
- * This property provides access to the original event details, which may have been modified by the `updateDetails` method.
23368
- * @returns {FrameworkEventInitDetail<TInit>} The original event details.
23369
- */
23370
- get originalDetail() {
23371
- return this.#originalDetail;
23372
- }
23373
23360
  /**
23374
23361
  * Gets the source object that triggered the event.
23375
23362
  * @returns {FrameworkEventInitSource<TInit> | undefined} The source object that triggered the event, or `undefined` if the source is not available.
@@ -23384,14 +23371,6 @@ class FrameworkEvent {
23384
23371
  get type() {
23385
23372
  return this.__type;
23386
23373
  }
23387
- /**
23388
- * Indicates whether the event details can be mutated.
23389
- * If this property is `true`, the event details can be updated using the `updateDetails` method.
23390
- * @returns {boolean} `true` if the event details can be mutated, `false` otherwise.
23391
- */
23392
- get allowEventDetailsMutation() {
23393
- return this.#mutableDetails;
23394
- }
23395
23374
  /**
23396
23375
  * Prevents the default action of the event from occurring, if the event is cancelable.
23397
23376
  * If the event is cancelable, this method sets the `canceled` property to `true`.
@@ -23408,23 +23387,6 @@ class FrameworkEvent {
23408
23387
  stopPropagation() {
23409
23388
  this.#canBubble = false;
23410
23389
  }
23411
- /**
23412
- * Updates the event details using the provided function.
23413
- *
23414
- * @remarks If the event details are not mutable, an error will be thrown.
23415
- *
23416
- * @see {FrameworkEvent.originalDetail}
23417
- *
23418
- * @param fn - A function that takes the current event details and returns an updated version of the details.
23419
- * The function can return `void` or `undefined` to indicate that no changes should be made.
23420
- */
23421
- updateDetails(fn) {
23422
- if (!this.#mutableDetails) {
23423
- throw new Error('Event details are not mutable');
23424
- }
23425
- const detail = fn(this.#detail);
23426
- this.#detail = detail === undefined ? this.#detail : detail;
23427
- }
23428
23390
  }
23429
23391
 
23430
23392
  /**
@@ -44184,26 +44146,35 @@ const queryKey = 'services';
44184
44146
  * Transforms a Response object into an ObservableInput of Service arrays.
44185
44147
  *
44186
44148
  * @param response - The Response object to be transformed.
44149
+ * @param postProcess - Optional callback to process the value.
44187
44150
  * @returns An ObservableInput that emits an array of Service objects.
44188
44151
  */
44189
- const serviceResponseSelector = (response) =>
44190
- // parse response by using the jsonSelector
44191
- from(jsonSelector(response)).pipe(
44192
- // parse and validate the response
44193
- map$1((value) => ApiServices.default([]).parse(value)));
44152
+ const serviceResponseSelector = (response, postProcess) => {
44153
+ // parse response by using the jsonSelector
44154
+ const result$ = from(jsonSelector(response)).pipe(
44155
+ // parse and validate the response
44156
+ map$1((value) => ApiServices.default([]).parse(value)));
44157
+ if (postProcess) {
44158
+ return result$.pipe(postProcess);
44159
+ }
44160
+ return result$;
44161
+ };
44194
44162
  class ServiceDiscoveryClient {
44195
44163
  #query;
44196
44164
  /** Endpoint for fetching services from API */
44197
44165
  endpoint;
44198
44166
  /** HTTP client for fetching services */
44199
44167
  http;
44200
- constructor({ http, endpoint }) {
44201
- this.http = http;
44202
- this.endpoint = endpoint;
44168
+ constructor(options) {
44169
+ this.http = options.http;
44170
+ this.endpoint = options.endpoint;
44171
+ const postProcess = options.postProcess;
44203
44172
  // setup api handler (queue and cache)
44204
44173
  this.#query = new Query({
44205
44174
  client: {
44206
- fn: () => http.fetch$(endpoint ?? '', { selector: serviceResponseSelector }),
44175
+ fn: () => this.http.fetch$(this.endpoint ?? '', {
44176
+ selector: (response) => serviceResponseSelector(response, postProcess),
44177
+ }),
44207
44178
  },
44208
44179
  key: () => queryKey,
44209
44180
  // Cache for 5 minutes
@@ -44279,6 +44250,26 @@ class ServiceDiscoveryConfigurator extends BaseConfigBuilder {
44279
44250
  return new ServiceDiscoveryClient({
44280
44251
  http: httpClient,
44281
44252
  endpoint,
44253
+ postProcess: map$1((input) => {
44254
+ // Check if there are any session overrides in session storage.
44255
+ try {
44256
+ const sessionOverrides = JSON.parse(sessionStorage.getItem('overriddenServiceDiscoveryUrls') || '{}');
44257
+ for (const [key, { url, scopes }] of Object.entries(sessionOverrides)) {
44258
+ const service = input.find((service) => service.key === key);
44259
+ // If the service can be found, override the values with the values
44260
+ // from session override.
44261
+ if (service) {
44262
+ service.uri = url;
44263
+ service.scopes = scopes;
44264
+ service.overridden = true;
44265
+ }
44266
+ }
44267
+ }
44268
+ catch (e) {
44269
+ console.error('Failed to JSON parse session overrides: "overriddenServiceDiscoveryUrls"', e);
44270
+ }
44271
+ return input;
44272
+ }),
44282
44273
  });
44283
44274
  }
44284
44275
  throw Error('httpClient is required');
@@ -44310,7 +44301,7 @@ class ServiceDiscoveryConfigurator extends BaseConfigBuilder {
44310
44301
  }
44311
44302
 
44312
44303
  // Generated by genversion.
44313
- const version$1 = '9.0.5';
44304
+ const version$1 = '9.1.0';
44314
44305
 
44315
44306
  class ServiceDiscoveryProvider extends BaseModuleProvider {
44316
44307
  config;
@@ -44829,7 +44820,7 @@ async function registerServiceWorker(framework) {
44829
44820
  }
44830
44821
 
44831
44822
  // Generated by genversion.
44832
- const version = '3.1.2';
44823
+ const version = '3.1.4';
44833
44824
 
44834
44825
  // Allow dynamic import without vite
44835
44826
  const importWithoutVite = (path) => import(/* @vite-ignore */ path);