@interopio/browser-platform 4.5.1 → 5.0.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.
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { IOConnectCore } from "@interopio/core";
2
+ import { IOConnectCore, IOInsights } from "@interopio/core";
3
3
  import { IOConnectBrowser } from "@interopio/browser";
4
4
  import { IOConnectDesktop } from "@interopio/desktop";
5
5
 
@@ -158,110 +158,118 @@ export namespace IOConnectBrowserPlatform {
158
158
  }
159
159
 
160
160
  /**
161
- * Configuration for publishing OpenTelemetry data and settings for the published data items.
161
+ * Configuration for publishing io.Insights data and settings for the published data items.
162
+ * @since io.Connect Browser 5.0
162
163
  */
163
- export namespace Otel {
164
+ export namespace Insights {
164
165
  /**
165
- * Configuration for publishing OpenTelemetry data.
166
+ * Types of the metrics published by **io.Connect Browser**.
166
167
  */
167
- export interface Config {
168
- /**
169
- * Additional attributes to add to the observability resource definition.
170
- */
171
- additionalResourceAttributes?: Record<string, unknown>;
172
-
173
- /**
174
- * A function that returns additional attributes to add to observability entities (metrics, spans, log entries) by default.
175
- */
176
- getAdditionalAttributes?: () => Record<string, unknown>;
177
-
178
- /**
179
- * Additional headers to send in HTTP requests.
180
- */
181
- headers?: Record<string, string>;
168
+ export type MetricType =
169
+ | "app_count"
170
+ | "app_duration"
171
+ | "app_duration_soft"
172
+ | "app_error"
173
+ | "app_started"
174
+ | "app_startup"
175
+ | "app_stopped"
176
+ | "layout_startup"
177
+ | "platform_error"
178
+ | "platform_startup"
179
+ | "workspace_count"
180
+ | "workspace_started"
181
+ | "workspace_startup"
182
+ | "workspace_startup_apps"
183
+ | "workspace_startup_component"
184
+ | "workspace_startup_frame"
185
+ | "workspace_startup_frame_init"
186
+ | "workspace_startup_frame_page_load"
187
+ | "workspace_startup_frame_workspace_render"
188
+ | "workspace_stopped"
189
+ | IOConnectBrowser.Insights.MetricType;
182
190
 
191
+ /**
192
+ * Describes a metric.
193
+ */
194
+ export interface MetricSettings extends Omit<IOInsights.MetricSettings,
195
+ | "type"
196
+ | "platformVersion" // has no effect: @interopio/insights-metrics always uses insights.platformVersion
197
+ | "user" // has no effect: @interopio/insights-metrics always uses insights.userId
198
+ > {
183
199
  /**
184
- * Settings for publishing OpenTelemetry metrics.
200
+ * Type of the metric.
201
+ * Observable metrics can be created only via the metrics module of the Insights API.
185
202
  */
186
- metrics?: MetricsDefinition;
203
+ type?: Exclude<MetricType, `custom_observable_${string}`>;
187
204
  }
188
205
 
189
206
  /**
190
- * Settings for publishing OpenTelemetry metrics.
207
+ * Metric filters that can be specified as part of a specific metric.
191
208
  */
192
- export interface MetricsDefinition {
209
+ export interface MetricFilter extends Omit<NonNullable<IOInsights.MetricsSettings["filters"]>[number], "type"> {
193
210
  /**
194
- * URL pointing to an OpenTelemetry metrics server.
211
+ * The type of the metric to match.
195
212
  */
196
- url: string;
197
-
198
- /**
199
- * Interval in milliseconds at which to publish the generated metrics.
200
- * @default 30000
201
- */
202
- publishInterval?: number;
203
-
204
- /**
205
- * Definitions of the OpenTelemetry metrics to publish.
206
- */
207
- metrics?: MetricDefinition[];
213
+ type?: MetricType;
214
+ }
208
215
 
216
+ /**
217
+ * Settings for publishing io.Insights metrics.
218
+ */
219
+ export interface MetricsSettings extends Omit<IOConnectBrowser.Insights.MetricsSettings, "metrics" | "filters"> {
209
220
  /**
210
- * Additional attributes to add to the observability resource definition.
221
+ * If `true`, will enable publishing of all default platform metrics.
222
+ * @default true
211
223
  */
212
- additionalResourceAttributes?: Record<string, unknown>;
224
+ platformMetricsEnabled?: boolean;
213
225
 
214
226
  /**
215
- * A function that returns additional attributes to add to observability entities (metrics, spans, log entries) by default.
227
+ * Array of objects, each describing a metric.
228
+ * Use this property to specify overrides for the default platform metrics, as well as for your custom metrics.
216
229
  */
217
- getAdditionalAttributes?: () => Record<string, unknown>;
230
+ metrics?: MetricSettings[];
218
231
 
219
232
  /**
220
- * Additional headers to send in HTTP requests.
233
+ * Array of objects, each describing a metric filter.
234
+ * Use this property to specify which metrics to be collected and exported by the platform.
221
235
  */
222
- headers?: Record<string, string>;
236
+ filters?: MetricFilter[];
223
237
  }
224
238
 
225
239
  /**
226
- * Definition of an OpenTelemetry metric.
240
+ * Settings for publishing io.Insights traces.
227
241
  */
228
- export interface MetricDefinition {
229
- /**
230
- * If `true`, will enable publishing of the OpenTelemetry metric.
231
- */
232
- enabled?: boolean;
233
-
234
- /**
235
- * Name for the OpenTelemetry metric. May be used in visualization tools.
236
- */
237
- name?: string;
238
-
239
- /**
240
- * Description for the OpenTelemetry metric.
241
- */
242
- description?: string;
242
+ export type TracesSettings = IOConnectBrowser.Insights.TracesSettings;
243
243
 
244
+ /**
245
+ * Configuration for publishing io.Insights data.
246
+ */
247
+ export interface Config extends Pick<IOInsights.Settings,
248
+ | "enabled"
249
+ | "useExistingOTELSDK"
250
+ | "registerGlobalOTELObjects"
251
+ | "errorlessMode"
252
+ | "logSettingsOnStartup"
253
+ | "failOnInitError"
254
+ | "platformVersion"
255
+ | "serviceName"
256
+ | "serviceId"
257
+ | "serviceVersion"
258
+ | "userId"
259
+ | "headers"
260
+ | "addResourceAttributesToAttributes"
261
+ | "additionalAttributes"
262
+ | "additionalResourceAttributes"
263
+ > {
244
264
  /**
245
- * Specify explicit bucket boundaries for the OpenTelemetry SDK if the metric has been created by a `HistogramAggregator`.
265
+ * Settings for publishing io.Insights metrics.
246
266
  */
247
- buckets?: number[];
267
+ metrics?: MetricsSettings;
248
268
 
249
269
  /**
250
- * Type of the predefined OpenTelemetry metric.
270
+ * Settings for publishing io.Insights traces.
251
271
  */
252
- type:
253
- "app_started" |
254
- "app_stopped" |
255
- "app_startup" |
256
- "app_count" |
257
- "app_duration" |
258
- "app_error" |
259
- "layout_startup" |
260
- "workspace_startup" |
261
- "workspace_stopped" |
262
- "workspace_count" |
263
- "platform_startup" |
264
- "platform_error"
272
+ traces?: TracesSettings;
265
273
  }
266
274
  }
267
275
 
@@ -567,18 +575,45 @@ export namespace IOConnectBrowserPlatform {
567
575
  frameCache?: boolean;
568
576
  iframeSandbox?: IFrameSandboxConfig;
569
577
  iframePermissionsPolicy?: IFramePermissionsPolicyConfig;
578
+ workspaceTabsOverflow?: boolean;
570
579
  }
571
580
  }
572
581
 
573
582
  export namespace Windows {
583
+
584
+ /**
585
+ * Settings for the handlers executed when an io.Connect Window is about to be closed.
586
+ * @since io.Connect Browser 5.0
587
+ */
588
+ export interface CloseHandlers {
589
+ /**
590
+ * If `true`, close handlers will be enabled.
591
+ * @default true
592
+ */
593
+ enabled?: boolean;
594
+
595
+ /**
596
+ * Interval in milliseconds to wait for the close handler to complete its operation.
597
+ * @default 2000
598
+ */
599
+ timeout?: number;
600
+ }
601
+
574
602
  export interface Config {
575
603
  windowResponseTimeoutMs?: number;
576
604
  defaultWindowOpenBounds?: IOConnectBrowser.Windows.Bounds;
605
+ closeHandlers?: CloseHandlers;
577
606
  }
578
607
  }
579
608
 
580
609
  export namespace Notifications {
581
610
  export interface Config extends IOConnectBrowser.Notifications.Configuration {
611
+ /**
612
+ * If `true`, clicking on a notification will close it and remove it from the notification list.
613
+ * This is a default platform setting that can be overridden per Browser Client app via the `close` property of the `ClickOptions` object
614
+ * that is passed as an argument to the `click()` method of the Notifications API.
615
+ * @default true
616
+ */
582
617
  clearNotificationOnClick?: boolean;
583
618
  }
584
619
  }
@@ -835,14 +870,14 @@ export namespace IOConnectBrowserPlatform {
835
870
  serviceWorker?: ServiceWorker.Config;
836
871
  gateway?: Gateway.Config;
837
872
  connection?: Connection.Config;
838
- browser?: IOConnectBrowser.Config;
873
+ browser?: Omit<IOConnectBrowser.Config, "insights">;
839
874
  workspaces?: Workspaces.Config;
840
875
  manager?: Manager.Config;
841
876
  themes?: Themes.Config;
842
877
  user?: User.Config;
843
878
  environment?: any;
844
879
  applicationPreferences?: Prefs.Config;
845
- otel?: Otel.Config;
880
+ insights?: Insights.Config;
846
881
  widget?: Widget.Config;
847
882
  modals?: Modals.Config;
848
883
  intentResolver?: IntentResolver.Config;
package/changelog.md CHANGED
@@ -1,8 +1,42 @@
1
+ 5.0.0
2
+ feat!: G4E-8793 replace the `otel` platform config with `insights`, the io.Insights config. `otel` is no longer supported and is ignored (a warning is logged). Metrics are configured in `insights.metrics` and are published only when both `insights.enabled` and `insights.metrics.enabled` are `true`; `getAdditionalAttributes` is replaced by `additionalAttributes`. The `IOConnectBrowserPlatform.Otel` typings are replaced by `IOConnectBrowserPlatform.Insights`.
3
+ feat: G4E-8793 add support for io.Insights traces
4
+ feat: G4E-8793 expose custom and trace-derived metrics in platform configuration and share metrics exporter defaults with connected apps
5
+ feat: G4E-11320 add io.Insights traces for creating and restoring Workspaces (`io.workspaces.createWorkspace()`, `io.workspaces.restoreWorkspace()`). The client call, the platform, the Workspaces Frame and the apps in the Workspace are linked into a single trace.
6
+ feat: G4E-11319 Added the following workspace startup io.Insights metrics: `workspace_startup`, `workspace_startup_frame`, `workspace_startup_frame_init`, `workspace_startup_frame_page_load`, `workspace_startup_frame_workspace_render`, `workspace_startup_component`, `workspace_startup_apps`
7
+ feat: G4E-10540 add support for a placeholder app; when an app named `io-connect-placeholder-app` is defined, restoring a Global Layout starts an instance of it in place of each window of an app that isn't defined, and saving the layout keeps the original app
8
+ feat!: G4E-10982 restoring a Global Layout now invokes the onClosing handlers of the windows, iframes and frames to be closed. If any of them prevents, one dialog in the window that called the restore asks the user whether to close them anyway. The restore rejects without closing anything if the user declines, the dialog cannot be shown (modal windows aren't configured in the platform or dialogs aren't enabled in the app displaying it) or it was turned off with the new `showDialog: false` restore option. Restores initiated by apps using a version of `@interopio/browser` earlier than 5.0 keep the previous behavior. The new `allowPrevent: false` restore option forces the restore - the onClosing handlers are still invoked, but cannot prevent it. While the dialog of a restore waits for the user, any other restore that closes windows or frames is rejected, unless it is forced (allowPrevent: false) - a forced restore closes the dialog, which rejects the restore waiting for the user
9
+ feat: G4E-10376 add preventable close of Workspace frames and windows via `frame.onClosing()` and the `allowPrevent` / `showDialog` close options, including when closing from the Workspaces UI
10
+ feat: G4E-11240 Expose 'intent' in `FilterHandlersResult` returned from `io.intents.filterHandlers()` method
11
+ feat!: G4E-10525 add preventable window close via `onClosing` / `allowPrevent` and change the `close()` method return value from `Promise<WebWindow>` to `Promise<boolean>`
12
+ feat: Replace jsrsasign with jose for license verification. Preserve existing RS256 license compatibility and report a clearer error when Web Crypto is unavailable.
13
+ feat!: G4E-9221 changed the type of the `info` parameter of `channels.add()` from `ChannelDefinition` to `ChannelContext` to align with io.CD.
14
+ feat: G4E-11250 Add optional `handlers` property to `HandlerFilter` for `io.intents.filterHandlers()`, allowing the filter criteria to be applied over a specific set of Intent handlers instead of all discovered ones;
15
+ feat: G4E-11122 add `closeHandlers` options to the windows platform configuration
16
+ feat!: G4E-10167 changed the type of `AppPreferences.lastUpdate` from `string` to `Date`
17
+ feat!: G4E-10960 remove deprecated 'workspacesSandbox' prop from AppManager.DefinitionDetails typings in favor of 'iframeSandbox'
18
+ feat: G4E-10766 add per-click notification close option that takes precedence over the platform clearNotificationOnClick configuration
19
+ feat: G4E-10019 support showing and hiding the header of a Workspace group through `showHeader()`, `hideHeader()` and the `isHeaderVisible` group config option
20
+ fix: Show the Intent Resolver when `io.intents.filterHandlers()` finds a single handler matching multiple intents, so the user can choose the intent. Specifying `intent` or `openResolver: false` skips this choice.
21
+ fix!: G4E-11182 corrected the otel metric type from `workspace_startup` to `workspace_started`
22
+ fix: G4E-10628 like io.CD, Workspaces are created, restored and extended without the windows of applications which aren't defined instead of failing: a container whose only window is of such an application is rejected, while a container with more windows (including windows added by id) is added without them. Global Layouts are likewise restored without the window components of such applications instead of failing, and a warning is logged for each skipped component
23
+ fix: G4E-11167 Prevented a race condition when `workspaceWindow` or `workspaceApplication` registers after the frame has already closed.
24
+ fix: G4E-11100 Show the Intent Resolver when `raise` is called with `IntentRequest.target.app` and more than one handler exists for the specified intent name (either `app` or `instance` handlers)
25
+ fix!: G4E-11099 properly validate action existence in `notifications.click()` function.
26
+ fix: G4E-11032 discover interop methods as intents only when they have both the `Tick42.FDC3.Intents.` prefix and the `flags.intent` metadata
27
+ fix: G4E-11070 use `RegisterIntentRequest` instead of `AddIntentListenerRequest` since it's no longer a valid type
28
+ fix!: G4E-8926 corrected the incorrectly declared return type of `interop.unregister()` from `void` to `Promise<void>` (no runtime behavior change, type-only change)
29
+ fix: a window moved to another workspace with `moveTo()` now keeps its window context when that workspace is hibernated and resumed
30
+ chore!: G4E-11488 ship the package as an ES module only - removed the UMD bundle (`browser.platform.umd.js`), added `"type": "module"` and an `exports` map that exposes only the package root and `package.json`
31
+ 4.6.0
32
+ feat: G4E-7845 Added a configuration option for overflowable tabs in Workspaces
33
+ fix: platform initialization now falls back to simple client when started via iframes-api
1
34
  4.5.1
2
35
  fix: Fixed the state controller startup to avoid refreshing window references for non-io standalone iframe clients.
3
36
  4.5.0
4
37
  feat: G4E-10515 add support for iframes-api
5
38
  feat: G4E-10030 Add a layouts API method that returns lists of applications, workspaces and workspace windows
39
+ feat: G4E-11069 Add Intents metadata support - extend `IntentRequest` and callback passed to `register` args with `metadata` field
6
40
  fix: G4E-10767 Notifications configure operation returns the updated notification configuration.
7
41
  fix: G4E-10762 channels restrictAll() now resolves with undefined instead of an empty object, aligning its return contract with io.CD.
8
42
  fix: G4E-10635 Enforced stricter URL validation for app definitions and io.windows.open() URLs. URLs with unsafe protocols ("data:", "javascript:", "vbscript:") are now rejected.