@openfin/core 29.72.18 → 29.73.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/OpenFin.d.ts +40 -23
  2. package/package.json +1 -1
  3. package/src/api/application/Factory.js +3 -3
  4. package/src/api/application/index.js +7 -3
  5. package/src/api/base.js +18 -20
  6. package/src/api/external-application/index.js +7 -3
  7. package/src/api/fin.js +2 -2
  8. package/src/api/frame/Factory.js +2 -2
  9. package/src/api/frame/index.js +7 -3
  10. package/src/api/interappbus/channel/client.js +24 -26
  11. package/src/api/interappbus/channel/connection-manager.js +24 -26
  12. package/src/api/interappbus/channel/index.js +16 -18
  13. package/src/api/interappbus/channel/protocols/classic/strategy.js +21 -22
  14. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +24 -26
  15. package/src/api/interappbus/channel/protocols/rtc/strategy.js +29 -31
  16. package/src/api/interappbus/channel/provider.js +134 -139
  17. package/src/api/interappbus/index.js +1 -1
  18. package/src/api/interop/InteropBroker.js +9 -9
  19. package/src/api/interop/InteropClient.js +38 -40
  20. package/src/api/interop/SessionContextGroupClient.js +22 -24
  21. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +17 -0
  22. package/src/api/interop/fdc3/PrivateChannelClient.js +82 -0
  23. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +40 -0
  24. package/src/api/interop/fdc3/PrivateChannelProvider.js +224 -0
  25. package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -1
  26. package/src/api/interop/fdc3/fdc3-1.2.js +1 -27
  27. package/src/api/interop/fdc3/fdc3-2.0.d.ts +20 -1
  28. package/src/api/interop/fdc3/fdc3-2.0.js +29 -4
  29. package/src/api/interop/fdc3/utils.d.ts +4 -0
  30. package/src/api/interop/fdc3/utils.js +112 -4
  31. package/src/api/interop/index.js +7 -3
  32. package/src/api/interop/utils.js +20 -14
  33. package/src/api/platform/Factory.js +5 -5
  34. package/src/api/platform/Instance.js +11 -12
  35. package/src/api/platform/index.js +7 -3
  36. package/src/api/platform/layout/Factory.js +18 -20
  37. package/src/api/platform/layout/Instance.d.ts +1 -1
  38. package/src/api/platform/layout/Instance.js +2 -2
  39. package/src/api/platform/layout/controllers/splitter-controller.js +1 -1
  40. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +17 -8
  41. package/src/api/platform/layout/controllers/tab-drag-controller.js +44 -22
  42. package/src/api/platform/layout/index.js +7 -3
  43. package/src/api/platform/layout/utils/bounds-observer.js +5 -3
  44. package/src/api/snapshot-source/Factory.js +1 -1
  45. package/src/api/snapshot-source/Instance.js +33 -35
  46. package/src/api/snapshot-source/index.js +7 -3
  47. package/src/api/snapshot-source/utils.js +2 -1
  48. package/src/api/view/Factory.js +2 -2
  49. package/src/api/view/Instance.d.ts +31 -1
  50. package/src/api/view/Instance.js +31 -1
  51. package/src/api/view/index.js +7 -3
  52. package/src/api/window/Factory.js +2 -2
  53. package/src/api/window/Instance.d.ts +3 -0
  54. package/src/api/window/Instance.js +3 -0
  55. package/src/api/window/index.js +7 -3
  56. package/src/environment/node-env.js +2 -2
  57. package/src/environment/openfin-env.js +15 -17
  58. package/src/fdc3.js +1 -1
  59. package/src/mock.js +1 -2
  60. package/src/transport/transport.js +26 -28
  61. package/src/transport/wire.d.ts +9 -7
  62. package/src/util/http.d.ts +1 -1
  63. package/src/util/http.js +16 -11
  64. package/src/util/normalize-config.js +5 -5
@@ -2,4 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSnapshotSourceChannelName = void 0;
4
4
  const channelPrefix = 'snapshot-source-provider-';
