@openfin/core 30.73.5 → 30.73.7

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 (158) hide show
  1. package/OpenFin.d.ts +1 -1729
  2. package/fin.d.ts +3 -4
  3. package/package.json +1 -1
  4. package/src/GlobalOpenFin.d.ts +4 -0
  5. package/src/OpenFin.d.ts +2938 -0
  6. package/src/OpenFin.js +4 -0
  7. package/src/api/application/Factory.d.ts +2 -0
  8. package/src/api/application/Factory.js +4 -3
  9. package/src/api/application/Instance.d.ts +3 -1
  10. package/src/api/application/Instance.js +1 -0
  11. package/src/api/application/index.js +7 -3
  12. package/src/api/base.d.ts +19 -15
  13. package/src/api/base.js +20 -22
  14. package/src/api/clipboard/index.d.ts +2 -0
  15. package/src/api/clipboard/index.js +1 -0
  16. package/src/api/events/application.d.ts +66 -56
  17. package/src/api/events/base.d.ts +33 -15
  18. package/src/api/events/channel.d.ts +13 -8
  19. package/src/api/events/eventAggregator.js +1 -9
  20. package/src/api/events/externalApplication.d.ts +10 -5
  21. package/src/api/events/frame.d.ts +13 -7
  22. package/src/api/events/globalHotkey.d.ts +11 -10
  23. package/src/api/events/platform.d.ts +10 -16
  24. package/src/api/events/system.d.ts +48 -18
  25. package/src/api/events/typedEventEmitter.d.ts +20 -0
  26. package/src/api/events/typedEventEmitter.js +2 -0
  27. package/src/api/events/view.d.ts +38 -54
  28. package/src/api/events/webcontents.d.ts +55 -28
  29. package/src/api/events/window.d.ts +148 -134
  30. package/src/api/external-application/Factory.d.ts +1 -0
  31. package/src/api/external-application/Instance.d.ts +2 -1
  32. package/src/api/external-application/index.js +7 -3
  33. package/src/api/fin.d.ts +3 -1
  34. package/src/api/fin.js +2 -2
  35. package/src/api/frame/Factory.d.ts +1 -0
  36. package/src/api/frame/Factory.js +2 -2
  37. package/src/api/frame/Instance.d.ts +3 -1
  38. package/src/api/frame/index.js +7 -3
  39. package/src/api/global-hotkey/index.d.ts +2 -2
  40. package/src/api/global-hotkey/index.js +6 -0
  41. package/src/api/interappbus/channel/channel.d.ts +6 -4
  42. package/src/api/interappbus/channel/channels-docs.d.ts +22 -0
  43. package/src/api/interappbus/channel/channels-docs.js +22 -0
  44. package/src/api/interappbus/channel/client.d.ts +2 -1
  45. package/src/api/interappbus/channel/client.js +24 -26
  46. package/src/api/interappbus/channel/connection-manager.d.ts +1 -0
  47. package/src/api/interappbus/channel/connection-manager.js +30 -28
  48. package/src/api/interappbus/channel/index.d.ts +6 -4
  49. package/src/api/interappbus/channel/index.js +34 -19
  50. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +3 -1
  51. package/src/api/interappbus/channel/protocols/classic/strategy.js +21 -22
  52. package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
  53. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +1 -1
  54. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +3 -1
  55. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +25 -27
  56. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -1
  57. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +3 -1
  58. package/src/api/interappbus/channel/protocols/rtc/strategy.js +29 -31
  59. package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -1
  60. package/src/api/interappbus/channel/provider.d.ts +8 -4
  61. package/src/api/interappbus/channel/provider.js +140 -139
  62. package/src/api/interappbus/index.js +1 -1
  63. package/src/api/interop/Factory.d.ts +2 -0
  64. package/src/api/interop/Factory.js +20 -2
  65. package/src/api/interop/InteropBroker.d.ts +62 -39
  66. package/src/api/interop/InteropBroker.js +114 -55
  67. package/src/api/interop/InteropClient.d.ts +9 -0
  68. package/src/api/interop/InteropClient.js +46 -40
  69. package/src/api/interop/SessionContextGroupBroker.d.ts +1 -0
  70. package/src/api/interop/SessionContextGroupClient.d.ts +1 -0
  71. package/src/api/interop/SessionContextGroupClient.js +22 -24
  72. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +9 -7
  73. package/src/api/interop/fdc3/PrivateChannelClient.js +6 -6
  74. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -0
  75. package/src/api/interop/fdc3/fdc3-1.2.d.ts +14 -13
  76. package/src/api/interop/fdc3/fdc3-1.2.js +3 -14
  77. package/src/api/interop/fdc3/fdc3-2.0.d.ts +24 -21
  78. package/src/api/interop/fdc3/fdc3-2.0.js +27 -27
  79. package/src/api/interop/fdc3/fdc3.d.ts +12 -0
  80. package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
  81. package/src/api/interop/fdc3/overrideCheck.js +32 -0
  82. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +53 -0
  83. package/src/api/interop/fdc3/shapes/fdc3v1.js +4 -0
  84. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +75 -0
  85. package/src/api/interop/fdc3/shapes/fdc3v2.js +2 -0
  86. package/src/api/interop/fdc3/utils.d.ts +15 -5
  87. package/src/api/interop/fdc3/utils.js +29 -11
  88. package/src/api/interop/fdc3/versions.d.ts +1 -0
  89. package/src/api/interop/fdc3/versions.js +2 -0
  90. package/src/api/interop/index.js +7 -3
  91. package/src/api/interop/utils.d.ts +2 -0
  92. package/src/api/interop/utils.js +29 -15
  93. package/src/api/me.d.ts +3 -1
  94. package/src/api/platform/Factory.d.ts +6 -0
  95. package/src/api/platform/Factory.js +14 -5
  96. package/src/api/platform/Instance.d.ts +18 -3
  97. package/src/api/platform/Instance.js +30 -13
  98. package/src/api/platform/common-utils.d.ts +2 -1
  99. package/src/api/platform/index.js +7 -3
  100. package/src/api/platform/layout/Factory.d.ts +7 -1
  101. package/src/api/platform/layout/Factory.js +22 -20
  102. package/src/api/platform/layout/Instance.d.ts +6 -4
  103. package/src/api/platform/layout/Instance.js +2 -3
  104. package/src/api/platform/layout/controllers/splitter-controller.js +1 -1
  105. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +1 -0
  106. package/src/api/platform/layout/controllers/tab-drag-controller.js +1 -1
  107. package/src/api/platform/layout/index.js +7 -3
  108. package/src/api/platform/layout/shapes.d.ts +3 -1
  109. package/src/api/platform/layout/utils/bounds-observer.d.ts +1 -1
  110. package/src/api/platform/layout/utils/bounds-observer.js +7 -5
  111. package/src/api/platform/layout/utils/view-overlay.d.ts +1 -0
  112. package/src/api/platform/provider.d.ts +162 -0
  113. package/src/api/platform/provider.js +2 -0
  114. package/src/api/snapshot-source/Factory.d.ts +2 -0
  115. package/src/api/snapshot-source/Factory.js +2 -1
  116. package/src/api/snapshot-source/Instance.d.ts +1 -0
  117. package/src/api/snapshot-source/Instance.js +33 -35
  118. package/src/api/snapshot-source/index.js +7 -3
  119. package/src/api/snapshot-source/utils.d.ts +1 -0
  120. package/src/api/snapshot-source/utils.js +2 -1
  121. package/src/api/system/index.d.ts +76 -16
  122. package/src/api/system/index.js +127 -3
  123. package/src/api/view/Factory.d.ts +1 -0
  124. package/src/api/view/Factory.js +2 -2
  125. package/src/api/view/Instance.d.ts +17 -3
  126. package/src/api/view/Instance.js +20 -0
  127. package/src/api/view/index.js +7 -3
  128. package/src/api/webcontents/main.d.ts +20 -5
  129. package/src/api/webcontents/main.js +10 -0
  130. package/src/api/window/Factory.d.ts +1 -0
  131. package/src/api/window/Factory.js +2 -2
  132. package/src/api/window/Instance.d.ts +26 -3
  133. package/src/api/window/Instance.js +26 -1
  134. package/src/api/window/index.js +7 -3
  135. package/src/browser.d.ts +4 -4
  136. package/src/environment/browser.d.ts +3 -1
  137. package/src/environment/environment.d.ts +3 -1
  138. package/src/environment/node-env.d.ts +3 -1
  139. package/src/environment/node-env.js +2 -2
  140. package/src/environment/openfin-env.d.ts +3 -1
  141. package/src/environment/openfin-env.js +15 -17
  142. package/src/fdc3.d.ts +3 -0
  143. package/src/fdc3.js +1 -1
  144. package/src/mock.d.ts +2 -2
  145. package/src/mock.js +3 -3
  146. package/src/namespaces.d.ts +21 -0
  147. package/src/namespaces.js +24 -0
  148. package/src/shapes/WebOptions.d.ts +1 -0
  149. package/src/shapes/WindowOptions.d.ts +1 -0
  150. package/src/shapes/protocol.d.ts +34 -26
  151. package/src/transport/transport.d.ts +6 -5
  152. package/src/transport/transport.js +26 -28
  153. package/src/transport/wire.d.ts +9 -7
  154. package/src/util/http.d.ts +1 -1
  155. package/src/util/http.js +16 -11
  156. package/src/util/inaccessibleObject.d.ts +2 -0
  157. package/src/util/inaccessibleObject.js +49 -0
  158. package/src/util/normalize-config.js +5 -5
