@openfin/core-web 0.40.45 → 0.40.46
Sign up to get free protection for your applications and to get access to all the features.
- package/out/api-client.cjs.js +1 -1
- package/out/api-client.d.ts +4 -4
- package/out/api-client.esm.js +1 -1
- package/out/docs/assets/search.js +1 -1
- package/out/docs/types/_openfin_core_web.BaseConfig.html +2 -1
- package/out/docs/types/_openfin_core_web.BaseConnectionOptions.html +1 -2
- package/out/iframe-broker.cjs.js +1 -1
- package/out/iframe-broker.esm.js +1 -1
- package/out/{main-82b863a9.js → main-41d4ffff.js} +2 -2
- package/out/main-811d7e05.js +3 -0
- package/out/{main-bd218f10.js → main-b7e2060a.js} +1 -1
- package/out/{main-e1665e8d.js → main-c383dfb5.js} +1 -1
- package/out/shared-worker.js +1 -1
- package/package.json +2 -2
- package/out/main-67e47f83.js +0 -3
package/out/api-client.cjs.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var e=require("./main-
|
1
|
+
"use strict";var e=require("./main-c383dfb5.js");require("buffer/"),require("uuid"),require("events"),require("lodash/cloneDeep"),require("lodash/isEqual"),exports.connect=e.connect;
|
package/out/api-client.d.ts
CHANGED
@@ -6,6 +6,10 @@ export declare type BaseConfig = {
|
|
6
6
|
* will not work.
|
7
7
|
*/
|
8
8
|
platform?: WebLayoutPlatformOptions;
|
9
|
+
/**
|
10
|
+
* Log level used throughout the connection and messaging process. Defaults to 'error'.
|
11
|
+
*/
|
12
|
+
logLevel?: WebLogLevel;
|
9
13
|
};
|
10
14
|
|
11
15
|
export declare type BaseConnectionOptions = {
|
@@ -21,10 +25,6 @@ export declare type BaseConnectionOptions = {
|
|
21
25
|
* Interop options to use to generate an interop client in `fin.me.interop`
|
22
26
|
*/
|
23
27
|
interopConfig?: Partial<OpenFin.InteropConfig>;
|
24
|
-
/**
|
25
|
-
* Log level used throughout the connection and messaging process. Defaults to 'error'.
|
26
|
-
*/
|
27
|
-
logLevel?: WebLogLevel;
|
28
28
|
};
|
29
29
|
|
30
30
|
/**
|
package/out/api-client.esm.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export{g as connect}from"./main-
|
1
|
+
export{g as connect}from"./main-b7e2060a.js";import"buffer/";import"uuid";import"events";import"lodash/cloneDeep";import"lodash/isEqual";
|
@@ -1 +1 @@
|
|
1
|
-
window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA8WaXW/bNhSG/
|
1
|
+
window.searchData = "data:application/octet-stream;base64,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";
|
@@ -1,3 +1,4 @@
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>BaseConfig | @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.BaseConfig.html">BaseConfig</a></li></ul><h1>Type Alias BaseConfig</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Base<wbr/>Config</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">platform</span><span class="tsd-signature-symbol">?: </span><a href="_openfin_core_web.WebLayoutPlatformOptions.html" class="tsd-signature-type tsd-kind-type-alias">WebLayoutPlatformOptions</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">
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>BaseConfig | @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.BaseConfig.html">BaseConfig</a></li></ul><h1>Type Alias BaseConfig</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Base<wbr/>Config</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">logLevel</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">WebLogLevel</span><span class="tsd-signature-symbol">; </span><br/><span> </span><span class="tsd-kind-property">platform</span><span class="tsd-signature-symbol">?: </span><a href="_openfin_core_web.WebLayoutPlatformOptions.html" class="tsd-signature-type tsd-kind-type-alias">WebLayoutPlatformOptions</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">log<wbr/>Level</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">WebLogLevel</span></h5><div class="tsd-comment tsd-typography"><p>Log level used throughout the connection and messaging process. Defaults to 'error'.</p>
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">platform</span><span class="tsd-signature-symbol">?: </span><a href="_openfin_core_web.WebLayoutPlatformOptions.html" class="tsd-signature-type tsd-kind-type-alias">WebLayoutPlatformOptions</a></h5><div class="tsd-comment tsd-typography"><p>Options used to initialize Web Layouts related features. If omitted, calling <code>fin.Platform.Layout.init()</code>
|
2
3
|
will not work.</p>
|
3
4
|
</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,5 +1,4 @@
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>BaseConnectionOptions | @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.BaseConnectionOptions.html">BaseConnectionOptions</a></li></ul><h1>Type Alias BaseConnectionOptions</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Base<wbr/>Connection<wbr/>Options</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">brokerUrl</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span> </span><span class="tsd-kind-property">interopConfig</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">OpenFin.InteropConfig</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">; </span><br/><span> </span><span class="tsd-kind-property">
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>BaseConnectionOptions | @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.BaseConnectionOptions.html">BaseConnectionOptions</a></li></ul><h1>Type Alias BaseConnectionOptions</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Base<wbr/>Connection<wbr/>Options</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">brokerUrl</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span> </span><span class="tsd-kind-property">interopConfig</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">OpenFin.InteropConfig</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">; </span><br/><span> </span><span class="tsd-kind-property">timeout</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</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">broker<wbr/>Url</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>The URL of the Web Interop broker to connect to.</p>
|
2
2
|
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">interop<wbr/>Config</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">OpenFin.InteropConfig</span><span class="tsd-signature-symbol">></span></h5><div class="tsd-comment tsd-typography"><p>Interop options to use to generate an interop client in <code>fin.me.interop</code></p>
|
3
|
-
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">log<wbr/>Level</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">WebLogLevel</span></h5><div class="tsd-comment tsd-typography"><p>Log level used throughout the connection and messaging process. Defaults to 'error'.</p>
|
4
3
|
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">timeout</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>Tears down and cancels the connection attempt if it is not complete within the specified timeout (in ms).</p>
|
5
4
|
</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>
|
package/out/iframe-broker.cjs.js
CHANGED
@@ -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}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="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;
|
package/out/iframe-broker.esm.js
CHANGED
@@ -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}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="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};
|