@openfin/core-web 0.42.19 → 0.42.21

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 +1 @@
1
- "use strict";var e=require("./main-fe2d0066.js");require("buffer/"),require("uuid"),require("events"),require("lodash/cloneDeep"),require("lodash/isEqual"),exports.connect=e.connect;
1
+ "use strict";var e=require("./main-bc9663c8.js");require("buffer/"),require("uuid"),require("events"),require("lodash/cloneDeep"),require("lodash/isEqual"),exports.connect=e.connect;
@@ -33,7 +33,7 @@ export declare type BaseConnectionOptions = {
33
33
  *
34
34
  * ### Supported APIs
35
35
  *
36
- * * fin.InterApplicationBus.Channels
36
+ * * fin.InterApplicationBus.Channel
37
37
  * * fin.Interop
38
38
  * * fin.me.identity
39
39
  * * fin.Platform.Layout.init
@@ -57,13 +57,13 @@ declare type GL2Types = OpenFin.LayoutEntityTypes | 'component' | 'root' | 'grou
57
57
 
58
58
  export declare type InheritModeConnectConfig = BaseConfig & {
59
59
  /**
60
- * @defaultValue 'disabled'
61
- *
62
60
  * If 'enabled', attempts to inherit connection options if it is running as a View within an OpenFin WebLayout.
63
61
  * This means that the `brokerUrl` and `Identity` of the connection will be determined by the WebBroker
64
62
  * of the page where the WebLayout is instantiated via `fin.Platform.Layout.init()` call.
65
63
  *
66
64
  * If 'disabled', the `options` property is required.
65
+ *
66
+ * @defaultValue 'disabled'
67
67
  */
68
68
  connectionInheritance: 'enabled';
69
69
  /**
@@ -82,13 +82,14 @@ export declare type InheritModeConnectConfig = BaseConfig & {
82
82
 
83
83
  export declare type StandAloneConnectConfig = BaseConfig & {
84
84
  /**
85
- * @defaultValue 'disabled'
86
85
  *
87
86
  * If 'enabled', attempts to inherit connection options if it is running as a View within an OpenFin WebLayout.
88
87
  * This means that the `brokerUrl` and `Identity` of the connection will be determined by the WebBroker
89
88
  * of the page where the WebLayout is instantiated via `fin.Platform.Layout.init()` call.
90
89
  *
91
90
  * If 'disabled', the `options` property is required.
91
+ *
92
+ * @defaultValue 'disabled'
92
93
  */
93
94
  connectionInheritance?: 'disabled';
94
95
  /**
@@ -1 +1 @@
1
- export{g as connect}from"./main-50d34168.js";import"buffer/";import"uuid";import"events";import"lodash/cloneDeep";import"lodash/isEqual";
1
+ export{k as connect}from"./main-d49ba3d1.js";import"buffer/";import"uuid";import"events";import"lodash/cloneDeep";import"lodash/isEqual";
@@ -1,6 +1,6 @@
1
1
  <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>connect | @openfin/core-web</title><meta name="description" content="Documentation for @openfin/core-web"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@openfin/core-web</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@openfin/core-web</a></li><li><a href="../modules/_openfin_core_web.html">@openfin/core-web</a></li><li><a href="_openfin_core_web.connect.html">connect</a></li></ul><h1>Function connect</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><a id="md:connectconnectconfig-connectconfig" class="tsd-anchor"></a><h2 class="tsd-anchor-link">connect(connectConfig: ConnectConfig)<a href="#md:connectconnectconfig-connectconfig" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Establishes a connection to an OpenFin Web Interop Broker, returning a fin object that supports a subset of APIS.</p>
2
2
  <a id="md:supported-apis" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Supported APIs<a href="#md:supported-apis" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul>
3
- <li>fin.InterApplicationBus.Channels</li>
3
+ <li>fin.InterApplicationBus.Channel</li>
4
4
  <li>fin.Interop</li>
5
5
  <li>fin.me.identity</li>
6
6
  <li>fin.Platform.Layout.init</li>
@@ -1,8 +1,10 @@
1
- <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>InheritModeConnectConfig | @openfin/core-web</title><meta name="description" content="Documentation for @openfin/core-web"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@openfin/core-web</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@openfin/core-web</a></li><li><a href="../modules/_openfin_core_web.html">@openfin/core-web</a></li><li><a href="_openfin_core_web.InheritModeConnectConfig.html">InheritModeConnectConfig</a></li></ul><h1>Type Alias InheritModeConnectConfig</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Inherit<wbr/>Mode<wbr/>Connect<wbr/>Config</span><span class="tsd-signature-symbol">:</span> <a href="_openfin_core_web.BaseConfig.html" class="tsd-signature-type tsd-kind-type-alias">BaseConfig</a><span class="tsd-signature-symbol"> &amp; </span><span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">connectionInheritance</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">&quot;enabled&quot;</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">options</span><span class="tsd-signature-symbol">?: </span><a href="_openfin_core_web.BaseConnectionOptions.html" class="tsd-signature-type tsd-kind-type-alias">BaseConnectionOptions</a><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">validateOptions</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">inheritedOptions</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Omit</span><span class="tsd-signature-symbol">&lt;</span><a href="_openfin_core_web.BaseConnectionOptions.html" class="tsd-signature-type tsd-kind-type-alias">BaseConnectionOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">&quot;timeout&quot;</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">connection<wbr/>Inheritance</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">&quot;enabled&quot;</span></h5><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Default Value" class="tsd-anchor"></a>Default Value<a href="#Default Value" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>'disabled'</p>
2
- <p>If 'enabled', attempts to inherit connection options if it is running as a View within an OpenFin WebLayout.
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>InheritModeConnectConfig | @openfin/core-web</title><meta name="description" content="Documentation for @openfin/core-web"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@openfin/core-web</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@openfin/core-web</a></li><li><a href="../modules/_openfin_core_web.html">@openfin/core-web</a></li><li><a href="_openfin_core_web.InheritModeConnectConfig.html">InheritModeConnectConfig</a></li></ul><h1>Type Alias InheritModeConnectConfig</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Inherit<wbr/>Mode<wbr/>Connect<wbr/>Config</span><span class="tsd-signature-symbol">:</span> <a href="_openfin_core_web.BaseConfig.html" class="tsd-signature-type tsd-kind-type-alias">BaseConfig</a><span class="tsd-signature-symbol"> &amp; </span><span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">connectionInheritance</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">&quot;enabled&quot;</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">options</span><span class="tsd-signature-symbol">?: </span><a href="_openfin_core_web.BaseConnectionOptions.html" class="tsd-signature-type tsd-kind-type-alias">BaseConnectionOptions</a><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">validateOptions</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">inheritedOptions</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Omit</span><span class="tsd-signature-symbol">&lt;</span><a href="_openfin_core_web.BaseConnectionOptions.html" class="tsd-signature-type tsd-kind-type-alias">BaseConnectionOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">&quot;timeout&quot;</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">connection<wbr/>Inheritance</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">&quot;enabled&quot;</span></h5><div class="tsd-comment tsd-typography"><p>If 'enabled', attempts to inherit connection options if it is running as a View within an OpenFin WebLayout.
3
2
  This means that the <code>brokerUrl</code> and <code>Identity</code> of the connection will be determined by the WebBroker
4
3
  of the page where the WebLayout is instantiated via <code>fin.Platform.Layout.init()</code> call.</p>
5
4
  <p>If 'disabled', the <code>options</code> property is required.</p>
5
+ </div><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Default Value" class="tsd-anchor"></a>Default Value<a href="#Default Value" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-2">&#39;disabled&#39;</span>
6
+ </code><button type="button">Copy</button></pre>
7
+
6
8
  </div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">options</span><span class="tsd-signature-symbol">?: </span><a href="_openfin_core_web.BaseConnectionOptions.html" class="tsd-signature-type tsd-kind-type-alias">BaseConnectionOptions</a></h5><div class="tsd-comment tsd-typography"><p>Options used to connect to an OpenFin Web Broker. Please note, these will be overriden if connectionInheritance
7
9
  is 'enabled' and supported for the current browsing context. In the case that inherited options are unavailable,
8
10
  these options will be used.</p>
@@ -1,7 +1,9 @@
1
- <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>StandAloneConnectConfig | @openfin/core-web</title><meta name="description" content="Documentation for @openfin/core-web"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@openfin/core-web</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@openfin/core-web</a></li><li><a href="../modules/_openfin_core_web.html">@openfin/core-web</a></li><li><a href="_openfin_core_web.StandAloneConnectConfig.html">StandAloneConnectConfig</a></li></ul><h1>Type Alias StandAloneConnectConfig</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Stand<wbr/>Alone<wbr/>Connect<wbr/>Config</span><span class="tsd-signature-symbol">:</span> <a href="_openfin_core_web.BaseConfig.html" class="tsd-signature-type tsd-kind-type-alias">BaseConfig</a><span class="tsd-signature-symbol"> &amp; </span><span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">connectionInheritance</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">&quot;disabled&quot;</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">options</span><span class="tsd-signature-symbol">: </span><a href="_openfin_core_web.BaseConnectionOptions.html" class="tsd-signature-type tsd-kind-type-alias">BaseConnectionOptions</a><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">connection<wbr/>Inheritance</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">&quot;disabled&quot;</span></h5><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Default Value" class="tsd-anchor"></a>Default Value<a href="#Default Value" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>'disabled'</p>
2
- <p>If 'enabled', attempts to inherit connection options if it is running as a View within an OpenFin WebLayout.
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>StandAloneConnectConfig | @openfin/core-web</title><meta name="description" content="Documentation for @openfin/core-web"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@openfin/core-web</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@openfin/core-web</a></li><li><a href="../modules/_openfin_core_web.html">@openfin/core-web</a></li><li><a href="_openfin_core_web.StandAloneConnectConfig.html">StandAloneConnectConfig</a></li></ul><h1>Type Alias StandAloneConnectConfig</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Stand<wbr/>Alone<wbr/>Connect<wbr/>Config</span><span class="tsd-signature-symbol">:</span> <a href="_openfin_core_web.BaseConfig.html" class="tsd-signature-type tsd-kind-type-alias">BaseConfig</a><span class="tsd-signature-symbol"> &amp; </span><span class="tsd-signature-symbol">{ </span><br/><span>    </span><span class="tsd-kind-property">connectionInheritance</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">&quot;disabled&quot;</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><span class="tsd-kind-property">options</span><span class="tsd-signature-symbol">: </span><a href="_openfin_core_web.BaseConnectionOptions.html" class="tsd-signature-type tsd-kind-type-alias">BaseConnectionOptions</a><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">connection<wbr/>Inheritance</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">&quot;disabled&quot;</span></h5><div class="tsd-comment tsd-typography"><p>If 'enabled', attempts to inherit connection options if it is running as a View within an OpenFin WebLayout.
3
2
  This means that the <code>brokerUrl</code> and <code>Identity</code> of the connection will be determined by the WebBroker
4
3
  of the page where the WebLayout is instantiated via <code>fin.Platform.Layout.init()</code> call.</p>
5
4
  <p>If 'disabled', the <code>options</code> property is required.</p>
5
+ </div><div class="tsd-comment tsd-typography"><h4 class="tsd-anchor-link"><a id="Default Value" class="tsd-anchor"></a>Default Value<a href="#Default Value" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-2">&#39;disabled&#39;</span>
6
+ </code><button type="button">Copy</button></pre>
7
+
6
8
  </div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">options</span><span class="tsd-signature-symbol">: </span><a href="_openfin_core_web.BaseConnectionOptions.html" class="tsd-signature-type tsd-kind-type-alias">BaseConnectionOptions</a></h5><div class="tsd-comment tsd-typography"><p>Options used to connect to an OpenFin Web Broker. Mandatory if StandAloneConnectConfig.connectionInheritance is 'disabled'.</p>
7
9
  </div><div class="tsd-comment tsd-typography"></div></li></ul></div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@openfin/core-web</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -1 +1 @@
1
- "use strict";const e="web-broker-ports-ready",t="worker-initialize-connection",r="create-fallback-connection",i="request-fallback-connection",o=e=>`ack-${e}`,n=new Map([["debug",0],["info",1],["warn",2],["error",3],["none",4]]);class s{static setGlobalLogLevel(e){s.LOG_LEVEL=e??"error"}constructor(...e){this.scopes=e}log(e,...t){const r=n.get(e)??3;var i;(n.get(s.LOG_LEVEL)??3)<=r&&console.log(`[${(new Date).toISOString()}]`,...(i=this.scopes,i.map((e=>`[${e}]`))),...t)}warn(...e){this.log("warn",...e)}error(...e){this.log("error",...e)}info(...e){this.log("info",...e)}debug(...e){this.log("debug",...e)}static getLogger(...e){return new s(...e)}getLogger(...e){return new s(...this.scopes,...e)}}s.LOG_LEVEL="error",s.getLogger("@openfin/core-web/client");const a=e=>window.top===e,c=(e,t)=>{try{return e.origin===t.origin}catch(e){return!1}},d="openfin/web-shared-worker";class l{static get lockApi(){return navigator.locks}constructor(e){this.name=e,this.releaseCallback=null,l.pending.add(this),this.lockAcquiredPromise=new Promise(((e,t)=>{this.lockReleasedPromise=l.lockApi.request(this.name,(()=>(l.pending.delete(this),e(),new Promise((e=>{l.held.add(this),this.releaseCallback=e}))))).catch((e=>{throw t(e),e}))}))}async acquired(){await this.lockAcquiredPromise}async release(){if(!this.releaseCallback)throw new Error(`Lock ${this.name} not acquired.`);this.releaseCallback(),this.releaseCallback=null,await this.lockReleasedPromise,l.held.delete(this)}async onReleased(e){if(!this.lockReleasedPromise)throw new Error(`Lock ${this.name} not queued.`);return this.lockReleasedPromise.then(e)}autoRelease(){this.acquired().then((()=>this.release()))}static async releaseAll(){const e=Promise.all([...this.pending].map((async e=>{await e.acquired(),await e.release()})));await Promise.all([...this.held].map((async e=>{await e.release()}))),await e}}l.pending=new Set,l.held=new Set;class h{constructor(e=100,t=2){this.pingIntervalMs=e,this.allowedMissedPings=t,this.lockSelf=async e=>{const t=new l((e=>`__OPENFIN__${e.uuid}_${e.name}`)(e));return await t.acquired(),t}}async lockProxiedConnection(e,t){let r=0;t.addEventListener("message",(e=>{"pong"===e.data.topic&&r--}));const i=await this.lockSelf(e);let o=setInterval((()=>{r>=this.allowedMissedPings?(i.release(),clearInterval(o)):(r++,t.postMessage({topic:"ping"}))}),this.pingIntervalMs);t.start()}registerProxiedConnection(e){e.addEventListener("message",(t=>{"ping"===t.data.topic&&e.postMessage({topic:"pong"})})),e.start()}}class w{constructor(e,t,n){this.workerUrl=e,this.iframeWindow=t,this.forceWorker=n,this.identityDisconnectionController=new h,this.isSharedWorkerSupported=()=>!this.forceWorker&&!!window.SharedWorker,this.state="ready",this.establishWorkerConnectionViaWindow=async(e,t)=>{if(c(this.iframeWindow,e)){const n=new MessageChannel,s=new MessageChannel;return this.identityDisconnectionController.registerProxiedConnection(s.port1),new Promise(((a,c)=>{n.port1.addEventListener("message",(e=>{e.data.topic===o(r)&&(e.data.success?a(n.port1):c(e.data.reason))})),n.port1.start();const d={topic:i,payload:{identity:t}};e.postMessage(d,location.origin,[n.port2,s.port2])}))}throw new Error("Could not connect via top level browsing context as its origin does not much the web interop broker.")},this.listenForNestedConnections=e=>{"top-window"===this.state&&c(this.iframeWindow,this.iframeWindow.parent)&&this.iframeWindow.parent.addEventListener("message",(async t=>{const{data:o}=t;if(t.origin===location.origin&&o.topic===i){const[i,...n]=t.ports;if(n.length>0&&o.payload?.identity){const[e]=n;await this.identityDisconnectionController.lockProxiedConnection(o.payload.identity,e)}const s={topic:r};e.postMessage(s,[i])}}))},this.initialize=async e=>{if("ready"!==this.state)throw new Error("Worker connection already initialized");return(e=>{const t=r=>!(!(e=>{try{return!e.origin}catch(e){return!0}})(r)&&r.origin===e.origin)||!a(r)&&t(r.parent);return!a(e)&&t(e.parent)})(this.iframeWindow)&&c(this.iframeWindow,this.iframeWindow.top)?this.state="partitioned-frame":a(this.iframeWindow.parent)?this.state="top-window":this.state="frame",this.connect(e)}}async connect(e){if("ready"===this.state)throw new Error("Must call initialize before connect");switch(this.state){case"partitioned-frame":return this.establishWorkerConnectionViaWindow(this.iframeWindow.top,e);case"top-window":{let t;return t=this.isSharedWorkerSupported()?new SharedWorker(this.workerUrl,d).port:new Worker(this.workerUrl),await this.identityDisconnectionController.lockSelf(e),this.listenForNestedConnections(t),t}case"frame":{if(!this.isSharedWorkerSupported())try{return await this.establishWorkerConnectionViaWindow(this.iframeWindow.top,e)}catch(e){throw new Error(`SharedWorker is not supported and an unexpected error occured when trying to connect via fallback mechanism: ${e.message}`,{cause:e})}await this.identityDisconnectionController.lockSelf(e);const{port:t}=new SharedWorker(this.workerUrl,d);return t}default:throw this.state,new Error(`Invalid state: ${this.state}`)}}}const p=s.getLogger("@openfin/core-web/iframe-broker"),g=()=>{const e=((e,t)=>{const r=new RegExp(`^${t}<(?<meta>.*)>$`).exec(e)?.groups?.meta;if(r)try{return JSON.parse(atob(r))}catch(e){throw new Error(`Failed to decode JSON from ${r}.`)}})(window.name,"of-broker");if(!e)throw new Error("Invalid or missing identity string in iframe context. Ensure that this iframe is being renderered via the @openfin/core-web library.");return e};function u(t){const r={topic:o(e),success:!1,reason:t?.reason??"Connection Rejected"};window.parent.postMessage(r,"*")}exports.init=async r=>{try{s.setGlobalLogLevel(r.logLevel??"error");const{sharedWorkerUrl:i}=r;await("loading"===document.readyState?new Promise((e=>{const t=()=>{e(),window.removeEventListener("DOMContentLoaded",t)};window.addEventListener("DOMContentLoaded",t)})):Promise.resolve());const n=g(),a=new w(i,window,"same-site"!==r.experimental?.crossTab),c=await a.initialize(n);p.info(`Loading ${i} in ${a.state} mode...`);const d=await(async(r,i,n)=>{const s=new MessageChannel,a=new MessageChannel,c={topic:t,payload:{identity:n}};await new Promise(((e,r)=>{i.addEventListener("message",(i=>{i.data.topic===o(t)&&(i.data.success?e():r(new Error(i.data.reason)))})),i.start?.(),i.postMessage(c,[a.port2])}));const d={topic:o(e),success:!0,payload:{identity:n}};return r.postMessage(d,"*",[s.port2,a.port1]),s.port1})(window.parent,c,n);d.start(),c.start?.(),p.debug(`Port transfer complete in ${a.state} mode. Connection established with identity ${JSON.stringify(n)}. SharedWorker support=${a.isSharedWorkerSupported()}`)}catch(e){const t=new Error(`An unexpected error occured during initialization. ${e.message}`);u({reason:t.message}),console.error(t)}},exports.rejectConnections=u;
1
+ "use strict";const e=(e,t)=>{try{return e.origin===t.origin}catch(e){return!1}},t="web-broker-ports-ready",r="worker-initialize-connection",i="create-fallback-connection",o="request-fallback-connection",n=e=>`ack-${e}`,s=new Map([["debug",0],["info",1],["warn",2],["error",3],["none",4]]);class a{static setGlobalLogLevel(e){a.LOG_LEVEL=e??"error"}constructor(...e){this.scopes=e}log(e,...t){const r=s.get(e)??3;var i;(s.get(a.LOG_LEVEL)??3)<=r&&console.log(`[${(new Date).toISOString()}]`,...(i=this.scopes,i.map((e=>`[${e}]`))),...t)}warn(...e){this.log("warn",...e)}error(...e){this.log("error",...e)}info(...e){this.log("info",...e)}debug(...e){this.log("debug",...e)}static getLogger(...e){return new a(...e)}getLogger(...e){return new a(...this.scopes,...e)}}a.LOG_LEVEL="error",a.getLogger("@openfin/core-web/client");const c="openfin/web-shared-worker",d=e=>window.top===e;class l{static get lockApi(){return navigator.locks}constructor(e){this.name=e,this.releaseCallback=null,l.pending.add(this),this.lockAcquiredPromise=new Promise(((e,t)=>{this.lockReleasedPromise=l.lockApi.request(this.name,(()=>(l.pending.delete(this),e(),new Promise((e=>{l.held.add(this),this.releaseCallback=e}))))).catch((e=>{throw t(e),e}))}))}async acquired(){await this.lockAcquiredPromise}async release(){if(!this.releaseCallback)throw new Error(`Lock ${this.name} not acquired.`);this.releaseCallback(),this.releaseCallback=null,await this.lockReleasedPromise,l.held.delete(this)}async onReleased(e){if(!this.lockReleasedPromise)throw new Error(`Lock ${this.name} not queued.`);return this.lockReleasedPromise.then(e)}autoRelease(){this.acquired().then((()=>this.release()))}static async releaseAll(){const e=Promise.all([...this.pending].map((async e=>{await e.acquired(),await e.release()})));await Promise.all([...this.held].map((async e=>{await e.release()}))),await e}}l.pending=new Set,l.held=new Set;class h{constructor(e=100,t=2){this.pingIntervalMs=e,this.allowedMissedPings=t,this.lockSelf=async e=>{const t=new l((e=>`__OPENFIN__${e.uuid}_${e.name}`)(e));return await t.acquired(),t}}async lockProxiedConnection(e,t){let r=0;t.addEventListener("message",(e=>{"pong"===e.data.topic&&r--}));const i=await this.lockSelf(e);let o=setInterval((()=>{r>=this.allowedMissedPings?(i.release(),clearInterval(o)):(r++,t.postMessage({topic:"ping"}))}),this.pingIntervalMs);t.start()}registerProxiedConnection(e){e.addEventListener("message",(t=>{"ping"===t.data.topic&&e.postMessage({topic:"pong"})})),e.start()}}class w{constructor(t,r,s){this.workerUrl=t,this.iframeWindow=r,this.forceWorker=s,this.identityDisconnectionController=new h,this.isSharedWorkerSupported=()=>!this.forceWorker&&!!window.SharedWorker,this.state="ready",this.establishWorkerConnectionViaWindow=async(t,r)=>{if(e(this.iframeWindow,t)){const e=new MessageChannel,s=new MessageChannel;return this.identityDisconnectionController.registerProxiedConnection(s.port1),new Promise(((a,c)=>{e.port1.addEventListener("message",(t=>{t.data.topic===n(i)&&(t.data.success?a(e.port1):c(t.data.reason))})),e.port1.start();const d={topic:o,payload:{identity:r}};t.postMessage(d,location.origin,[e.port2,s.port2])}))}throw new Error("Could not connect via top level browsing context as its origin does not much the web interop broker.")},this.listenForNestedConnections=t=>{"top-window"===this.state&&e(this.iframeWindow,this.iframeWindow.parent)&&this.iframeWindow.parent.addEventListener("message",(async e=>{const{data:r}=e;if(e.origin===location.origin&&r.topic===o){const[o,...n]=e.ports;if(n.length>0&&r.payload?.identity){const[e]=n;await this.identityDisconnectionController.lockProxiedConnection(r.payload.identity,e)}const s={topic:i};t.postMessage(s,[o])}}))},this.initialize=async t=>{if("ready"!==this.state)throw new Error("Worker connection already initialized");return(e=>{const t=r=>!(!(e=>{try{return!e.origin}catch(e){return!0}})(r)&&r.origin===e.origin)||!d(r)&&t(r.parent);return!d(e)&&t(e.parent)})(this.iframeWindow)&&e(this.iframeWindow,this.iframeWindow.top)?this.state="partitioned-frame":d(this.iframeWindow.parent)?this.state="top-window":this.state="frame",this.connect(t)}}async connect(e){if("ready"===this.state)throw new Error("Must call initialize before connect");switch(this.state){case"partitioned-frame":return this.establishWorkerConnectionViaWindow(this.iframeWindow.top,e);case"top-window":{let t;return t=this.isSharedWorkerSupported()?new SharedWorker(this.workerUrl,c).port:new Worker(this.workerUrl),await this.identityDisconnectionController.lockSelf(e),this.listenForNestedConnections(t),t}case"frame":{if(!this.isSharedWorkerSupported())try{return await this.establishWorkerConnectionViaWindow(this.iframeWindow.top,e)}catch(e){throw new Error(`SharedWorker is not supported and an unexpected error occured when trying to connect via fallback mechanism: ${e.message}`,{cause:e})}await this.identityDisconnectionController.lockSelf(e);const{port:t}=new SharedWorker(this.workerUrl,c);return t}default:throw this.state,new Error(`Invalid state: ${this.state}`)}}}const p=a.getLogger("@openfin/core-web/iframe-broker"),g=()=>{const e=((e,t)=>{const r=new RegExp(`^${t}<(?<meta>.*)>$`).exec(e)?.groups?.meta;if(r)try{return JSON.parse(atob(r))}catch(e){throw new Error(`Failed to decode JSON from ${r}.`)}})(window.name,"of-broker");if(!e)throw new Error("Invalid or missing identity string in iframe context. Ensure that this iframe is being renderered via the @openfin/core-web library.");return e};function u(e){const r={topic:n(t),success:!1,reason:e?.reason??"Connection Rejected"};window.parent.postMessage(r,"*")}exports.init=async e=>{try{a.setGlobalLogLevel(e.logLevel??"error");const{sharedWorkerUrl:i}=e;await("loading"===document.readyState?new Promise((e=>{const t=()=>{e(),window.removeEventListener("DOMContentLoaded",t)};window.addEventListener("DOMContentLoaded",t)})):Promise.resolve());const o=g(),s=new w(i,window,"same-site"!==e.experimental?.crossTab),c=await s.initialize(o);p.info(`Loading ${i} in ${s.state} mode...`);const d=await(async(e,i,o)=>{const s=new MessageChannel,a=new MessageChannel,c={topic:r,payload:{identity:o}};await new Promise(((e,t)=>{i.addEventListener("message",(i=>{i.data.topic===n(r)&&(i.data.success?e():t(new Error(i.data.reason)))})),i.start?.(),i.postMessage(c,[a.port2])}));const d={topic:n(t),success:!0,payload:{identity:o}};return e.postMessage(d,"*",[s.port2,a.port1]),s.port1})(window.parent,c,o);d.start(),c.start?.(),p.debug(`Port transfer complete in ${s.state} mode. Connection established with identity ${JSON.stringify(o)}. SharedWorker support=${s.isSharedWorkerSupported()}`)}catch(e){const t=new Error(`An unexpected error occured during initialization. ${e.message}`);u({reason:t.message}),console.error(t)}},exports.rejectConnections=u;
@@ -1 +1 @@
1
- const e="web-broker-ports-ready",t="worker-initialize-connection",r="create-fallback-connection",i="request-fallback-connection",o=e=>`ack-${e}`,n=new Map([["debug",0],["info",1],["warn",2],["error",3],["none",4]]);class s{static setGlobalLogLevel(e){s.LOG_LEVEL=e??"error"}constructor(...e){this.scopes=e}log(e,...t){const r=n.get(e)??3;var i;(n.get(s.LOG_LEVEL)??3)<=r&&console.log(`[${(new Date).toISOString()}]`,...(i=this.scopes,i.map((e=>`[${e}]`))),...t)}warn(...e){this.log("warn",...e)}error(...e){this.log("error",...e)}info(...e){this.log("info",...e)}debug(...e){this.log("debug",...e)}static getLogger(...e){return new s(...e)}getLogger(...e){return new s(...this.scopes,...e)}}s.LOG_LEVEL="error",s.getLogger("@openfin/core-web/client");const a=e=>window.top===e,c=(e,t)=>{try{return e.origin===t.origin}catch(e){return!1}},d="openfin/web-shared-worker";class l{static get lockApi(){return navigator.locks}constructor(e){this.name=e,this.releaseCallback=null,l.pending.add(this),this.lockAcquiredPromise=new Promise(((e,t)=>{this.lockReleasedPromise=l.lockApi.request(this.name,(()=>(l.pending.delete(this),e(),new Promise((e=>{l.held.add(this),this.releaseCallback=e}))))).catch((e=>{throw t(e),e}))}))}async acquired(){await this.lockAcquiredPromise}async release(){if(!this.releaseCallback)throw new Error(`Lock ${this.name} not acquired.`);this.releaseCallback(),this.releaseCallback=null,await this.lockReleasedPromise,l.held.delete(this)}async onReleased(e){if(!this.lockReleasedPromise)throw new Error(`Lock ${this.name} not queued.`);return this.lockReleasedPromise.then(e)}autoRelease(){this.acquired().then((()=>this.release()))}static async releaseAll(){const e=Promise.all([...this.pending].map((async e=>{await e.acquired(),await e.release()})));await Promise.all([...this.held].map((async e=>{await e.release()}))),await e}}l.pending=new Set,l.held=new Set;class h{constructor(e=100,t=2){this.pingIntervalMs=e,this.allowedMissedPings=t,this.lockSelf=async e=>{const t=new l((e=>`__OPENFIN__${e.uuid}_${e.name}`)(e));return await t.acquired(),t}}async lockProxiedConnection(e,t){let r=0;t.addEventListener("message",(e=>{"pong"===e.data.topic&&r--}));const i=await this.lockSelf(e);let o=setInterval((()=>{r>=this.allowedMissedPings?(i.release(),clearInterval(o)):(r++,t.postMessage({topic:"ping"}))}),this.pingIntervalMs);t.start()}registerProxiedConnection(e){e.addEventListener("message",(t=>{"ping"===t.data.topic&&e.postMessage({topic:"pong"})})),e.start()}}class w{constructor(e,t,n){this.workerUrl=e,this.iframeWindow=t,this.forceWorker=n,this.identityDisconnectionController=new h,this.isSharedWorkerSupported=()=>!this.forceWorker&&!!window.SharedWorker,this.state="ready",this.establishWorkerConnectionViaWindow=async(e,t)=>{if(c(this.iframeWindow,e)){const n=new MessageChannel,s=new MessageChannel;return this.identityDisconnectionController.registerProxiedConnection(s.port1),new Promise(((a,c)=>{n.port1.addEventListener("message",(e=>{e.data.topic===o(r)&&(e.data.success?a(n.port1):c(e.data.reason))})),n.port1.start();const d={topic:i,payload:{identity:t}};e.postMessage(d,location.origin,[n.port2,s.port2])}))}throw new Error("Could not connect via top level browsing context as its origin does not much the web interop broker.")},this.listenForNestedConnections=e=>{"top-window"===this.state&&c(this.iframeWindow,this.iframeWindow.parent)&&this.iframeWindow.parent.addEventListener("message",(async t=>{const{data:o}=t;if(t.origin===location.origin&&o.topic===i){const[i,...n]=t.ports;if(n.length>0&&o.payload?.identity){const[e]=n;await this.identityDisconnectionController.lockProxiedConnection(o.payload.identity,e)}const s={topic:r};e.postMessage(s,[i])}}))},this.initialize=async e=>{if("ready"!==this.state)throw new Error("Worker connection already initialized");return(e=>{const t=r=>!(!(e=>{try{return!e.origin}catch(e){return!0}})(r)&&r.origin===e.origin)||!a(r)&&t(r.parent);return!a(e)&&t(e.parent)})(this.iframeWindow)&&c(this.iframeWindow,this.iframeWindow.top)?this.state="partitioned-frame":a(this.iframeWindow.parent)?this.state="top-window":this.state="frame",this.connect(e)}}async connect(e){if("ready"===this.state)throw new Error("Must call initialize before connect");switch(this.state){case"partitioned-frame":return this.establishWorkerConnectionViaWindow(this.iframeWindow.top,e);case"top-window":{let t;return t=this.isSharedWorkerSupported()?new SharedWorker(this.workerUrl,d).port:new Worker(this.workerUrl),await this.identityDisconnectionController.lockSelf(e),this.listenForNestedConnections(t),t}case"frame":{if(!this.isSharedWorkerSupported())try{return await this.establishWorkerConnectionViaWindow(this.iframeWindow.top,e)}catch(e){throw new Error(`SharedWorker is not supported and an unexpected error occured when trying to connect via fallback mechanism: ${e.message}`,{cause:e})}await this.identityDisconnectionController.lockSelf(e);const{port:t}=new SharedWorker(this.workerUrl,d);return t}default:throw this.state,new Error(`Invalid state: ${this.state}`)}}}const p=s.getLogger("@openfin/core-web/iframe-broker"),g=()=>{const e=((e,t)=>{const r=new RegExp(`^${t}<(?<meta>.*)>$`).exec(e)?.groups?.meta;if(r)try{return JSON.parse(atob(r))}catch(e){throw new Error(`Failed to decode JSON from ${r}.`)}})(window.name,"of-broker");if(!e)throw new Error("Invalid or missing identity string in iframe context. Ensure that this iframe is being renderered via the @openfin/core-web library.");return e};function u(t){const r={topic:o(e),success:!1,reason:t?.reason??"Connection Rejected"};window.parent.postMessage(r,"*")}const m=async r=>{try{s.setGlobalLogLevel(r.logLevel??"error");const{sharedWorkerUrl:i}=r;await("loading"===document.readyState?new Promise((e=>{const t=()=>{e(),window.removeEventListener("DOMContentLoaded",t)};window.addEventListener("DOMContentLoaded",t)})):Promise.resolve());const n=g(),a=new w(i,window,"same-site"!==r.experimental?.crossTab),c=await a.initialize(n);p.info(`Loading ${i} in ${a.state} mode...`);const d=await(async(r,i,n)=>{const s=new MessageChannel,a=new MessageChannel,c={topic:t,payload:{identity:n}};await new Promise(((e,r)=>{i.addEventListener("message",(i=>{i.data.topic===o(t)&&(i.data.success?e():r(new Error(i.data.reason)))})),i.start?.(),i.postMessage(c,[a.port2])}));const d={topic:o(e),success:!0,payload:{identity:n}};return r.postMessage(d,"*",[s.port2,a.port1]),s.port1})(window.parent,c,n);d.start(),c.start?.(),p.debug(`Port transfer complete in ${a.state} mode. Connection established with identity ${JSON.stringify(n)}. SharedWorker support=${a.isSharedWorkerSupported()}`)}catch(e){const t=new Error(`An unexpected error occured during initialization. ${e.message}`);u({reason:t.message}),console.error(t)}};export{m as init,u as rejectConnections};
1
+ const e=(e,t)=>{try{return e.origin===t.origin}catch(e){return!1}},t="web-broker-ports-ready",r="worker-initialize-connection",i="create-fallback-connection",o="request-fallback-connection",n=e=>`ack-${e}`,s=new Map([["debug",0],["info",1],["warn",2],["error",3],["none",4]]);class a{static setGlobalLogLevel(e){a.LOG_LEVEL=e??"error"}constructor(...e){this.scopes=e}log(e,...t){const r=s.get(e)??3;var i;(s.get(a.LOG_LEVEL)??3)<=r&&console.log(`[${(new Date).toISOString()}]`,...(i=this.scopes,i.map((e=>`[${e}]`))),...t)}warn(...e){this.log("warn",...e)}error(...e){this.log("error",...e)}info(...e){this.log("info",...e)}debug(...e){this.log("debug",...e)}static getLogger(...e){return new a(...e)}getLogger(...e){return new a(...this.scopes,...e)}}a.LOG_LEVEL="error",a.getLogger("@openfin/core-web/client");const c="openfin/web-shared-worker",d=e=>window.top===e;class l{static get lockApi(){return navigator.locks}constructor(e){this.name=e,this.releaseCallback=null,l.pending.add(this),this.lockAcquiredPromise=new Promise(((e,t)=>{this.lockReleasedPromise=l.lockApi.request(this.name,(()=>(l.pending.delete(this),e(),new Promise((e=>{l.held.add(this),this.releaseCallback=e}))))).catch((e=>{throw t(e),e}))}))}async acquired(){await this.lockAcquiredPromise}async release(){if(!this.releaseCallback)throw new Error(`Lock ${this.name} not acquired.`);this.releaseCallback(),this.releaseCallback=null,await this.lockReleasedPromise,l.held.delete(this)}async onReleased(e){if(!this.lockReleasedPromise)throw new Error(`Lock ${this.name} not queued.`);return this.lockReleasedPromise.then(e)}autoRelease(){this.acquired().then((()=>this.release()))}static async releaseAll(){const e=Promise.all([...this.pending].map((async e=>{await e.acquired(),await e.release()})));await Promise.all([...this.held].map((async e=>{await e.release()}))),await e}}l.pending=new Set,l.held=new Set;class h{constructor(e=100,t=2){this.pingIntervalMs=e,this.allowedMissedPings=t,this.lockSelf=async e=>{const t=new l((e=>`__OPENFIN__${e.uuid}_${e.name}`)(e));return await t.acquired(),t}}async lockProxiedConnection(e,t){let r=0;t.addEventListener("message",(e=>{"pong"===e.data.topic&&r--}));const i=await this.lockSelf(e);let o=setInterval((()=>{r>=this.allowedMissedPings?(i.release(),clearInterval(o)):(r++,t.postMessage({topic:"ping"}))}),this.pingIntervalMs);t.start()}registerProxiedConnection(e){e.addEventListener("message",(t=>{"ping"===t.data.topic&&e.postMessage({topic:"pong"})})),e.start()}}class w{constructor(t,r,s){this.workerUrl=t,this.iframeWindow=r,this.forceWorker=s,this.identityDisconnectionController=new h,this.isSharedWorkerSupported=()=>!this.forceWorker&&!!window.SharedWorker,this.state="ready",this.establishWorkerConnectionViaWindow=async(t,r)=>{if(e(this.iframeWindow,t)){const e=new MessageChannel,s=new MessageChannel;return this.identityDisconnectionController.registerProxiedConnection(s.port1),new Promise(((a,c)=>{e.port1.addEventListener("message",(t=>{t.data.topic===n(i)&&(t.data.success?a(e.port1):c(t.data.reason))})),e.port1.start();const d={topic:o,payload:{identity:r}};t.postMessage(d,location.origin,[e.port2,s.port2])}))}throw new Error("Could not connect via top level browsing context as its origin does not much the web interop broker.")},this.listenForNestedConnections=t=>{"top-window"===this.state&&e(this.iframeWindow,this.iframeWindow.parent)&&this.iframeWindow.parent.addEventListener("message",(async e=>{const{data:r}=e;if(e.origin===location.origin&&r.topic===o){const[o,...n]=e.ports;if(n.length>0&&r.payload?.identity){const[e]=n;await this.identityDisconnectionController.lockProxiedConnection(r.payload.identity,e)}const s={topic:i};t.postMessage(s,[o])}}))},this.initialize=async t=>{if("ready"!==this.state)throw new Error("Worker connection already initialized");return(e=>{const t=r=>!(!(e=>{try{return!e.origin}catch(e){return!0}})(r)&&r.origin===e.origin)||!d(r)&&t(r.parent);return!d(e)&&t(e.parent)})(this.iframeWindow)&&e(this.iframeWindow,this.iframeWindow.top)?this.state="partitioned-frame":d(this.iframeWindow.parent)?this.state="top-window":this.state="frame",this.connect(t)}}async connect(e){if("ready"===this.state)throw new Error("Must call initialize before connect");switch(this.state){case"partitioned-frame":return this.establishWorkerConnectionViaWindow(this.iframeWindow.top,e);case"top-window":{let t;return t=this.isSharedWorkerSupported()?new SharedWorker(this.workerUrl,c).port:new Worker(this.workerUrl),await this.identityDisconnectionController.lockSelf(e),this.listenForNestedConnections(t),t}case"frame":{if(!this.isSharedWorkerSupported())try{return await this.establishWorkerConnectionViaWindow(this.iframeWindow.top,e)}catch(e){throw new Error(`SharedWorker is not supported and an unexpected error occured when trying to connect via fallback mechanism: ${e.message}`,{cause:e})}await this.identityDisconnectionController.lockSelf(e);const{port:t}=new SharedWorker(this.workerUrl,c);return t}default:throw this.state,new Error(`Invalid state: ${this.state}`)}}}const p=a.getLogger("@openfin/core-web/iframe-broker"),g=()=>{const e=((e,t)=>{const r=new RegExp(`^${t}<(?<meta>.*)>$`).exec(e)?.groups?.meta;if(r)try{return JSON.parse(atob(r))}catch(e){throw new Error(`Failed to decode JSON from ${r}.`)}})(window.name,"of-broker");if(!e)throw new Error("Invalid or missing identity string in iframe context. Ensure that this iframe is being renderered via the @openfin/core-web library.");return e};function u(e){const r={topic:n(t),success:!1,reason:e?.reason??"Connection Rejected"};window.parent.postMessage(r,"*")}const m=async e=>{try{a.setGlobalLogLevel(e.logLevel??"error");const{sharedWorkerUrl:i}=e;await("loading"===document.readyState?new Promise((e=>{const t=()=>{e(),window.removeEventListener("DOMContentLoaded",t)};window.addEventListener("DOMContentLoaded",t)})):Promise.resolve());const o=g(),s=new w(i,window,"same-site"!==e.experimental?.crossTab),c=await s.initialize(o);p.info(`Loading ${i} in ${s.state} mode...`);const d=await(async(e,i,o)=>{const s=new MessageChannel,a=new MessageChannel,c={topic:r,payload:{identity:o}};await new Promise(((e,t)=>{i.addEventListener("message",(i=>{i.data.topic===n(r)&&(i.data.success?e():t(new Error(i.data.reason)))})),i.start?.(),i.postMessage(c,[a.port2])}));const d={topic:n(t),success:!0,payload:{identity:o}};return e.postMessage(d,"*",[s.port2,a.port1]),s.port1})(window.parent,c,o);d.start(),c.start?.(),p.debug(`Port transfer complete in ${s.state} mode. Connection established with identity ${JSON.stringify(o)}. SharedWorker support=${s.isSharedWorkerSupported()}`)}catch(e){const t=new Error(`An unexpected error occured during initialization. ${e.message}`);u({reason:t.message}),console.error(t)}};export{m as init,u as rejectConnections};