5
- exports.getSnapshotSourceChannelName = (id) => `${channelPrefix}${id.uuid}`;
5
+ const getSnapshotSourceChannelName = (id) => `${channelPrefix}${id.uuid}`;
6
+ exports.getSnapshotSourceChannelName = getSnapshotSourceChannelName;
@@ -41,7 +41,7 @@ class ViewModule extends base_1.Base {
41
41
  */
42
42
  async wrap(identity) {
43
43
  this.wire.sendAction('view-wrap');
44
- const errorMsg = validate_1.validateIdentity(identity);
44
+ const errorMsg = (0, validate_1.validateIdentity)(identity);
45
45
  if (errorMsg) {
46
46
  throw new Error(errorMsg);
47
47
  }
@@ -59,7 +59,7 @@ class ViewModule extends base_1.Base {
59
59
  this.wire.sendAction('view-wrap-sync').catch((e) => {
60
60
  // we do not want to expose this error, just continue if this analytics-only call fails
61
61
  });
62
- const errorMsg = validate_1.validateIdentity(identity);
62
+ const errorMsg = (0, validate_1.validateIdentity)(identity);
63
63
  if (errorMsg) {
64
64
  throw new Error(errorMsg);
65
65
  }
@@ -16,6 +16,36 @@ import UpdatableViewOptions = OpenFin.UpdatableViewOptions;
16
16
  *
17
17
  * @property {boolean} [experimental.childWindows] Configure if the runtime should enable child windows for views.
18
18
  *
19
+ * @property {object} [accelerator]
20
+ * Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache.
21
+ *
22
+ * @property {boolean} [accelerator.devtools=false]
23
+ * If `true`, enables the devtools keyboard shortcut:<br>
24
+ * `Ctrl` + `Shift` + `I` _(Toggles Devtools)_
25
+ *
26
+ * @property {boolean} [accelerator.reload=false]
27
+ * If `true`, enables the reload keyboard shortcuts:<br>
28
+ * `Ctrl` + `R` _(Windows)_<br>
29
+ * `F5` _(Windows)_<br>
30
+ * `Command` + `R` _(Mac)_
31
+ *
32
+ * @property {boolean} [accelerator.reloadIgnoringCache=false]
33
+ * If `true`, enables the reload-from-source keyboard shortcuts:<br>
34
+ * `Ctrl` + `Shift` + `R` _(Windows)_<br>
35
+ * `Shift` + `F5` _(Windows)_<br>
36
+ * `Command` + `Shift` + `R` _(Mac)_
37
+ *
38
+ * @property {boolean} [accelerator.zoom=false]
39
+ * If `true`, enables the zoom keyboard shortcuts:<br>
40
+ * `Ctrl` + `+` _(Zoom In)_<br>
41
+ * `Ctrl` + `Shift` + `+` _(Zoom In)_<br>
42
+ * `Ctrl` + `NumPad+` _(Zoom In)_<br>
43
+ * `Ctrl` + `-` _(Zoom Out)_<br>
44
+ * `Ctrl` + `Shift` + `-` _(Zoom Out)_<br>
45
+ * `Ctrl` + `NumPad-` _(Zoom Out)_<br>
46
+ * `Ctrl` + `Scroll` _(Zoom In & Out)_<br>
47
+ * `Ctrl` + `0` _(Restore to 100%)_
48
+ *
19
49
  * @property {object} [api]
20
50
  * Configurations for API injection.
21
51
  *
@@ -127,7 +157,7 @@ import UpdatableViewOptions = OpenFin.UpdatableViewOptions;
127
157
  * really no need to provide it.
128
158
  */
129
159
  /**
130
- * @classdesc a View can be used to embed additional web content into a Window.
160
+ * @classdesc A View can be used to embed additional web content into a Window.
131
161
  * It is like a child window, except it is positioned relative to its owning window.
132
162
  * It has the ability to listen for <a href="tutorial-View.EventEmitter.html">View-specific events</a>.
133
163
  *
@@ -19,6 +19,36 @@ const window_1 = require("../window");
19
19
  *
20
20
  * @property {boolean} [experimental.childWindows] Configure if the runtime should enable child windows for views.
21
21
  *
22
+ * @property {object} [accelerator]
23
+ * Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache.
24
+ *
25
+ * @property {boolean} [accelerator.devtools=false]
26
+ * If `true`, enables the devtools keyboard shortcut:<br>
27
+ * `Ctrl` + `Shift` + `I` _(Toggles Devtools)_
28
+ *
29
+ * @property {boolean} [accelerator.reload=false]
30
+ * If `true`, enables the reload keyboard shortcuts:<br>
31
+ * `Ctrl` + `R` _(Windows)_<br>
32
+ * `F5` _(Windows)_<br>
33
+ * `Command` + `R` _(Mac)_
34
+ *
35
+ * @property {boolean} [accelerator.reloadIgnoringCache=false]
36
+ * If `true`, enables the reload-from-source keyboard shortcuts:<br>
37
+ * `Ctrl` + `Shift` + `R` _(Windows)_<br>
38
+ * `Shift` + `F5` _(Windows)_<br>
39
+ * `Command` + `Shift` + `R` _(Mac)_
40
+ *
41
+ * @property {boolean} [accelerator.zoom=false]
42
+ * If `true`, enables the zoom keyboard shortcuts:<br>
43
+ * `Ctrl` + `+` _(Zoom In)_<br>
44
+ * `Ctrl` + `Shift` + `+` _(Zoom In)_<br>
45
+ * `Ctrl` + `NumPad+` _(Zoom In)_<br>
46
+ * `Ctrl` + `-` _(Zoom Out)_<br>
47
+ * `Ctrl` + `Shift` + `-` _(Zoom Out)_<br>
48
+ * `Ctrl` + `NumPad-` _(Zoom Out)_<br>
49
+ * `Ctrl` + `Scroll` _(Zoom In & Out)_<br>
50
+ * `Ctrl` + `0` _(Restore to 100%)_
51
+ *
22
52
  * @property {object} [api]
23
53
  * Configurations for API injection.
24
54
  *
@@ -130,7 +160,7 @@ const window_1 = require("../window");
130
160
  * really no need to provide it.
131
161
  */
132
162
  /**
133
- * @classdesc a View can be used to embed additional web content into a Window.
163
+ * @classdesc A View can be used to embed additional web content into a Window.
134
164
  * It is like a child window, except it is positioned relative to its owning window.
135
165
  * It has the ability to listen for <a href="tutorial-View.EventEmitter.html">View-specific events</a>.
136
166
  *
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
8
12
  }));
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
- }
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  const Factory_1 = require("./Factory");
14
18
  exports.default = Factory_1.default;
@@ -18,7 +18,7 @@ class _WindowModule extends base_1.Base {
18
18
  this.wire.sendAction('window-wrap').catch((e) => {
19
19
  // we do not want to expose this error, just continue if this analytics-only call fails
20
20
  });
21
- const errorMsg = validate_1.validateIdentity(identity);
21
+ const errorMsg = (0, validate_1.validateIdentity)(identity);
22
22
  if (errorMsg) {
23
23
  throw new Error(errorMsg);
24
24
  }
@@ -35,7 +35,7 @@ class _WindowModule extends base_1.Base {
35
35
  this.wire.sendAction('window-wrap-sync').catch((e) => {
36
36
  // we do not want to expose this error, just continue if this analytics-only call fails
37
37
  });
38
- const errorMsg = validate_1.validateIdentity(identity);
38
+ const errorMsg = (0, validate_1.validateIdentity)(identity);
39
39
  if (errorMsg) {
40
40
  throw new Error(errorMsg);
41
41
  }
@@ -307,6 +307,9 @@ import WindowEvents = OpenFin.WindowEvents;
307
307
  * A flag to cache the location of the window.
308
308
  * ** note ** - This option is ignored in Platforms as it would cause inconsistent {@link Platform#applySnapshot applySnapshot} behavior.
309
309
  *
310
+ * @property {boolean} [ignoreSavedWindowState]
311
+ * A flag to ignore previously cached state of the window. It defaults the opposite value of `saveWindowState` to maintain backwards compatibility.
312
+ *
310
313
  * @property {boolean} [shadow=false]
311
314
  * A flag to display a shadow on frameless windows.
312
315
  * `shadow` and `cornerRounding` are mutually exclusive.
@@ -314,6 +314,9 @@ const view_1 = require("../view");
314
314
  * A flag to cache the location of the window.
315
315
  * ** note ** - This option is ignored in Platforms as it would cause inconsistent {@link Platform#applySnapshot applySnapshot} behavior.
316
316
  *
317
+ * @property {boolean} [ignoreSavedWindowState]
318
+ * A flag to ignore previously cached state of the window. It defaults the opposite value of `saveWindowState` to maintain backwards compatibility.
319
+ *
317
320
  * @property {boolean} [shadow=false]
318
321
  * A flag to display a shadow on frameless windows.
319
322
  * `shadow` and `cornerRounding` are mutually exclusive.
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
8
12
  }));
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
- }
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  const Factory_1 = require("./Factory");
14
18
  exports.default = Factory_1.default;
@@ -13,7 +13,7 @@ class NodeEnvironment {
13
13
  this.childViews = false;
14
14
  this.writeToken = (path, token) => {
15
15
  return new Promise((resolve) => {
16
- fs_1.writeFile(path, token, () => resolve(token));
16
+ (0, fs_1.writeFile)(path, token, () => resolve(token));
17
17
  });
18
18
  };
19
19
  this.retrievePort = (config) => {
@@ -25,7 +25,7 @@ class NodeEnvironment {
25
25
  return this.messageCounter++;
26
26
  };
27
27
  this.getRandomId = () => {
28
- return crypto_1.randomBytes(16).toString('hex');
28
+ return (0, crypto_1.randomBytes)(16).toString('hex');
29
29
  };
30
30
  this.getWebWindow = (identity) => {
31
31
  throw new transport_errors_1.NotSupportedError('Not supported outside of OpenFin web context');
@@ -1,18 +1,16 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to set private field on non-instance");
5
- }
6
- privateMap.set(receiver, value);
7
- return value;
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
8
7
  };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to get private field on non-instance");
12
- }
13
- return privateMap.get(receiver);
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
14
12
  };
15
- var _ready;
13
+ var _OpenFinEnvironment_ready;
16
14
  Object.defineProperty(exports, "__esModule", { value: true });
17
15
  /* global window, location */
18
16
  /* eslint-disable class-methods-use-this */
@@ -22,7 +20,7 @@ const browser_1 = require("./browser");
22
20
  class OpenFinEnvironment extends browser_1.BrowserEnvironment {
23
21
  constructor() {
24
22
  super();
25
- _ready.set(this, void 0);
23
+ _OpenFinEnvironment_ready.set(this, void 0);
26
24
  this.writeToken = (path, token) => {
27
25
  throw new transport_errors_1.NotImplementedError('Not Implemented');
28
26
  };
@@ -63,9 +61,9 @@ class OpenFinEnvironment extends browser_1.BrowserEnvironment {
63
61
  this.raiseEventAsync = fin.__internal_.raiseEventAsync;
64
62
  delete fin.__internal_.raiseEventAsync;
65
63
  this.childViews = fin.__internal_.childViews;
66
- __classPrivateFieldSet(this, _ready, new Promise((resolve) => {
64
+ __classPrivateFieldSet(this, _OpenFinEnvironment_ready, new Promise((resolve) => {
67
65
  fin.desktop.main(resolve);
68
- }));
66
+ }), "f");
69
67
  }
70
68
  getDefaultChannelOptions() {
71
69
  var _a, _b;
@@ -93,8 +91,8 @@ class OpenFinEnvironment extends browser_1.BrowserEnvironment {
93
91
  return newUrl.href;
94
92
  }
95
93
  whenReady() {
96
- return __classPrivateFieldGet(this, _ready);
94
+ return __classPrivateFieldGet(this, _OpenFinEnvironment_ready, "f");
97
95
  }
98
96
  }
99
97
  exports.default = OpenFinEnvironment;
100
- _ready = new WeakMap();
98
+ _OpenFinEnvironment_ready = new WeakMap();
package/src/fdc3.js CHANGED
@@ -4,6 +4,6 @@ exports.fdc3FromFin = void 0;
4
4
  const fdc3_1 = require("./api/interop/fdc3/fdc3");
5
5
  async function fdc3FromFin(fin, version) {
6
6
  // @ts-expect-error
7
- return fdc3_1.getFdc3(fin.wire, version);
7
+ return (0, fdc3_1.getFdc3)(fin.wire, version);
8
8
  }
9
9
  exports.fdc3FromFin = fdc3FromFin;
package/src/mock.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- var _a;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.fin = void 0;
5
4
  /* eslint-disable import/prefer-default-export */
@@ -83,7 +82,7 @@ class MockEnvironment {
83
82
  throw new Error('Method not implemented.');
84
83
  }
85
84
  }
86
- exports.fin = ((typeof window !== 'undefined' && ((_a = window) === null || _a === void 0 ? void 0 : _a.fin)) ||
85
+ exports.fin = ((typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.fin)) ||
87
86
  (() => {
88
87
  const environment = new MockEnvironment();
89
88
  const transport = new transport_1.default(MockWire, environment, {
@@ -1,18 +1,16 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to set private field on non-instance");
5
- }
6
- privateMap.set(receiver, value);
7
- return value;
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
8
7
  };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to get private field on non-instance");
12
- }
13
- return privateMap.get(receiver);
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
14
12
  };
15
- var _wire;
13
+ var _Transport_wire;
16
14
  Object.defineProperty(exports, "__esModule", { value: true });
17
15
  const events_1 = require("events");
18
16
  const wire_1 = require("./wire");
@@ -26,9 +24,9 @@ class Transport extends events_1.EventEmitter {
26
24
  this.topicRefMap = new Map();
27
25
  this.eventAggregator = new eventAggregator_1.default();
28
26
  this.messageHandlers = [this.eventAggregator.dispatchEvent];
29
- _wire.set(this, void 0);
27
+ _Transport_wire.set(this, void 0);
30
28
  this.connectSync = () => {
31
- const wire = __classPrivateFieldGet(this, _wire);
29
+ const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
32
30
  wire.connectSync();
33
31
  };
34
32
  // This function is only used in our tests.
@@ -36,14 +34,14 @@ class Transport extends events_1.EventEmitter {
36
34
  if (this.environment.constructor.name !== 'NodeEnvironment') {
37
35
  throw new transport_errors_1.NotImplementedError('Not Implemented');
38
36
  }
39
- const wire = __classPrivateFieldGet(this, _wire);
37
+ const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
40
38
  return wire.wire.url.split(':').slice(-1)[0];
41
39
  };
42
- __classPrivateFieldSet(this, _wire, new WireType(this.onmessage.bind(this)));
40
+ __classPrivateFieldSet(this, _Transport_wire, new WireType(this.onmessage.bind(this)), "f");
43
41
  this.environment = environment;
44
- this.sendRaw = __classPrivateFieldGet(this, _wire).send.bind(__classPrivateFieldGet(this, _wire));
42
+ this.sendRaw = __classPrivateFieldGet(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet(this, _Transport_wire, "f"));
45
43
  this.registerMessageHandler(this.handleMessage.bind(this));
46
- __classPrivateFieldGet(this, _wire).on('disconnected', () => {
44
+ __classPrivateFieldGet(this, _Transport_wire, "f").on('disconnected', () => {
47
45
  for (const [, { reject }] of this.wireListeners) {
48
46
  reject('Remote connection has closed');
49
47
  }
@@ -52,33 +50,33 @@ class Transport extends events_1.EventEmitter {
52
50
  });
53
51
  const { uuid, name } = config;
54
52
  const entityType = this.environment.getCurrentEntityType();
55
- this.me = me_1.getBaseMe(entityType, uuid, name);
53
+ this.me = (0, me_1.getBaseMe)(entityType, uuid, name);
56
54
  }
57
55
  shutdown() {
58
- const wire = __classPrivateFieldGet(this, _wire);
56
+ const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
59
57
  return wire.shutdown();
60
58
  }
61
59
  async connect(config) {
62
- if (wire_1.isRemoteConfig(config)) {
60
+ if ((0, wire_1.isRemoteConfig)(config)) {
63
61
  return this.connectRemote(config);
64
62
  }
65
- if (wire_1.isExistingConnectConfig(config)) {
63
+ if ((0, wire_1.isExistingConnectConfig)(config)) {
66
64
  return this.connectByPort(config);
67
65
  }
68
- if (wire_1.isNewConnectConfig(config)) {
66
+ if ((0, wire_1.isNewConnectConfig)(config)) {
69
67
  const port = await this.environment.retrievePort(config);
70
68
  return this.connectByPort({ ...config, address: `ws://localhost:${port}` });
71
69
  }
72
70
  return undefined;
73
71
  }
74
72
  async connectRemote(config) {
75
- await __classPrivateFieldGet(this, _wire).connect(config.address, this.environment.getWsConstructor());
73
+ await __classPrivateFieldGet(this, _Transport_wire, "f").connect(config.address, this.environment.getWsConstructor());
76
74
  return this.authorize(config);
77
75
  }
78
76
  async connectByPort(config) {
79
77
  const { address, uuid } = config;
80
78
  const reqAuthPayload = { ...config, type: 'file-token' };
81
- const wire = __classPrivateFieldGet(this, _wire);
79
+ const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
82
80
  await wire.connect(address, this.environment.getWsConstructor());
83
81
  const requestExtAuthRet = await this.sendAction('request-external-authorization', {
84
82
  uuid,
@@ -109,7 +107,7 @@ class Transport extends events_1.EventEmitter {
109
107
  payload,
110
108
  messageId: id
111
109
  };
112
- const wire = __classPrivateFieldGet(this, _wire);
110
+ const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
113
111
  this.addWireListener(id, resolve, reject, uncorrelated);
114
112
  return wire.send(msg).catch(reject);
115
113
  });
@@ -121,7 +119,7 @@ class Transport extends events_1.EventEmitter {
121
119
  const resolver = (data) => {
122
120
  resolve(data.payload);
123
121
  };
124
- const wire = __classPrivateFieldGet(this, _wire);
122
+ const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
125
123
  return wire
126
124
  .send(origData)
127
125
  .then(() => this.addWireListener(id, resolver, reject, false))
@@ -183,5 +181,5 @@ class Transport extends events_1.EventEmitter {
183
181
  return true;
184
182
  }
185
183
  }
186
- _wire = new WeakMap();
184
+ _Transport_wire = new WeakMap();
187
185
  exports.default = Transport;
@@ -38,13 +38,15 @@ export declare type BaseConfig = {
38
38
  installerUI?: boolean;
39
39
  runtime?: RuntimeConfig;
40
40
  services?: ServiceConfig[];
41
- appAssets?: [{
42
- src: string;
43
- alias: string;
44
- target: string;
45
- version: string;
46
- args: string;
47
- }];
41
+ appAssets?: [
42
+ {
43
+ src: string;
44
+ alias: string;
45
+ target: string;
46
+ version: string;
47
+ args: string;
48
+ }
49
+ ];
48
50
  customItems?: [any];
49
51
  timeout?: number;
50
52
  };
@@ -7,5 +7,5 @@ export declare const getProxy: () => {
7
7
  };
8
8
  export declare const getRequestOptions: (url: string) => ClientRequestArgs;
9
9
  export declare const fetch: (url: string) => Promise<string>;
10
- export declare const downloadFile: (url: string, writeLocation: string) => Promise<unknown>;
10
+ export declare const downloadFile: (url: string, writeLocation: string) => Promise<void>;
11
11
  export declare const fetchJson: (url: string) => Promise<any>;
package/src/util/http.js CHANGED
@@ -6,7 +6,7 @@ const fs = require("fs");
6
6
  const getProxyVar = () => {
7
7
  return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
8
8
  };
9
- exports.getProxy = () => {
9
+ const getProxy = () => {
10
10
  const parsedUrl = new url_1.URL(getProxyVar());
11
11
  return {
12
12
  port: parsedUrl.port,
@@ -15,12 +15,13 @@ exports.getProxy = () => {
15
15
  password: parsedUrl.password
16
16
  };
17
17
  };
18
- exports.getRequestOptions = (url) => {
18
+ exports.getProxy = getProxy;
19
+ const getRequestOptions = (url) => {
19
20
  const parsedUrl = new url_1.URL(url);
20
21
  let options;
21
22
  if (getProxyVar() && parsedUrl.hostname !== 'localhost' && parsedUrl.hostname.substring(0, 3) !== '127') {
22
23
  options = {};
23
- const proxy = exports.getProxy();
24
+ const proxy = (0, exports.getProxy)();
24
25
  options.host = proxy.host;
25
26
  options.port = proxy.port;
26
27
  options.path = url;
@@ -35,12 +36,13 @@ exports.getRequestOptions = (url) => {
35
36
  }
36
37
  return options;
37
38
  };
38
- exports.fetch = async (url) => {
39
+ exports.getRequestOptions = getRequestOptions;
40
+ const fetch = async (url) => {
39
41
  const requestUrl = getProxyVar() ? getProxyVar() : url;
40
- const proto = url_1.parse(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
42
+ const proto = (0, url_1.parse)(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
41
43
  const fetcher = await Promise.resolve().then(() => require(proto));
42
44
  return new Promise((resolve, reject) => {
43
- const options = exports.getRequestOptions(url);
45
+ const options = (0, exports.getRequestOptions)(url);
44
46
  const request = fetcher.get(options, (response) => {
45
47
  if (response.statusCode < 200 || response.statusCode > 299) {
46
48
  reject(new Error(`Failed to load url: ${url}, status code:${response.statusCode}`));
@@ -56,13 +58,14 @@ exports.fetch = async (url) => {
56
58
  });
57
59
  });
58
60
  };
59
- exports.downloadFile = async (url, writeLocation) => {
61
+ exports.fetch = fetch;
62
+ const downloadFile = async (url, writeLocation) => {
60
63
  const requestUrl = getProxyVar() ? getProxyVar() : url;
61
- const proto = url_1.parse(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
64
+ const proto = (0, url_1.parse)(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
62
65
  const fetcher = await Promise.resolve().then(() => require(proto));
63
66
  return new Promise((resolve, reject) => {
64
67
  try {
65
- const options = exports.getRequestOptions(url);
68
+ const options = (0, exports.getRequestOptions)(url);
66
69
  fetcher.get(options, (response) => {
67
70
  const file = fs.createWriteStream(writeLocation);
68
71
  response.pipe(file);
@@ -77,7 +80,9 @@ exports.downloadFile = async (url, writeLocation) => {
77
80
  }
78
81
  });
79
82
  };
80
- exports.fetchJson = async (url) => {
81
- const res = await exports.fetch(url);
83
+ exports.downloadFile = downloadFile;
84
+ const fetchJson = async (url) => {
85
+ const res = await (0, exports.fetch)(url);
82
86
  return JSON.parse(res);
83
87
  };
88
+ exports.fetchJson = fetchJson;
@@ -9,14 +9,14 @@ const http_1 = require("./http");
9
9
  async function readLocalConfig(location) {
10
10
  let pathToFile = location;
11
11
  if (location.startsWith('file')) {
12
- pathToFile = url_1.fileURLToPath(location);
12
+ pathToFile = (0, url_1.fileURLToPath)(location);
13
13
  }
14
- const txt = await promises_1.promisify(fs.readFile)(pathToFile);
14
+ const txt = await (0, promises_1.promisify)(fs.readFile)(pathToFile);
15
15
  return JSON.parse(txt.toString());
16
16
  }
17
17
  async function loadConfig(config) {
18
18
  try {
19
- return await http_1.fetchJson(config.manifestUrl);
19
+ return await (0, http_1.fetchJson)(config.manifestUrl);
20
20
  }
21
21
  catch (e) {
22
22
  try {
@@ -29,7 +29,7 @@ async function loadConfig(config) {
29
29
  }
30
30
  async function normalizeConfig(config) {
31
31
  const testThisConfig = config;
32
- if (wire_1.isExternalConfig(config)) {
32
+ if ((0, wire_1.isExternalConfig)(config)) {
33
33
  const loadedConfig = await loadConfig(config);
34
34
  testThisConfig.runtime = loadedConfig.runtime;
35
35
  if (typeof loadedConfig.assetsUrl === 'string') {
@@ -44,7 +44,7 @@ async function normalizeConfig(config) {
44
44
  exports.normalizeConfig = normalizeConfig;
45
45
  async function validateConfig(config) {
46
46
  const normalized = await normalizeConfig(config);
47
- if (wire_1.isInternalConnectConfig(normalized)) {
47
+ if ((0, wire_1.isInternalConnectConfig)(normalized)) {
48
48
  return normalized;
49
49
  }
50
50
  throw new Error('Invalid Config');