@openfin/node-adapter 34.78.6 → 34.78.8

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.
@@ -2971,7 +2971,7 @@ declare class ClassicStrategy implements ChannelStrategy<EndpointPayload> {
2971
2971
  private messageReceiver;
2972
2972
  private endpointId;
2973
2973
  private providerIdentity;
2974
- constructor(wire: Transport, messageReceiver: MessageReceiver, endpointId: string, // Provider endpointId is channelId
2974
+ constructor(wire: Transport, messageReceiver: MessageReceiver_2, endpointId: string, // Provider endpointId is channelId
2975
2975
  providerIdentity: ProviderIdentity_4);
2976
2976
  onEndpointDisconnect(endpointId: string, listener: () => void): void;
2977
2977
  receive(listener: (action: string, payload: any, identity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime | ProviderIdentity_4) => Promise<any>): void;
@@ -3454,7 +3454,7 @@ declare type ConstViewOptions = {
3454
3454
  /**
3455
3455
  * Controls interaction of the view with its parent window's download shelf.
3456
3456
  */
3457
- downloadShelf: {
3457
+ downloadShelf?: {
3458
3458
  /**
3459
3459
  * Whether downloads in this view trigger opening the download shelf on its parent BrowserWindow
3460
3460
  */
@@ -4359,6 +4359,14 @@ declare type CreateViewTarget = LayoutIdentity & {
4359
4359
  };
4360
4360
  };
4361
4361
 
4362
+ /**
4363
+ * Define possible options for Custom protocol.
4364
+ * @interface
4365
+ */
4366
+ declare type CustomProtocolOptions = {
4367
+ protocolName: string;
4368
+ };
4369
+
4362
4370
  /**
4363
4371
  * Custom headers for requests sent by the window.
4364
4372
  *
@@ -4376,6 +4384,8 @@ declare type CustomRequestHeaders = {
4376
4384
  headers: WebRequestHeader[];
4377
4385
  };
4378
4386
 
4387
+ declare type DataChannelReadyState = RTCDataChannel['readyState'];
4388
+
4379
4389
  /**
4380
4390
  * @interface
4381
4391
  */
@@ -4657,7 +4667,7 @@ declare type DownloadShelfOptions = {
4657
4667
  /**
4658
4668
  * Styling options for the download shelf border.
4659
4669
  */
4660
- border: {
4670
+ border?: {
4661
4671
  /**
4662
4672
  * Thickness of the border in pixels. Default 1 pixel. Used only for frameless windows.
4663
4673
  *
@@ -5133,7 +5143,7 @@ declare namespace ExternalApplicationEvents {
5133
5143
  }
5134
5144
 
5135
5145
  /**
5136
- * Union of possible `type` values for a {@link OpenFin.ApplicationEvents.ApplicationEvent}.
5146
+ * Union of possible `type` values for a {@link ApplicationEvent}.
5137
5147
  */
5138
5148
  declare type ExternalApplicationEventType = ExternalApplicationEvent['type'];
5139
5149
 
@@ -5463,6 +5473,8 @@ declare type FindIntentsByContextOptions<MetadataType = IntentMetadata_3> = {
5463
5473
  metadata?: MetadataType;
5464
5474
  };
5465
5475
 
5476
+ declare type FlexReadyState = WebSocketReadyState | DataChannelReadyState;
5477
+
5466
5478
  /**
5467
5479
  * Generated when a WebContents gains focus.
5468
5480
  * @interface
@@ -9105,7 +9117,17 @@ declare interface Message<T> {
9105
9117
 
9106
9118
  declare type MessageHandler = (data: any) => boolean;
9107
9119
 
9108
- declare class MessageReceiver extends Base {
9120
+ declare interface MessageReceiver {
9121
+ addEventListener(e: 'open', listener: (ev: Event) => void): void;
9122
+ addEventListener(e: 'error', listener: (ev: Event) => void): void;
9123
+ addEventListener(e: 'message', listener: (ev: MessageEvent) => void): void;
9124
+ addEventListener(e: 'close', listener: (ev: Event) => void): void;
9125
+ send(data: unknown): void;
9126
+ close(): void;
9127
+ readyState: FlexReadyState;
9128
+ }
9129
+
9130
+ declare class MessageReceiver_2 extends Base {
9109
9131
  private endpointMap;
9110
9132
  private latestEndpointIdByChannelId;
9111
9133
  constructor(wire: Transport);
@@ -9671,6 +9693,7 @@ declare namespace OpenFin {
9671
9693
  Rectangle,
9672
9694
  ApplicationCreationOptions,
9673
9695
  ApplicationOptions,
9696
+ CustomProtocolOptions,
9674
9697
  InteropBrokerOptions,
9675
9698
  ContextGroupInfo,
9676
9699
  DisplayMetadata_3 as DisplayMetadata,
@@ -11910,7 +11933,7 @@ declare type PropagatedEventType<Topic extends string, Type extends string> = `$
11910
11933
 
11911
11934
  /**
11912
11935
  * A view event that has propagated to a parent {@link OpenFin.WindowEvents Window}, {@link OpenFin.ApplicationEvents Application},
11913
- * or {@link Openfin.SystemEvents System}), adding a `viewIdentity` property (since the `Identity` property of the propagated event refers to the `Window`) and prefixing the
11936
+ * or {@link OpenFin.SystemEvents System}), adding a `viewIdentity` property (since the `Identity` property of the propagated event refers to the `Window`) and prefixing the
11914
11937
  * event type key with `'view-'`.
11915
11938
  */
11916
11939
  declare type PropagatedViewEvent<TargetTopic extends string> = PropagatedEvent<'view', TargetTopic, ViewEvent> & {
@@ -11924,7 +11947,7 @@ declare type PropagatedViewEventType = PropagatedViewEvent<string>['type'];
11924
11947
 
11925
11948
  /**
11926
11949
  * A Window event that has propagated to the parent {@link OpenFin.ApplicationEvents Application} and {@link OpenFin.SystemEvents System},
11927
- * prefixing the type string with `'window-'`. Only {@link NativeWindowEvent native window events} will propagate
11950
+ * prefixing the type string with `'window-'`. Only {@link WindowSourcedEvent window-sourced events} will propagate
11928
11951
  * this way; those that have {@link OpenFin.ViewEvents.PropagatedViewEvent propagated} from {@link OpenFin.ViewEvents}
11929
11952
  * will *not* re-propagate.
11930
11953
  *
@@ -12142,6 +12165,10 @@ declare interface ProtocolMap extends ProtocolMapBase {
12142
12165
  anchor: OpenFin.AnchorType;
12143
12166
  }>>;
12144
12167
  'set-window-bounds': IdentityCall<WithPositioningOptions<Partial<OpenFin.Bounds>>>;
12168
+ 'register-custom-protocol': ApiCall<OpenFin.CustomProtocolOptions, void>;
12169
+ 'unregister-custom-protocol': ApiCall<{
12170
+ protocolName: string;
12171
+ }, void>;
12145
12172
  }
12146
12173
 
12147
12174
  declare interface ProtocolMapBase {
@@ -12273,6 +12300,10 @@ declare interface ReactComponentConfig extends ItemConfig {
12273
12300
  */
12274
12301
  declare type ReadImageClipboardRequest = BaseClipboardRequest & ImageFormatOptions;
12275
12302
 
12303
+ declare interface ReceiverConfig extends Omit<RemoteConfig, 'address'> {
12304
+ receiver: MessageReceiver;
12305
+ }
12306
+
12276
12307
  /**
12277
12308
  * A rectangular area on the screen.
12278
12309
  *
@@ -12912,6 +12943,41 @@ declare type ShortcutOverride = Hotkey & {
12912
12943
 
12913
12944
  /**
12914
12945
  * Generated when the Download Shelf 'Show All' button is clicked.
12946
+ *
12947
+ * @remarks By default, OpenFin does not handle the clicking of the `Show All` button on the download
12948
+ * shelf. Instead, it fires this event, which leaves rendering a download manager to the user. For a simple
12949
+ * implementation, the `chrome://downloads` page can be used (see the example below):
12950
+ *
12951
+ * @example
12952
+ *
12953
+ * ```typescript
12954
+ * const platform = await fin.Platform.getCurrentSync();
12955
+ * // Listen to the propagated event at the Platform level, so that we only need one listener for a click from any window
12956
+ * platform.on('window-show-all-downloads', () => {
12957
+ * // Render the `chrome://downloads` window when a user clicks on the download shelf `Show All` button
12958
+ * platform.createWindow({
12959
+ * name: 'show-download-window',
12960
+ * layout: {
12961
+ * content: [
12962
+ * {
12963
+ * type: 'stack',
12964
+ * content: [
12965
+ * {
12966
+ * type: 'component',
12967
+ * componentName: 'view',
12968
+ * componentState: {
12969
+ * name: 'show-download-view',
12970
+ * url: 'chrome://downloads'
12971
+ * }
12972
+ * }
12973
+ * ]
12974
+ * }
12975
+ * ]
12976
+ * }
12977
+ * });
12978
+ * })
12979
+ * ```
12980
+ *
12915
12981
  * @interface
12916
12982
  */
12917
12983
  declare type ShowAllDownloadsEvent = BaseWindowEvent & {
@@ -13952,6 +14018,52 @@ declare class System extends EmitterBase<OpenFin.SystemEvent> {
13952
14018
  * ```
13953
14019
  */
13954
14020
  openUrlWithBrowser(url: string): Promise<void>;
14021
+ /**
14022
+ * Creates a new registry entry under the HKCU root Windows registry key if the given custom protocol name doesn't exist or
14023
+ * overwrites the existing registry entry if the given custom protocol name already exists.
14024
+ *
14025
+ * Note: This method is restricted by default and must be enabled via
14026
+ * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
14027
+ *
14028
+ *
14029
+ * @remarks These protocols are reserved and cannot be registered:
14030
+ * - fin
14031
+ * - fins
14032
+ * - openfin
14033
+ * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
14034
+ *
14035
+ * @throws if a given custom protocol failed to be registered.
14036
+ * @throws if a manifest URL contains the '%1' string.
14037
+ * @throws if a manifest URL contains a query string parameter which name equals to the Protocol Launch Request Parameter Name.
14038
+ * @throws if the full length of the command string that is to be written to the registry exceeds 2048 bytes.
14039
+ *
14040
+ * @example
14041
+ * ```js
14042
+ * fin.System.registerCustomProtocol({protocolName:'protocol1'}).then(console.log).catch(console.error);
14043
+ * ```
14044
+ */
14045
+ registerCustomProtocol(options: OpenFin.CustomProtocolOptions): Promise<void>;
14046
+ /**
14047
+ * Removes the registry entry for a given custom protocol.
14048
+ *
14049
+ * Note: This method is restricted by default and must be enabled via
14050
+ * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
14051
+ *
14052
+ *
14053
+ * @remarks These protocols are reserved and cannot be unregistered:
14054
+ * - fin
14055
+ * - fins
14056
+ * - openfin
14057
+ * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
14058
+ *
14059
+ * @throws if a protocol entry failed to be removed in registry.
14060
+ *
14061
+ * @example
14062
+ * ```js
14063
+ * await fin.System.unregisterCustomProtocol('protocol1');
14064
+ * ```
14065
+ */
14066
+ unregisterCustomProtocol(protocolName: string): Promise<void>;
13955
14067
  /**
13956
14068
  * Removes the process entry for the passed UUID obtained from a prior call
13957
14069
  * of fin.System.launchExternalProcess().
@@ -14648,6 +14760,14 @@ declare type SystemPermissions = {
14648
14760
  enabled: boolean;
14649
14761
  protocols: string[];
14650
14762
  };
14763
+ registerCustomProtocol: boolean | {
14764
+ enabled: boolean;
14765
+ protocols: string[];
14766
+ };
14767
+ unregisterCustomProtocol: boolean | {
14768
+ enabled: boolean;
14769
+ protocols: string[];
14770
+ };
14651
14771
  };
14652
14772
 
14653
14773
  /**
@@ -14996,7 +15116,7 @@ declare class Transport<MeType extends EntityType = EntityType> extends EventEmi
14996
15116
  connectSync: () => void;
14997
15117
  getPort: () => string;
14998
15118
  shutdown(): Promise<void>;
14999
- connect(config: InternalConnectConfig | RemoteConfig): Promise<string | void>;
15119
+ connect(config: InternalConnectConfig | RemoteConfig | ReceiverConfig): Promise<string | void>;
15000
15120
  private connectRemote;
15001
15121
  connectByPort(config: ExistingConnectConfig): Promise<void>;
15002
15122
  private authorize;
@@ -17047,6 +17167,8 @@ declare type WebRequestHeader = {
17047
17167
  [key: string]: string;
17048
17168
  };
17049
17169
 
17170
+ declare type WebSocketReadyState = WebSocket['readyState'];
17171
+
17050
17172
  /**
17051
17173
  * Generated when a window is being moved by the user.
17052
17174
  * @remarks For use with monitor scaling that is not 100%. Bounds are given in DIP (adjusted for monitor scale factor).
@@ -19051,7 +19173,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
19051
19173
  };
19052
19174
 
19053
19175
  declare type Wire = EventEmitter & {
19054
- connect(address: string, WsConstructor: typeof WebSocket): Promise<any>;
19176
+ connect(messageReciever: MessageReceiver): Promise<any>;
19055
19177
  connectSync(): any;
19056
19178
  send(data: any): Promise<any>;
19057
19179
  shutdown(): Promise<void>;
@@ -2971,7 +2971,7 @@ declare class ClassicStrategy implements ChannelStrategy<EndpointPayload> {
2971
2971
  private messageReceiver;
2972
2972
  private endpointId;
2973
2973
  private providerIdentity;
2974
- constructor(wire: Transport, messageReceiver: MessageReceiver, endpointId: string, // Provider endpointId is channelId
2974
+ constructor(wire: Transport, messageReceiver: MessageReceiver_2, endpointId: string, // Provider endpointId is channelId
2975
2975
  providerIdentity: ProviderIdentity_4);
2976
2976
  onEndpointDisconnect(endpointId: string, listener: () => void): void;
2977
2977
  receive(listener: (action: string, payload: any, identity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime | ProviderIdentity_4) => Promise<any>): void;
@@ -3454,7 +3454,7 @@ declare type ConstViewOptions = {
3454
3454
  /**
3455
3455
  * Controls interaction of the view with its parent window's download shelf.
3456
3456
  */
3457
- downloadShelf: {
3457
+ downloadShelf?: {
3458
3458
  /**
3459
3459
  * Whether downloads in this view trigger opening the download shelf on its parent BrowserWindow
3460
3460
  */
@@ -4359,6 +4359,14 @@ declare type CreateViewTarget = LayoutIdentity & {
4359
4359
  };
4360
4360
  };
4361
4361
 
4362
+ /**
4363
+ * Define possible options for Custom protocol.
4364
+ * @interface
4365
+ */
4366
+ declare type CustomProtocolOptions = {
4367
+ protocolName: string;
4368
+ };
4369
+
4362
4370
  /**
4363
4371
  * Custom headers for requests sent by the window.
4364
4372
  *
@@ -4376,6 +4384,8 @@ declare type CustomRequestHeaders = {
4376
4384
  headers: WebRequestHeader[];
4377
4385
  };
4378
4386
 
4387
+ declare type DataChannelReadyState = RTCDataChannel['readyState'];
4388
+
4379
4389
  /**
4380
4390
  * @interface
4381
4391
  */
@@ -4657,7 +4667,7 @@ declare type DownloadShelfOptions = {
4657
4667
  /**
4658
4668
  * Styling options for the download shelf border.
4659
4669
  */
4660
- border: {
4670
+ border?: {
4661
4671
  /**
4662
4672
  * Thickness of the border in pixels. Default 1 pixel. Used only for frameless windows.
4663
4673
  *
@@ -5133,7 +5143,7 @@ declare namespace ExternalApplicationEvents {
5133
5143
  }
5134
5144
 
5135
5145
  /**
5136
- * Union of possible `type` values for a {@link OpenFin.ApplicationEvents.ApplicationEvent}.
5146
+ * Union of possible `type` values for a {@link ApplicationEvent}.
5137
5147
  */
5138
5148
  declare type ExternalApplicationEventType = ExternalApplicationEvent['type'];
5139
5149
 
@@ -5463,6 +5473,8 @@ declare type FindIntentsByContextOptions<MetadataType = IntentMetadata_3> = {
5463
5473
  metadata?: MetadataType;
5464
5474
  };
5465
5475
 
5476
+ declare type FlexReadyState = WebSocketReadyState | DataChannelReadyState;
5477
+
5466
5478
  /**
5467
5479
  * Generated when a WebContents gains focus.
5468
5480
  * @interface
@@ -9105,7 +9117,17 @@ declare interface Message<T> {
9105
9117
 
9106
9118
  declare type MessageHandler = (data: any) => boolean;
9107
9119
 
9108
- declare class MessageReceiver extends Base {
9120
+ declare interface MessageReceiver {
9121
+ addEventListener(e: 'open', listener: (ev: Event) => void): void;
9122
+ addEventListener(e: 'error', listener: (ev: Event) => void): void;
9123
+ addEventListener(e: 'message', listener: (ev: MessageEvent) => void): void;
9124
+ addEventListener(e: 'close', listener: (ev: Event) => void): void;
9125
+ send(data: unknown): void;
9126
+ close(): void;
9127
+ readyState: FlexReadyState;
9128
+ }
9129
+
9130
+ declare class MessageReceiver_2 extends Base {
9109
9131
  private endpointMap;
9110
9132
  private latestEndpointIdByChannelId;
9111
9133
  constructor(wire: Transport);
@@ -9671,6 +9693,7 @@ declare namespace OpenFin {
9671
9693
  Rectangle,
9672
9694
  ApplicationCreationOptions,
9673
9695
  ApplicationOptions,
9696
+ CustomProtocolOptions,
9674
9697
  InteropBrokerOptions,
9675
9698
  ContextGroupInfo,
9676
9699
  DisplayMetadata_3 as DisplayMetadata,
@@ -11910,7 +11933,7 @@ declare type PropagatedEventType<Topic extends string, Type extends string> = `$
11910
11933
 
11911
11934
  /**
11912
11935
  * A view event that has propagated to a parent {@link OpenFin.WindowEvents Window}, {@link OpenFin.ApplicationEvents Application},
11913
- * or {@link Openfin.SystemEvents System}), adding a `viewIdentity` property (since the `Identity` property of the propagated event refers to the `Window`) and prefixing the
11936
+ * or {@link OpenFin.SystemEvents System}), adding a `viewIdentity` property (since the `Identity` property of the propagated event refers to the `Window`) and prefixing the
11914
11937
  * event type key with `'view-'`.
11915
11938
  */
11916
11939
  declare type PropagatedViewEvent<TargetTopic extends string> = PropagatedEvent<'view', TargetTopic, ViewEvent> & {
@@ -11924,7 +11947,7 @@ declare type PropagatedViewEventType = PropagatedViewEvent<string>['type'];
11924
11947
 
11925
11948
  /**
11926
11949
  * A Window event that has propagated to the parent {@link OpenFin.ApplicationEvents Application} and {@link OpenFin.SystemEvents System},
11927
- * prefixing the type string with `'window-'`. Only {@link NativeWindowEvent native window events} will propagate
11950
+ * prefixing the type string with `'window-'`. Only {@link WindowSourcedEvent window-sourced events} will propagate
11928
11951
  * this way; those that have {@link OpenFin.ViewEvents.PropagatedViewEvent propagated} from {@link OpenFin.ViewEvents}
11929
11952
  * will *not* re-propagate.
11930
11953
  *
@@ -12142,6 +12165,10 @@ declare interface ProtocolMap extends ProtocolMapBase {
12142
12165
  anchor: OpenFin.AnchorType;
12143
12166
  }>>;
12144
12167
  'set-window-bounds': IdentityCall<WithPositioningOptions<Partial<OpenFin.Bounds>>>;
12168
+ 'register-custom-protocol': ApiCall<OpenFin.CustomProtocolOptions, void>;
12169
+ 'unregister-custom-protocol': ApiCall<{
12170
+ protocolName: string;
12171
+ }, void>;
12145
12172
  }
12146
12173
 
12147
12174
  declare interface ProtocolMapBase {
@@ -12273,6 +12300,10 @@ declare interface ReactComponentConfig extends ItemConfig {
12273
12300
  */
12274
12301
  declare type ReadImageClipboardRequest = BaseClipboardRequest & ImageFormatOptions;
12275
12302
 
12303
+ declare interface ReceiverConfig extends Omit<RemoteConfig, 'address'> {
12304
+ receiver: MessageReceiver;
12305
+ }
12306
+
12276
12307
  /**
12277
12308
  * A rectangular area on the screen.
12278
12309
  *
@@ -12912,6 +12943,41 @@ declare type ShortcutOverride = Hotkey & {
12912
12943
 
12913
12944
  /**
12914
12945
  * Generated when the Download Shelf 'Show All' button is clicked.
12946
+ *
12947
+ * @remarks By default, OpenFin does not handle the clicking of the `Show All` button on the download
12948
+ * shelf. Instead, it fires this event, which leaves rendering a download manager to the user. For a simple
12949
+ * implementation, the `chrome://downloads` page can be used (see the example below):
12950
+ *
12951
+ * @example
12952
+ *
12953
+ * ```typescript
12954
+ * const platform = await fin.Platform.getCurrentSync();
12955
+ * // Listen to the propagated event at the Platform level, so that we only need one listener for a click from any window
12956
+ * platform.on('window-show-all-downloads', () => {
12957
+ * // Render the `chrome://downloads` window when a user clicks on the download shelf `Show All` button
12958
+ * platform.createWindow({
12959
+ * name: 'show-download-window',
12960
+ * layout: {
12961
+ * content: [
12962
+ * {
12963
+ * type: 'stack',
12964
+ * content: [
12965
+ * {
12966
+ * type: 'component',
12967
+ * componentName: 'view',
12968
+ * componentState: {
12969
+ * name: 'show-download-view',
12970
+ * url: 'chrome://downloads'
12971
+ * }
12972
+ * }
12973
+ * ]
12974
+ * }
12975
+ * ]
12976
+ * }
12977
+ * });
12978
+ * })
12979
+ * ```
12980
+ *
12915
12981
  * @interface
12916
12982
  */
12917
12983
  declare type ShowAllDownloadsEvent = BaseWindowEvent & {
@@ -13952,6 +14018,52 @@ declare class System extends EmitterBase<OpenFin.SystemEvent> {
13952
14018
  * ```
13953
14019
  */
13954
14020
  openUrlWithBrowser(url: string): Promise<void>;
14021
+ /**
14022
+ * Creates a new registry entry under the HKCU root Windows registry key if the given custom protocol name doesn't exist or
14023
+ * overwrites the existing registry entry if the given custom protocol name already exists.
14024
+ *
14025
+ * Note: This method is restricted by default and must be enabled via
14026
+ * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
14027
+ *
14028
+ *
14029
+ * @remarks These protocols are reserved and cannot be registered:
14030
+ * - fin
14031
+ * - fins
14032
+ * - openfin
14033
+ * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
14034
+ *
14035
+ * @throws if a given custom protocol failed to be registered.
14036
+ * @throws if a manifest URL contains the '%1' string.
14037
+ * @throws if a manifest URL contains a query string parameter which name equals to the Protocol Launch Request Parameter Name.
14038
+ * @throws if the full length of the command string that is to be written to the registry exceeds 2048 bytes.
14039
+ *
14040
+ * @example
14041
+ * ```js
14042
+ * fin.System.registerCustomProtocol({protocolName:'protocol1'}).then(console.log).catch(console.error);
14043
+ * ```
14044
+ */
14045
+ registerCustomProtocol(options: OpenFin.CustomProtocolOptions): Promise<void>;
14046
+ /**
14047
+ * Removes the registry entry for a given custom protocol.
14048
+ *
14049
+ * Note: This method is restricted by default and must be enabled via
14050
+ * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
14051
+ *
14052
+ *
14053
+ * @remarks These protocols are reserved and cannot be unregistered:
14054
+ * - fin
14055
+ * - fins
14056
+ * - openfin
14057
+ * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
14058
+ *
14059
+ * @throws if a protocol entry failed to be removed in registry.
14060
+ *
14061
+ * @example
14062
+ * ```js
14063
+ * await fin.System.unregisterCustomProtocol('protocol1');
14064
+ * ```
14065
+ */
14066
+ unregisterCustomProtocol(protocolName: string): Promise<void>;
13955
14067
  /**
13956
14068
  * Removes the process entry for the passed UUID obtained from a prior call
13957
14069
  * of fin.System.launchExternalProcess().
@@ -14648,6 +14760,14 @@ declare type SystemPermissions = {
14648
14760
  enabled: boolean;
14649
14761
  protocols: string[];
14650
14762
  };
14763
+ registerCustomProtocol: boolean | {
14764
+ enabled: boolean;
14765
+ protocols: string[];
14766
+ };
14767
+ unregisterCustomProtocol: boolean | {
14768
+ enabled: boolean;
14769
+ protocols: string[];
14770
+ };
14651
14771
  };
14652
14772
 
14653
14773
  /**
@@ -14996,7 +15116,7 @@ declare class Transport<MeType extends EntityType = EntityType> extends EventEmi
14996
15116
  connectSync: () => void;
14997
15117
  getPort: () => string;
14998
15118
  shutdown(): Promise<void>;
14999
- connect(config: InternalConnectConfig | RemoteConfig): Promise<string | void>;
15119
+ connect(config: InternalConnectConfig | RemoteConfig | ReceiverConfig): Promise<string | void>;
15000
15120
  private connectRemote;
15001
15121
  connectByPort(config: ExistingConnectConfig): Promise<void>;
15002
15122
  private authorize;
@@ -17047,6 +17167,8 @@ declare type WebRequestHeader = {
17047
17167
  [key: string]: string;
17048
17168
  };
17049
17169
 
17170
+ declare type WebSocketReadyState = WebSocket['readyState'];
17171
+
17050
17172
  /**
17051
17173
  * Generated when a window is being moved by the user.
17052
17174
  * @remarks For use with monitor scaling that is not 100%. Bounds are given in DIP (adjusted for monitor scale factor).
@@ -19051,7 +19173,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
19051
19173
  };
19052
19174
 
19053
19175
  declare type Wire = EventEmitter & {
19054
- connect(address: string, WsConstructor: typeof WebSocket): Promise<any>;
19176
+ connect(messageReciever: MessageReceiver): Promise<any>;
19055
19177
  connectSync(): any;
19056
19178
  send(data: any): Promise<any>;
19057
19179
  shutdown(): Promise<void>;
@@ -2971,7 +2971,7 @@ declare class ClassicStrategy implements ChannelStrategy<EndpointPayload> {
2971
2971
  private messageReceiver;
2972
2972
  private endpointId;
2973
2973
  private providerIdentity;
2974
- constructor(wire: Transport, messageReceiver: MessageReceiver, endpointId: string, // Provider endpointId is channelId
2974
+ constructor(wire: Transport, messageReceiver: MessageReceiver_2, endpointId: string, // Provider endpointId is channelId
2975
2975
  providerIdentity: ProviderIdentity_4);
2976
2976
  onEndpointDisconnect(endpointId: string, listener: () => void): void;
2977
2977
  receive(listener: (action: string, payload: any, identity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime | ProviderIdentity_4) => Promise<any>): void;
@@ -3454,7 +3454,7 @@ declare type ConstViewOptions = {
3454
3454
  /**
3455
3455
  * Controls interaction of the view with its parent window's download shelf.
3456
3456
  */
3457
- downloadShelf: {
3457
+ downloadShelf?: {
3458
3458
  /**
3459
3459
  * Whether downloads in this view trigger opening the download shelf on its parent BrowserWindow
3460
3460
  */
@@ -4359,6 +4359,14 @@ declare type CreateViewTarget = LayoutIdentity & {
4359
4359
  };
4360
4360
  };
4361
4361
 
4362
+ /**
4363
+ * Define possible options for Custom protocol.
4364
+ * @interface
4365
+ */
4366
+ declare type CustomProtocolOptions = {
4367
+ protocolName: string;
4368
+ };
4369
+
4362
4370
  /**
4363
4371
  * Custom headers for requests sent by the window.
4364
4372
  *
@@ -4376,6 +4384,8 @@ declare type CustomRequestHeaders = {
4376
4384
  headers: WebRequestHeader[];
4377
4385
  };
4378
4386
 
4387
+ declare type DataChannelReadyState = RTCDataChannel['readyState'];
4388
+
4379
4389
  /**
4380
4390
  * @interface
4381
4391
  */
@@ -4657,7 +4667,7 @@ declare type DownloadShelfOptions = {
4657
4667
  /**
4658
4668
  * Styling options for the download shelf border.
4659
4669
  */
4660
- border: {
4670
+ border?: {
4661
4671
  /**
4662
4672
  * Thickness of the border in pixels. Default 1 pixel. Used only for frameless windows.
4663
4673
  *
@@ -5133,7 +5143,7 @@ declare namespace ExternalApplicationEvents {
5133
5143
  }
5134
5144
 
5135
5145
  /**
5136
- * Union of possible `type` values for a {@link OpenFin.ApplicationEvents.ApplicationEvent}.
5146
+ * Union of possible `type` values for a {@link ApplicationEvent}.
5137
5147
  */
5138
5148
  declare type ExternalApplicationEventType = ExternalApplicationEvent['type'];
5139
5149
 
@@ -5463,6 +5473,8 @@ declare type FindIntentsByContextOptions<MetadataType = IntentMetadata_3> = {
5463
5473
  metadata?: MetadataType;
5464
5474
  };
5465
5475
 
5476
+ declare type FlexReadyState = WebSocketReadyState | DataChannelReadyState;
5477
+
5466
5478
  /**
5467
5479
  * Generated when a WebContents gains focus.
5468
5480
  * @interface
@@ -9105,7 +9117,17 @@ declare interface Message<T> {
9105
9117
 
9106
9118
  declare type MessageHandler = (data: any) => boolean;
9107
9119
 
9108
- declare class MessageReceiver extends Base {
9120
+ declare interface MessageReceiver {
9121
+ addEventListener(e: 'open', listener: (ev: Event) => void): void;
9122
+ addEventListener(e: 'error', listener: (ev: Event) => void): void;
9123
+ addEventListener(e: 'message', listener: (ev: MessageEvent) => void): void;
9124
+ addEventListener(e: 'close', listener: (ev: Event) => void): void;
9125
+ send(data: unknown): void;
9126
+ close(): void;
9127
+ readyState: FlexReadyState;
9128
+ }
9129
+
9130
+ declare class MessageReceiver_2 extends Base {
9109
9131
  private endpointMap;
9110
9132
  private latestEndpointIdByChannelId;
9111
9133
  constructor(wire: Transport);
@@ -9671,6 +9693,7 @@ declare namespace OpenFin {
9671
9693
  Rectangle,
9672
9694
  ApplicationCreationOptions,
9673
9695
  ApplicationOptions,
9696
+ CustomProtocolOptions,
9674
9697
  InteropBrokerOptions,
9675
9698
  ContextGroupInfo,
9676
9699
  DisplayMetadata_3 as DisplayMetadata,
@@ -11910,7 +11933,7 @@ declare type PropagatedEventType<Topic extends string, Type extends string> = `$
11910
11933
 
11911
11934
  /**
11912
11935
  * A view event that has propagated to a parent {@link OpenFin.WindowEvents Window}, {@link OpenFin.ApplicationEvents Application},
11913
- * or {@link Openfin.SystemEvents System}), adding a `viewIdentity` property (since the `Identity` property of the propagated event refers to the `Window`) and prefixing the
11936
+ * or {@link OpenFin.SystemEvents System}), adding a `viewIdentity` property (since the `Identity` property of the propagated event refers to the `Window`) and prefixing the
11914
11937
  * event type key with `'view-'`.
11915
11938
  */
11916
11939
  declare type PropagatedViewEvent<TargetTopic extends string> = PropagatedEvent<'view', TargetTopic, ViewEvent> & {
@@ -11924,7 +11947,7 @@ declare type PropagatedViewEventType = PropagatedViewEvent<string>['type'];
11924
11947
 
11925
11948
  /**
11926
11949
  * A Window event that has propagated to the parent {@link OpenFin.ApplicationEvents Application} and {@link OpenFin.SystemEvents System},
11927
- * prefixing the type string with `'window-'`. Only {@link NativeWindowEvent native window events} will propagate
11950
+ * prefixing the type string with `'window-'`. Only {@link WindowSourcedEvent window-sourced events} will propagate
11928
11951
  * this way; those that have {@link OpenFin.ViewEvents.PropagatedViewEvent propagated} from {@link OpenFin.ViewEvents}
11929
11952
  * will *not* re-propagate.
11930
11953
  *
@@ -12142,6 +12165,10 @@ declare interface ProtocolMap extends ProtocolMapBase {
12142
12165
  anchor: OpenFin.AnchorType;
12143
12166
  }>>;
12144
12167
  'set-window-bounds': IdentityCall<WithPositioningOptions<Partial<OpenFin.Bounds>>>;
12168
+ 'register-custom-protocol': ApiCall<OpenFin.CustomProtocolOptions, void>;
12169
+ 'unregister-custom-protocol': ApiCall<{
12170
+ protocolName: string;
12171
+ }, void>;
12145
12172
  }
12146
12173
 
12147
12174
  declare interface ProtocolMapBase {
@@ -12273,6 +12300,10 @@ declare interface ReactComponentConfig extends ItemConfig {
12273
12300
  */
12274
12301
  declare type ReadImageClipboardRequest = BaseClipboardRequest & ImageFormatOptions;
12275
12302
 
12303
+ declare interface ReceiverConfig extends Omit<RemoteConfig, 'address'> {
12304
+ receiver: MessageReceiver;
12305
+ }
12306
+
12276
12307
  /**
12277
12308
  * A rectangular area on the screen.
12278
12309
  *
@@ -12912,6 +12943,41 @@ declare type ShortcutOverride = Hotkey & {
12912
12943
 
12913
12944
  /**
12914
12945
  * Generated when the Download Shelf 'Show All' button is clicked.
12946
+ *
12947
+ * @remarks By default, OpenFin does not handle the clicking of the `Show All` button on the download
12948
+ * shelf. Instead, it fires this event, which leaves rendering a download manager to the user. For a simple
12949
+ * implementation, the `chrome://downloads` page can be used (see the example below):
12950
+ *
12951
+ * @example
12952
+ *
12953
+ * ```typescript
12954
+ * const platform = await fin.Platform.getCurrentSync();
12955
+ * // Listen to the propagated event at the Platform level, so that we only need one listener for a click from any window
12956
+ * platform.on('window-show-all-downloads', () => {
12957
+ * // Render the `chrome://downloads` window when a user clicks on the download shelf `Show All` button
12958
+ * platform.createWindow({
12959
+ * name: 'show-download-window',
12960
+ * layout: {
12961
+ * content: [
12962
+ * {
12963
+ * type: 'stack',
12964
+ * content: [
12965
+ * {
12966
+ * type: 'component',
12967
+ * componentName: 'view',
12968
+ * componentState: {
12969
+ * name: 'show-download-view',
12970
+ * url: 'chrome://downloads'
12971
+ * }
12972
+ * }
12973
+ * ]
12974
+ * }
12975
+ * ]
12976
+ * }
12977
+ * });
12978
+ * })
12979
+ * ```
12980
+ *
12915
12981
  * @interface
12916
12982
  */
12917
12983
  declare type ShowAllDownloadsEvent = BaseWindowEvent & {
@@ -13952,6 +14018,52 @@ declare class System extends EmitterBase<OpenFin.SystemEvent> {
13952
14018
  * ```
13953
14019
  */
13954
14020
  openUrlWithBrowser(url: string): Promise<void>;
14021
+ /**
14022
+ * Creates a new registry entry under the HKCU root Windows registry key if the given custom protocol name doesn't exist or
14023
+ * overwrites the existing registry entry if the given custom protocol name already exists.
14024
+ *
14025
+ * Note: This method is restricted by default and must be enabled via
14026
+ * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
14027
+ *
14028
+ *
14029
+ * @remarks These protocols are reserved and cannot be registered:
14030
+ * - fin
14031
+ * - fins
14032
+ * - openfin
14033
+ * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
14034
+ *
14035
+ * @throws if a given custom protocol failed to be registered.
14036
+ * @throws if a manifest URL contains the '%1' string.
14037
+ * @throws if a manifest URL contains a query string parameter which name equals to the Protocol Launch Request Parameter Name.
14038
+ * @throws if the full length of the command string that is to be written to the registry exceeds 2048 bytes.
14039
+ *
14040
+ * @example
14041
+ * ```js
14042
+ * fin.System.registerCustomProtocol({protocolName:'protocol1'}).then(console.log).catch(console.error);
14043
+ * ```
14044
+ */
14045
+ registerCustomProtocol(options: OpenFin.CustomProtocolOptions): Promise<void>;
14046
+ /**
14047
+ * Removes the registry entry for a given custom protocol.
14048
+ *
14049
+ * Note: This method is restricted by default and must be enabled via
14050
+ * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
14051
+ *
14052
+ *
14053
+ * @remarks These protocols are reserved and cannot be unregistered:
14054
+ * - fin
14055
+ * - fins
14056
+ * - openfin
14057
+ * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
14058
+ *
14059
+ * @throws if a protocol entry failed to be removed in registry.
14060
+ *
14061
+ * @example
14062
+ * ```js
14063
+ * await fin.System.unregisterCustomProtocol('protocol1');
14064
+ * ```
14065
+ */
14066
+ unregisterCustomProtocol(protocolName: string): Promise<void>;
13955
14067
  /**
13956
14068
  * Removes the process entry for the passed UUID obtained from a prior call
13957
14069
  * of fin.System.launchExternalProcess().
@@ -14648,6 +14760,14 @@ declare type SystemPermissions = {
14648
14760
  enabled: boolean;
14649
14761
  protocols: string[];
14650
14762
  };
14763
+ registerCustomProtocol: boolean | {
14764
+ enabled: boolean;
14765
+ protocols: string[];
14766
+ };
14767
+ unregisterCustomProtocol: boolean | {
14768
+ enabled: boolean;
14769
+ protocols: string[];
14770
+ };
14651
14771
  };
14652
14772
 
14653
14773
  /**
@@ -14996,7 +15116,7 @@ declare class Transport<MeType extends EntityType = EntityType> extends EventEmi
14996
15116
  connectSync: () => void;
14997
15117
  getPort: () => string;
14998
15118
  shutdown(): Promise<void>;
14999
- connect(config: InternalConnectConfig | RemoteConfig): Promise<string | void>;
15119
+ connect(config: InternalConnectConfig | RemoteConfig | ReceiverConfig): Promise<string | void>;
15000
15120
  private connectRemote;
15001
15121
  connectByPort(config: ExistingConnectConfig): Promise<void>;
15002
15122
  private authorize;
@@ -17047,6 +17167,8 @@ declare type WebRequestHeader = {
17047
17167
  [key: string]: string;
17048
17168
  };
17049
17169
 
17170
+ declare type WebSocketReadyState = WebSocket['readyState'];
17171
+
17050
17172
  /**
17051
17173
  * Generated when a window is being moved by the user.
17052
17174
  * @remarks For use with monitor scaling that is not 100%. Bounds are given in DIP (adjusted for monitor scale factor).
@@ -19051,7 +19173,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
19051
19173
  };
19052
19174
 
19053
19175
  declare type Wire = EventEmitter & {
19054
- connect(address: string, WsConstructor: typeof WebSocket): Promise<any>;
19176
+ connect(messageReciever: MessageReceiver): Promise<any>;
19055
19177
  connectSync(): any;
19056
19178
  send(data: any): Promise<any>;
19057
19179
  shutdown(): Promise<void>;
@@ -3011,7 +3011,7 @@ declare class ClassicStrategy implements ChannelStrategy<EndpointPayload> {
3011
3011
  private messageReceiver;
3012
3012
  private endpointId;
3013
3013
  private providerIdentity;
3014
- constructor(wire: Transport, messageReceiver: MessageReceiver, endpointId: string, // Provider endpointId is channelId
3014
+ constructor(wire: Transport, messageReceiver: MessageReceiver_2, endpointId: string, // Provider endpointId is channelId
3015
3015
  providerIdentity: ProviderIdentity_4);
3016
3016
  onEndpointDisconnect(endpointId: string, listener: () => void): void;
3017
3017
  receive(listener: (action: string, payload: any, identity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime | ProviderIdentity_4) => Promise<any>): void;
@@ -3548,7 +3548,7 @@ declare type ConstViewOptions = {
3548
3548
  /**
3549
3549
  * Controls interaction of the view with its parent window's download shelf.
3550
3550
  */
3551
- downloadShelf: {
3551
+ downloadShelf?: {
3552
3552
  /**
3553
3553
  * Whether downloads in this view trigger opening the download shelf on its parent BrowserWindow
3554
3554
  */
@@ -4453,6 +4453,14 @@ declare type CreateViewTarget = LayoutIdentity & {
4453
4453
  };
4454
4454
  };
4455
4455
 
4456
+ /**
4457
+ * Define possible options for Custom protocol.
4458
+ * @interface
4459
+ */
4460
+ declare type CustomProtocolOptions = {
4461
+ protocolName: string;
4462
+ };
4463
+
4456
4464
  /**
4457
4465
  * Custom headers for requests sent by the window.
4458
4466
  *
@@ -4470,6 +4478,8 @@ declare type CustomRequestHeaders = {
4470
4478
  headers: WebRequestHeader[];
4471
4479
  };
4472
4480
 
4481
+ declare type DataChannelReadyState = RTCDataChannel['readyState'];
4482
+
4473
4483
  /**
4474
4484
  * @interface
4475
4485
  */
@@ -4751,7 +4761,7 @@ declare type DownloadShelfOptions = {
4751
4761
  /**
4752
4762
  * Styling options for the download shelf border.
4753
4763
  */
4754
- border: {
4764
+ border?: {
4755
4765
  /**
4756
4766
  * Thickness of the border in pixels. Default 1 pixel. Used only for frameless windows.
4757
4767
  *
@@ -5251,7 +5261,7 @@ declare namespace ExternalApplicationEvents {
5251
5261
  }
5252
5262
 
5253
5263
  /**
5254
- * Union of possible `type` values for a {@link OpenFin.ApplicationEvents.ApplicationEvent}.
5264
+ * Union of possible `type` values for a {@link ApplicationEvent}.
5255
5265
  */
5256
5266
  declare type ExternalApplicationEventType = ExternalApplicationEvent['type'];
5257
5267
 
@@ -5603,6 +5613,8 @@ declare type FindIntentsByContextOptions<MetadataType = IntentMetadata_3> = {
5603
5613
  metadata?: MetadataType;
5604
5614
  };
5605
5615
 
5616
+ declare type FlexReadyState = WebSocketReadyState | DataChannelReadyState;
5617
+
5606
5618
  /**
5607
5619
  * Generated when a WebContents gains focus.
5608
5620
  * @interface
@@ -9455,7 +9467,17 @@ declare interface Message<T> {
9455
9467
 
9456
9468
  declare type MessageHandler = (data: any) => boolean;
9457
9469
 
9458
- declare class MessageReceiver extends Base {
9470
+ declare interface MessageReceiver {
9471
+ addEventListener(e: 'open', listener: (ev: Event) => void): void;
9472
+ addEventListener(e: 'error', listener: (ev: Event) => void): void;
9473
+ addEventListener(e: 'message', listener: (ev: MessageEvent) => void): void;
9474
+ addEventListener(e: 'close', listener: (ev: Event) => void): void;
9475
+ send(data: unknown): void;
9476
+ close(): void;
9477
+ readyState: FlexReadyState;
9478
+ }
9479
+
9480
+ declare class MessageReceiver_2 extends Base {
9459
9481
  private endpointMap;
9460
9482
  private latestEndpointIdByChannelId;
9461
9483
  constructor(wire: Transport);
@@ -10032,6 +10054,7 @@ declare namespace OpenFin {
10032
10054
  Rectangle,
10033
10055
  ApplicationCreationOptions,
10034
10056
  ApplicationOptions,
10057
+ CustomProtocolOptions,
10035
10058
  InteropBrokerOptions,
10036
10059
  ContextGroupInfo,
10037
10060
  DisplayMetadata_3 as DisplayMetadata,
@@ -12352,7 +12375,7 @@ declare type PropagatedEventType<Topic extends string, Type extends string> = `$
12352
12375
 
12353
12376
  /**
12354
12377
  * A view event that has propagated to a parent {@link OpenFin.WindowEvents Window}, {@link OpenFin.ApplicationEvents Application},
12355
- * or {@link Openfin.SystemEvents System}), adding a `viewIdentity` property (since the `Identity` property of the propagated event refers to the `Window`) and prefixing the
12378
+ * or {@link OpenFin.SystemEvents System}), adding a `viewIdentity` property (since the `Identity` property of the propagated event refers to the `Window`) and prefixing the
12356
12379
  * event type key with `'view-'`.
12357
12380
  */
12358
12381
  declare type PropagatedViewEvent<TargetTopic extends string> = PropagatedEvent<'view', TargetTopic, ViewEvent> & {
@@ -12366,7 +12389,7 @@ declare type PropagatedViewEventType = PropagatedViewEvent<string>['type'];
12366
12389
 
12367
12390
  /**
12368
12391
  * A Window event that has propagated to the parent {@link OpenFin.ApplicationEvents Application} and {@link OpenFin.SystemEvents System},
12369
- * prefixing the type string with `'window-'`. Only {@link NativeWindowEvent native window events} will propagate
12392
+ * prefixing the type string with `'window-'`. Only {@link WindowSourcedEvent window-sourced events} will propagate
12370
12393
  * this way; those that have {@link OpenFin.ViewEvents.PropagatedViewEvent propagated} from {@link OpenFin.ViewEvents}
12371
12394
  * will *not* re-propagate.
12372
12395
  *
@@ -12584,6 +12607,10 @@ declare interface ProtocolMap extends ProtocolMapBase {
12584
12607
  anchor: OpenFin.AnchorType;
12585
12608
  }>>;
12586
12609
  'set-window-bounds': IdentityCall<WithPositioningOptions<Partial<OpenFin.Bounds>>>;
12610
+ 'register-custom-protocol': ApiCall<OpenFin.CustomProtocolOptions, void>;
12611
+ 'unregister-custom-protocol': ApiCall<{
12612
+ protocolName: string;
12613
+ }, void>;
12587
12614
  }
12588
12615
 
12589
12616
  declare interface ProtocolMapBase {
@@ -12715,6 +12742,10 @@ declare interface ReactComponentConfig extends ItemConfig {
12715
12742
  */
12716
12743
  declare type ReadImageClipboardRequest = BaseClipboardRequest & ImageFormatOptions;
12717
12744
 
12745
+ declare interface ReceiverConfig extends Omit<RemoteConfig, 'address'> {
12746
+ receiver: MessageReceiver;
12747
+ }
12748
+
12718
12749
  /**
12719
12750
  * A rectangular area on the screen.
12720
12751
  *
@@ -13354,6 +13385,41 @@ declare type ShortcutOverride = Hotkey & {
13354
13385
 
13355
13386
  /**
13356
13387
  * Generated when the Download Shelf 'Show All' button is clicked.
13388
+ *
13389
+ * @remarks By default, OpenFin does not handle the clicking of the `Show All` button on the download
13390
+ * shelf. Instead, it fires this event, which leaves rendering a download manager to the user. For a simple
13391
+ * implementation, the `chrome://downloads` page can be used (see the example below):
13392
+ *
13393
+ * @example
13394
+ *
13395
+ * ```typescript
13396
+ * const platform = await fin.Platform.getCurrentSync();
13397
+ * // Listen to the propagated event at the Platform level, so that we only need one listener for a click from any window
13398
+ * platform.on('window-show-all-downloads', () => {
13399
+ * // Render the `chrome://downloads` window when a user clicks on the download shelf `Show All` button
13400
+ * platform.createWindow({
13401
+ * name: 'show-download-window',
13402
+ * layout: {
13403
+ * content: [
13404
+ * {
13405
+ * type: 'stack',
13406
+ * content: [
13407
+ * {
13408
+ * type: 'component',
13409
+ * componentName: 'view',
13410
+ * componentState: {
13411
+ * name: 'show-download-view',
13412
+ * url: 'chrome://downloads'
13413
+ * }
13414
+ * }
13415
+ * ]
13416
+ * }
13417
+ * ]
13418
+ * }
13419
+ * });
13420
+ * })
13421
+ * ```
13422
+ *
13357
13423
  * @interface
13358
13424
  */
13359
13425
  declare type ShowAllDownloadsEvent = BaseWindowEvent & {
@@ -14400,6 +14466,52 @@ declare class System extends EmitterBase<OpenFin.SystemEvent> {
14400
14466
  * ```
14401
14467
  */
14402
14468
  openUrlWithBrowser(url: string): Promise<void>;
14469
+ /**
14470
+ * Creates a new registry entry under the HKCU root Windows registry key if the given custom protocol name doesn't exist or
14471
+ * overwrites the existing registry entry if the given custom protocol name already exists.
14472
+ *
14473
+ * Note: This method is restricted by default and must be enabled via
14474
+ * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
14475
+ *
14476
+ *
14477
+ * @remarks These protocols are reserved and cannot be registered:
14478
+ * - fin
14479
+ * - fins
14480
+ * - openfin
14481
+ * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
14482
+ *
14483
+ * @throws if a given custom protocol failed to be registered.
14484
+ * @throws if a manifest URL contains the '%1' string.
14485
+ * @throws if a manifest URL contains a query string parameter which name equals to the Protocol Launch Request Parameter Name.
14486
+ * @throws if the full length of the command string that is to be written to the registry exceeds 2048 bytes.
14487
+ *
14488
+ * @example
14489
+ * ```js
14490
+ * fin.System.registerCustomProtocol({protocolName:'protocol1'}).then(console.log).catch(console.error);
14491
+ * ```
14492
+ */
14493
+ registerCustomProtocol(options: OpenFin.CustomProtocolOptions): Promise<void>;
14494
+ /**
14495
+ * Removes the registry entry for a given custom protocol.
14496
+ *
14497
+ * Note: This method is restricted by default and must be enabled via
14498
+ * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
14499
+ *
14500
+ *
14501
+ * @remarks These protocols are reserved and cannot be unregistered:
14502
+ * - fin
14503
+ * - fins
14504
+ * - openfin
14505
+ * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
14506
+ *
14507
+ * @throws if a protocol entry failed to be removed in registry.
14508
+ *
14509
+ * @example
14510
+ * ```js
14511
+ * await fin.System.unregisterCustomProtocol('protocol1');
14512
+ * ```
14513
+ */
14514
+ unregisterCustomProtocol(protocolName: string): Promise<void>;
14403
14515
  /**
14404
14516
  * Removes the process entry for the passed UUID obtained from a prior call
14405
14517
  * of fin.System.launchExternalProcess().
@@ -15096,6 +15208,14 @@ declare type SystemPermissions = {
15096
15208
  enabled: boolean;
15097
15209
  protocols: string[];
15098
15210
  };
15211
+ registerCustomProtocol: boolean | {
15212
+ enabled: boolean;
15213
+ protocols: string[];
15214
+ };
15215
+ unregisterCustomProtocol: boolean | {
15216
+ enabled: boolean;
15217
+ protocols: string[];
15218
+ };
15099
15219
  };
15100
15220
 
15101
15221
  /**
@@ -15501,7 +15621,7 @@ declare class Transport<MeType extends EntityType = EntityType> extends EventEmi
15501
15621
  connectSync: () => void;
15502
15622
  getPort: () => string;
15503
15623
  shutdown(): Promise<void>;
15504
- connect(config: InternalConnectConfig | RemoteConfig): Promise<string | void>;
15624
+ connect(config: InternalConnectConfig | RemoteConfig | ReceiverConfig): Promise<string | void>;
15505
15625
  private connectRemote;
15506
15626
  connectByPort(config: ExistingConnectConfig): Promise<void>;
15507
15627
  private authorize;
@@ -17589,6 +17709,8 @@ declare type WebRequestHeader = {
17589
17709
  [key: string]: string;
17590
17710
  };
17591
17711
 
17712
+ declare type WebSocketReadyState = WebSocket['readyState'];
17713
+
17592
17714
  /**
17593
17715
  * Generated when a window is being moved by the user.
17594
17716
  * @remarks For use with monitor scaling that is not 100%. Bounds are given in DIP (adjusted for monitor scale factor).
@@ -19677,7 +19799,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
19677
19799
  };
19678
19800
 
19679
19801
  declare type Wire = EventEmitter & {
19680
- connect(address: string, WsConstructor: typeof WebSocket): Promise<any>;
19802
+ connect(messageReciever: MessageReceiver): Promise<any>;
19681
19803
  connectSync(): any;
19682
19804
  send(data: any): Promise<any>;
19683
19805
  shutdown(): Promise<void>;
@@ -7436,6 +7436,59 @@ class System extends base_1$j.EmitterBase {
7436
7436
  openUrlWithBrowser(url) {
7437
7437
  return this.wire.sendAction('open-url-with-browser', { url }).then(() => undefined);
7438
7438
  }
7439
+ /**
7440
+ * Creates a new registry entry under the HKCU root Windows registry key if the given custom protocol name doesn't exist or
7441
+ * overwrites the existing registry entry if the given custom protocol name already exists.
7442
+ *
7443
+ * Note: This method is restricted by default and must be enabled via
7444
+ * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
7445
+ *
7446
+ *
7447
+ * @remarks These protocols are reserved and cannot be registered:
7448
+ * - fin
7449
+ * - fins
7450
+ * - openfin
7451
+ * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
7452
+ *
7453
+ * @throws if a given custom protocol failed to be registered.
7454
+ * @throws if a manifest URL contains the '%1' string.
7455
+ * @throws if a manifest URL contains a query string parameter which name equals to the Protocol Launch Request Parameter Name.
7456
+ * @throws if the full length of the command string that is to be written to the registry exceeds 2048 bytes.
7457
+ *
7458
+ * @example
7459
+ * ```js
7460
+ * fin.System.registerCustomProtocol({protocolName:'protocol1'}).then(console.log).catch(console.error);
7461
+ * ```
7462
+ */
7463
+ async registerCustomProtocol(options) {
7464
+ if (typeof options !== 'object') {
7465
+ throw new Error('Must provide an object with a `protocolName` property having a string value.');
7466
+ }
7467
+ await this.wire.sendAction('register-custom-protocol', options);
7468
+ }
7469
+ /**
7470
+ * Removes the registry entry for a given custom protocol.
7471
+ *
7472
+ * Note: This method is restricted by default and must be enabled via
7473
+ * {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
7474
+ *
7475
+ *
7476
+ * @remarks These protocols are reserved and cannot be unregistered:
7477
+ * - fin
7478
+ * - fins
7479
+ * - openfin
7480
+ * - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
7481
+ *
7482
+ * @throws if a protocol entry failed to be removed in registry.
7483
+ *
7484
+ * @example
7485
+ * ```js
7486
+ * await fin.System.unregisterCustomProtocol('protocol1');
7487
+ * ```
7488
+ */
7489
+ async unregisterCustomProtocol(protocolName) {
7490
+ await this.wire.sendAction('unregister-custom-protocol', { protocolName });
7491
+ }
7439
7492
  /**
7440
7493
  * Removes the process entry for the passed UUID obtained from a prior call
7441
7494
  * of fin.System.launchExternalProcess().
@@ -9738,10 +9791,10 @@ _ChannelProvider_connections = new WeakMap(), _ChannelProvider_protectedObj = ne
9738
9791
  // static #removalMap = new WeakMap<ChannelProvider, Function>();
9739
9792
  ChannelProvider.removalMap = new WeakMap();
9740
9793
 
9741
- var messageReceiver = {};
9794
+ var messageReceiver$1 = {};
9742
9795
 
9743
- Object.defineProperty(messageReceiver, "__esModule", { value: true });
9744
- messageReceiver.MessageReceiver = void 0;
9796
+ Object.defineProperty(messageReceiver$1, "__esModule", { value: true });
9797
+ messageReceiver$1.MessageReceiver = void 0;
9745
9798
  const client_1$1 = client;
9746
9799
  const base_1$h = base$1;
9747
9800
  /*
@@ -9812,7 +9865,7 @@ class MessageReceiver extends base_1$h.Base {
9812
9865
  }
9813
9866
  }
9814
9867
  }
9815
- messageReceiver.MessageReceiver = MessageReceiver;
9868
+ messageReceiver$1.MessageReceiver = MessageReceiver;
9816
9869
 
9817
9870
  var protocolManager = {};
9818
9871
 
@@ -9936,7 +9989,7 @@ const strategy_1 = strategy$2;
9936
9989
  const strategy_2 = strategy$1;
9937
9990
  const ice_manager_1 = iceManager;
9938
9991
  const provider_1$1 = provider;
9939
- const message_receiver_1 = messageReceiver;
9992
+ const message_receiver_1 = messageReceiver$1;
9940
9993
  const protocol_manager_1 = protocolManager;
9941
9994
  const strategy_3 = strategy;
9942
9995
  class ConnectionManager extends base_1$g.Base {
@@ -16534,7 +16587,7 @@ fin.Fin = Fin;
16534
16587
  var wire = {};
16535
16588
 
16536
16589
  Object.defineProperty(wire, "__esModule", { value: true });
16537
- wire.isInternalConnectConfig = wire.isPortDiscoveryConfig = wire.isNewConnectConfig = wire.isRemoteConfig = wire.isExistingConnectConfig = wire.isExternalConfig = void 0;
16590
+ wire.isInternalConnectConfig = wire.isPortDiscoveryConfig = wire.isNewConnectConfig = wire.isConfigWithReceiver = wire.isRemoteConfig = wire.isExistingConnectConfig = wire.isExternalConfig = void 0;
16538
16591
  function isExternalConfig(config) {
16539
16592
  if (typeof config.manifestUrl === 'string') {
16540
16593
  return true;
@@ -16550,6 +16603,10 @@ function isRemoteConfig(config) {
16550
16603
  return isExistingConnectConfig(config) && typeof config.token === 'string';
16551
16604
  }
16552
16605
  wire.isRemoteConfig = isRemoteConfig;
16606
+ function isConfigWithReceiver(config) {
16607
+ return typeof config.receiver === 'object' && isRemoteConfig({ ...config, address: '' });
16608
+ }
16609
+ wire.isConfigWithReceiver = isConfigWithReceiver;
16553
16610
  function hasUuid(config) {
16554
16611
  return typeof config.uuid === 'string';
16555
16612
  }
@@ -17551,13 +17608,13 @@ class Transport extends events_1$1.EventEmitter {
17551
17608
  }
17552
17609
  getFin() {
17553
17610
  if (!__classPrivateFieldGet(this, _Transport_fin, "f")) {
17554
- throw new Error("No Fin object registered for this transport");
17611
+ throw new Error('No Fin object registered for this transport');
17555
17612
  }
17556
17613
  return __classPrivateFieldGet(this, _Transport_fin, "f");
17557
17614
  }
17558
17615
  registerFin(_fin) {
17559
17616
  if (__classPrivateFieldGet(this, _Transport_fin, "f")) {
17560
- throw new Error("Fin object has already been registered for this transport");
17617
+ throw new Error('Fin object has already been registered for this transport');
17561
17618
  }
17562
17619
  __classPrivateFieldSet(this, _Transport_fin, _fin, "f");
17563
17620
  }
@@ -17566,6 +17623,10 @@ class Transport extends events_1$1.EventEmitter {
17566
17623
  return wire.shutdown();
17567
17624
  }
17568
17625
  async connect(config) {
17626
+ if ((0, wire_1$1.isConfigWithReceiver)(config)) {
17627
+ await __classPrivateFieldGet(this, _Transport_wire, "f").connect(config.receiver);
17628
+ return this.authorize(config);
17629
+ }
17569
17630
  if ((0, wire_1$1.isRemoteConfig)(config)) {
17570
17631
  return this.connectRemote(config);
17571
17632
  }
@@ -17579,14 +17640,14 @@ class Transport extends events_1$1.EventEmitter {
17579
17640
  return undefined;
17580
17641
  }
17581
17642
  async connectRemote(config) {
17582
- await __classPrivateFieldGet(this, _Transport_wire, "f").connect(config.address, this.environment.getWsConstructor());
17643
+ await __classPrivateFieldGet(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
17583
17644
  return this.authorize(config);
17584
17645
  }
17585
17646
  async connectByPort(config) {
17586
17647
  const { address, uuid } = config;
17587
17648
  const reqAuthPayload = { ...config, type: 'file-token' };
17588
17649
  const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
17589
- await wire.connect(address, this.environment.getWsConstructor());
17650
+ await wire.connect(new (this.environment.getWsConstructor())(config.address));
17590
17651
  const requestExtAuthRet = await this.sendAction('request-external-authorization', {
17591
17652
  uuid,
17592
17653
  type: 'file-token'
@@ -17606,7 +17667,9 @@ class Transport extends events_1$1.EventEmitter {
17606
17667
  throw new transport_errors_1$1.RuntimeError(requestAuthRet.payload);
17607
17668
  }
17608
17669
  }
17609
- sendAction(action, payload = {}, uncorrelated = false) {
17670
+ sendAction(action, payload = {}, uncorrelated = false
17671
+ // specialResponse type is only used for 'requestAuthorization'
17672
+ ) {
17610
17673
  // eslint-disable-next-line @typescript-eslint/no-empty-function
17611
17674
  let cancel = () => { };
17612
17675
  // We want the callsite from the caller of this function, not from here.
@@ -17656,7 +17719,10 @@ class Transport extends events_1$1.EventEmitter {
17656
17719
  this.uncorrelatedListener = resolve;
17657
17720
  }
17658
17721
  else if (this.wireListeners.has(id)) {
17659
- handleNack({ reason: 'Duplicate handler id', error: (0, errors_1.errorToPOJO)(new transport_errors_1$1.DuplicateCorrelationError(String(id))) });
17722
+ handleNack({
17723
+ reason: 'Duplicate handler id',
17724
+ error: (0, errors_1.errorToPOJO)(new transport_errors_1$1.DuplicateCorrelationError(String(id)))
17725
+ });
17660
17726
  }
17661
17727
  else {
17662
17728
  this.wireListeners.set(id, { resolve, handleNack });
@@ -17716,9 +17782,19 @@ _Transport_wire = new WeakMap(), _Transport_fin = new WeakMap();
17716
17782
 
17717
17783
  var websocket = {};
17718
17784
 
17785
+ var messageReceiver = {};
17786
+
17787
+ Object.defineProperty(messageReceiver, "__esModule", { value: true });
17788
+ messageReceiver.isOpen = void 0;
17789
+ function isOpen(receiver) {
17790
+ return receiver.readyState === 'open' || receiver.readyState === 1;
17791
+ }
17792
+ messageReceiver.isOpen = isOpen;
17793
+
17719
17794
  Object.defineProperty(websocket, "__esModule", { value: true });
17720
17795
  const events_1 = require$$0;
17721
17796
  const transport_errors_1 = transportErrors;
17797
+ const messageReceiver_1 = messageReceiver;
17722
17798
  /* `READY_STATE` is an instance var set by `constructor` to reference the `WebTransportSocket.READY_STATE` enum.
17723
17799
  * This is syntactic sugar that makes the enum accessible through the `wire` property of the various `fin` singletons.
17724
17800
  * For example, `fin.system.wire.READY_STATE` is a shortcut to `fin.system.wire.wire.constructor.READY_STATE`.
@@ -17736,15 +17812,18 @@ var READY_STATE;
17736
17812
  class WebSocketTransport extends events_1.EventEmitter {
17737
17813
  constructor(onmessage) {
17738
17814
  super();
17739
- this.connect = (address, WsConstructor) => {
17815
+ this.connect = (messageReceiver) => {
17740
17816
  return new Promise((resolve, reject) => {
17741
- this.wire = new WsConstructor(address);
17742
- this.wire.addEventListener('open', resolve);
17817
+ this.wire = messageReceiver;
17818
+ this.wire.addEventListener('open', () => resolve());
17743
17819
  this.wire.addEventListener('error', reject);
17744
17820
  this.wire.addEventListener('message', (message) => this.onmessage.call(null, JSON.parse(message.data)));
17745
17821
  this.wire.addEventListener('close', () => {
17746
17822
  this.emit('disconnected');
17747
17823
  });
17824
+ if ((0, messageReceiver_1.isOpen)(this.wire)) {
17825
+ resolve();
17826
+ }
17748
17827
  });
17749
17828
  };
17750
17829
  this.connectSync = () => {
@@ -17754,7 +17833,7 @@ class WebSocketTransport extends events_1.EventEmitter {
17754
17833
  }
17755
17834
  send(data, flags) {
17756
17835
  return new Promise((resolve, reject) => {
17757
- if (this.wire.readyState !== READY_STATE.OPEN) {
17836
+ if (!(0, messageReceiver_1.isOpen)(this.wire)) {
17758
17837
  reject(new transport_errors_1.DisconnectedError(READY_STATE[this.wire.readyState]));
17759
17838
  }
17760
17839
  else {
@@ -17768,6 +17847,7 @@ class WebSocketTransport extends events_1.EventEmitter {
17768
17847
  return Promise.resolve();
17769
17848
  }
17770
17849
  getPort() {
17850
+ // @ts-expect-error
17771
17851
  return this.wire.url.split(':').slice(-1)[0];
17772
17852
  }
17773
17853
  }
@@ -17901,9 +17981,9 @@ var application = {};
17901
17981
  * child {@link OpenFin.Window windows} and {@link OpenFin.View views} are defined in the {@link OpenFin.WindowEvents} and
17902
17982
  * {@link OpenFin.ViewEvents} namespaces. For a list of valid string keys for *all* application events, see {@link Application.on Application.on}.
17903
17983
  *
17904
- * {@link NativeApplicationEvent Native application events} (i.e. those that have not propagated from {@link OpenFin.ViewEvents Views}
17984
+ * {@link ApplicationSourcedEvent Application-sourced events} (i.e. those that have not propagated from {@link OpenFin.ViewEvents Views}
17905
17985
  * or {@link OpenFin.WindowEvents Windows} re-propagate to {@link OpenFin.SystemEvents System} with their type string prefixed with `application-`.
17906
- * {@link OpenFin.ApplicationEvents.ApplicationWindowEvent Application events that are tied to Windows but do not propagate from them}
17986
+ * {@link ApplicationWindowEvent Application events that are tied to Windows but do not propagate from them}
17907
17987
  * are propagated to `System` without any type string prefixing.
17908
17988
  *
17909
17989
  * "Requested" events (e.g. {@link RunRequestedEvent}) do not propagate.
@@ -18026,7 +18106,7 @@ var window$1 = {};
18026
18106
  * propagate from `View` are defined in {@link OpenFin.ViewEvents}. For a list of valid string keys for *all* Window events, see
18027
18107
  * {@link Window.on Window.on}
18028
18108
  *
18029
- * {@link OpenFin.WindowEvents.NativeWindowEvent Native window events} (i.e. those that are not propagated from a
18109
+ * {@link OpenFin.WindowEvents.WindowSourcedEvent Window-sourced events} (i.e. those that are not propagated from a
18030
18110
  * {@link OpenFin.ViewEvents View}) propagate to their parent {@link OpenFin.ApplicationEvents Application} and
18031
18111
  * {@link OpenFin.SystemEvents System} with their event types prefixed with `'window-'`).
18032
18112
  *
@@ -18071,10 +18151,10 @@ Object.defineProperty(window$1, "__esModule", { value: true });
18071
18151
  * finally to the OpenFin runtime itself at the "system" level. For details on propagation semantics, see the namespace for
18072
18152
  * the propagating (or propagated-to) entity.
18073
18153
  *
18074
- * If you need the payload type for a specific type of event (especially propagated events), use the emitting topic's `EventPayload`
18075
- * (e.g. {@link WindowEvents.WindowEventPayload}) generic with the event's `type` string. For example, the payload of
18154
+ * If you need the payload type for a specific type of event (especially propagated events), use the emitting topic's `Payload` generic
18155
+ * (e.g. {@link WindowEvents.Payload}) with the event's `type` string. For example, the payload of
18076
18156
  * a {@link ViewEvents.CreatedEvent} after it has propagated to its parent {@link WindowEvents Window} can be found with
18077
- * `WindowEventPayload<'view-created'>`.
18157
+ * `WindowEvents.Payload<'view-created'>`.
18078
18158
  *
18079
18159
  * @packageDocumentation
18080
18160
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/node-adapter",
3
- "version": "34.78.6",
3
+ "version": "34.78.8",
4
4
  "description": "See README.md",
5
5
  "main": "out/node-adapter.js",
6
6
  "types": "out/node-adapter.d.ts",