@@ -0,0 +1,21 @@
1
+ export * as OpenFin from './OpenFin';
2
+ export * as Application from './api/application';
3
+ export * as ExternalApplication from './api/external-application';
4
+ export * as Frame from './api/frame';
5
+ export * as Interop from './api/interop';
6
+ export * as InteropBroker from './api/interop/InteropBroker';
7
+ export * as InteropClient from './api/interop/InteropClient';
8
+ export * as InterApplicationBus from './api/interappbus';
9
+ export * as Channel from './api/interappbus/channel';
10
+ export * as ChannelProvider from './api/interappbus/channel/provider';
11
+ export * as ChannelClient from './api/interappbus/channel/client';
12
+ export * as Platform from './api/platform';
13
+ export * as PlatformProvider from './api/platform/provider';
14
+ export * as Layout from './api/platform/layout';
15
+ export * as View from './api/view';
16
+ export * as Window from './api/window';
17
+ export * as SnapshotSource from './api/snapshot-source';
18
+ export * as GlobalHotkey from './api/global-hotkey';
19
+ export * as Clipboard from './api/clipboard';
20
+ export * as Fin from './api/fin';
21
+ export * as System from './api/system';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.System = exports.Fin = exports.Clipboard = exports.GlobalHotkey = exports.SnapshotSource = exports.Window = exports.View = exports.Layout = exports.PlatformProvider = exports.Platform = exports.ChannelClient = exports.ChannelProvider = exports.Channel = exports.InterApplicationBus = exports.InteropClient = exports.InteropBroker = exports.Interop = exports.Frame = exports.ExternalApplication = exports.Application = exports.OpenFin = void 0;
4
+ exports.OpenFin = require("./OpenFin");
5
+ exports.Application = require("./api/application");
6
+ exports.ExternalApplication = require("./api/external-application");
7
+ exports.Frame = require("./api/frame");
8
+ exports.Interop = require("./api/interop");
9
+ exports.InteropBroker = require("./api/interop/InteropBroker");
10
+ exports.InteropClient = require("./api/interop/InteropClient");
11
+ exports.InterApplicationBus = require("./api/interappbus");
12
+ exports.Channel = require("./api/interappbus/channel");
13
+ exports.ChannelProvider = require("./api/interappbus/channel/provider");
14
+ exports.ChannelClient = require("./api/interappbus/channel/client");
15
+ exports.Platform = require("./api/platform");
16
+ exports.PlatformProvider = require("./api/platform/provider");
17
+ exports.Layout = require("./api/platform/layout");
18
+ exports.View = require("./api/view");
19
+ exports.Window = require("./api/window");
20
+ exports.SnapshotSource = require("./api/snapshot-source");
21
+ exports.GlobalHotkey = require("./api/global-hotkey");
22
+ exports.Clipboard = require("./api/clipboard");
23
+ exports.Fin = require("./api/fin");
24
+ exports.System = require("./api/system");
@@ -1,3 +1,4 @@
1
+ import type * as OpenFin from '../OpenFin';
1
2
  export interface WebOptions {
2
3
  preloadScripts?: OpenFin.PreloadScript[];
3
4
  uuid: string;
@@ -1,3 +1,4 @@
1
+ import type * as OpenFin from '../OpenFin';
1
2
  import { ERROR_BOX_TYPES } from './ERROR_BOX_TYPES';
2
3
  import { WebOptions } from './WebOptions';
3
4
  export interface WindowOptions extends Partial<OpenFin.WindowOptions>, Partial<WindowInternalOptions> {
@@ -1,3 +1,4 @@
1
+ import type * as OpenFin from '../OpenFin';
1
2
  import { AuthorizationPayload } from '../transport/transport';
2
3
  export interface ProtocolMap extends ProtocolMapBase {
3
4
  'request-external-authorization': {
@@ -15,22 +16,33 @@ export interface ProtocolMap extends ProtocolMapBase {
15
16
  } & OpenFin.ApplicationIdentity;
16
17
  response: void;
17
18
  };
18
- 'get-view-window': {
19
- request: OpenFin.Identity;
20
- response: OpenFin.Identity;
21
- };
22
- 'window-get-views': {
23
- request: OpenFin.Identity;
24
- response: OpenFin.Identity[];
25
- };
26
- 'hide-view': {
27
- request: OpenFin.Identity;
28
- response: void;
29
- };
19
+ 'get-view-window': IdentityCall<{}, OpenFin.Identity>;
20
+ 'create-view': IdentityCall<OpenFin.ViewCreationOptions & {
21
+ uuid: string;
22
+ }>;
23
+ 'destroy-view': IdentityCall;
24
+ 'attach-view': IdentityCall<{
25
+ target: OpenFin.Identity;
26
+ }>;
27
+ 'set-view-bounds': IdentityCall<{
28
+ bounds: OpenFin.Bounds;
29
+ }>;
30
+ 'get-view-bounds': IdentityCall<{}, OpenFin.Bounds>;
31
+ 'get-view-info': IdentityCall<{}, OpenFin.ViewInfo>;
32
+ 'get-view-options': IdentityCall<{}, OpenFin.ViewOptions>;
33
+ 'hide-view': IdentityCall;
34
+ 'show-view': IdentityCall;
35
+ 'update-view-options': IdentityCall<{
36
+ options: OpenFin.UpdatableViewOptions;
37
+ }>;
38
+ 'trigger-before-unload': IdentityCall<{}, boolean>;
39
+ 'window-get-views': IdentityCall<{}, OpenFin.Identity[]>;
30
40
  'launch-manifest': {
31
41
  request: {
32
42
  manifestUrl: string;
33
- opts?: OpenFin.RvmLaunchOptions;
43
+ opts?: Omit<OpenFin.RvmLaunchOptions, 'subscribe'> & {
44
+ appVersionId?: string;
45
+ };
34
46
  };
35
47
  response: {
36
48
  manifest: OpenFin.Manifest;
@@ -64,10 +76,7 @@ export interface ProtocolMap extends ProtocolMapBase {
64
76
  };
65
77
  response: void;
66
78
  };
67
- 'close-popup-menu': {
68
- request: OpenFin.Identity;
69
- response: void;
70
- };
79
+ 'close-popup-menu': IdentityCall;
71
80
  'fdc3-add-context-listener': VoidCall;
72
81
  'fdc3-broadcast': VoidCall;
73
82
  'fdc3-get-system-channels': VoidCall;
@@ -113,12 +122,9 @@ export interface ProtocolMap extends ProtocolMapBase {
113
122
  };
114
123
  response: OpenFin.PopupResult;
115
124
  };
116
- 'dispatch-popup-result': {
117
- request: OpenFin.Identity & {
118
- data: any;
119
- };
120
- response: void;
121
- };
125
+ 'dispatch-popup-result': IdentityCall<{
126
+ data: any;
127
+ }>;
122
128
  'render-overlay': {
123
129
  request: {
124
130
  bounds: OpenFin.Bounds;
@@ -143,10 +149,12 @@ export interface ProtocolMap extends ProtocolMapBase {
143
149
  response: OpenFin.PrinterInfo[];
144
150
  };
145
151
  }
146
- declare type VoidCall = {
147
- request: void;
148
- response: void;
152
+ declare type ApiCall<Request, Response> = {
153
+ request: Request;
154
+ response: Response;
149
155
  };
156
+ declare type VoidCall = ApiCall<void, void>;
157
+ declare type IdentityCall<AdditionalPayload = {}, Response = void> = ApiCall<AdditionalPayload & OpenFin.Identity, Response>;
150
158
  interface ProtocolMapBase {
151
159
  [action: string]: {
152
160
  request: any;
@@ -1,12 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- import { Wire, WireConstructor, ExistingConnectConfig, InternalConnectConfig, RemoteConfig } from './wire';
3
+ import type * as OpenFin from '../OpenFin';
4
+ import { ExistingConnectConfig, InternalConnectConfig, RemoteConfig, Wire, WireConstructor } from './wire';
4
5
  import { Environment } from '../environment/environment';
5
- import { RuntimeEvent } from '../api/events/base';
6
6
  import EventAggregator from '../api/events/eventAggregator';
7
7
  import { EntityTypeHelpers } from '../api/me';
8
8
  import { ProtocolMap } from '../shapes/protocol';
9
- import EntityType = OpenFin.EntityType;
9
+ import { NamedEvent } from '../api/events/base';
10
+ declare type EntityType = OpenFin.EntityType;
10
11
  export declare type MessageHandler = (data: any) => boolean;
11
12
  declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
12
13
  #private;
@@ -44,9 +45,9 @@ export interface Message<T> {
44
45
  payload: T;
45
46
  correlationId?: number;
46
47
  }
47
- export interface EventMessage extends Message<RuntimeEvent> {
48
+ export interface EventMessage extends Message<NamedEvent> {
48
49
  action: 'process-desktop-event';
49
- payload: RuntimeEvent;
50
+ payload: NamedEvent;
50
51
  }
51
52
  export interface Payload {
52
53
  success: boolean;
@@ -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;
@@ -0,0 +1,2 @@
1
+ export declare function createUnusableObject(message: string): Record<any, never>;
2
+ export declare function createWarningObject<T extends {}>(message: string, obj: T): T;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWarningObject = exports.createUnusableObject = void 0;
4
+ function createUnusableObject(message) {
5
+ const handle = () => {
6
+ throw new Error(message);
7
+ };
8
+ return new Proxy({}, {
9
+ apply: handle,
10
+ construct: handle,
11
+ defineProperty: handle,
12
+ deleteProperty: handle,
13
+ get: handle,
14
+ getOwnPropertyDescriptor: handle,
15
+ getPrototypeOf: handle,
16
+ has: handle,
17
+ isExtensible: handle,
18
+ ownKeys: handle,
19
+ preventExtensions: handle,
20
+ set: handle,
21
+ setPrototypeOf: handle
22
+ });
23
+ }
24
+ exports.createUnusableObject = createUnusableObject;
25
+ function createWarningObject(message, obj) {
26
+ return new Proxy(obj, {
27
+ get: (...args) => {
28
+ // eslint-disable-next-line no-console
29
+ console.warn(message);
30
+ return Reflect.get(...args);
31
+ },
32
+ set: (...args) => {
33
+ // eslint-disable-next-line no-console
34
+ console.warn(message);
35
+ return Reflect.set(...args);
36
+ },
37
+ getOwnPropertyDescriptor: (...args) => {
38
+ // eslint-disable-next-line no-console
39
+ console.warn(message);
40
+ return Reflect.getOwnPropertyDescriptor(...args);
41
+ },
42
+ ownKeys: (...args) => {
43
+ // eslint-disable-next-line no-console
44
+ console.warn(message);
45
+ return Reflect.ownKeys(...args);
46
+ }
47
+ });
48
+ }
49
+ exports.createWarningObject = createWarningObject;
@@ -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');