Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openfin-adapter

Package Overview
Dependencies
Maintainers
1
Versions
970
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openfin-adapter - npm Package Compare versions

Comparing version 18.54.14 to 18.55.1

2

package.json
{
"name": "openfin-adapter",
"version": "18.54.14",
"version": "18.55.1",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "main": "./src/main.js",

@@ -1,2 +0,2 @@

import { WebContentsEventMapping, WindowResourceLoadFailedEvent, WindowResourceResponseReceivedEvent } from './webcontents';
import { WebContentsEventMapping, WindowResourceLoadFailedEvent, WindowResourceResponseReceivedEvent, CertificateSelectionShownEvent } from './webcontents';
import { WindowEvent, BaseEventMap } from './base';

@@ -19,2 +19,3 @@ import { WindowNavigationRejectedEvent } from './window';

'view-blurred': WindowEvent<Topic, Type> & PropagatedViewIdentity;
'view-certificate-selection-shown': CertificateSelectionShownEvent<Topic, Type> & PropagatedViewIdentity;
'view-crashed': CrashedEvent & WindowEvent<Topic, Type> & PropagatedViewIdentity;

@@ -21,0 +22,0 @@ 'view-created': CrashedEvent & WindowEvent<Topic, Type> & PropagatedViewIdentity;

@@ -28,5 +28,10 @@ import { BaseEventMap, WindowEvent } from './base';

}
export interface CertificateSelectionShownEvent<Topic, Type> extends WindowEvent<Topic, Type> {
url: string;
certificates: Array<Electron.Certificate>;
}
export interface WebContentsEventMapping<Topic = string, Type = string> extends BaseEventMap {
'blurred': WindowEvent<Topic, Type>;
'certificate-error': CertificateErrorEvent<Topic, Type>;
'certificate-selection-shown': CertificateSelectionShownEvent<Topic, Type>;
'crashed': CrashedEvent & WindowEvent<Topic, Type>;

@@ -33,0 +38,0 @@ 'did-change-theme-color': WindowEvent<Topic, Type>;

import { CrashedEvent } from './application';
import { WindowEvent, BaseEventMap } from './base';
import { WindowOptionDiff, WindowOption } from '../window/windowOption';
import { WebContentsEventMapping, WindowResourceLoadFailedEvent, WindowResourceResponseReceivedEvent } from './webcontents';
import { WebContentsEventMapping, WindowResourceLoadFailedEvent, WindowResourceResponseReceivedEvent, CertificateSelectionShownEvent } from './webcontents';
import { PropagatedViewEventMapping, InputEvent } from './view';

@@ -150,2 +150,3 @@ export declare type SpecificWindowEvent<Type> = WindowEvent<'window', Type>;

'window-bounds-changing': WindowBoundsChange<Topic, Type>;
'window-certificate-selection-shown': CertificateSelectionShownEvent<Topic, Type>;
'window-closed': WindowEvent<Topic, Type>;

@@ -152,0 +153,0 @@ 'window-closing': WindowEvent<Topic, Type>;

@@ -18,3 +18,3 @@ /// <reference types="node" />

import { Me } from './me';
export interface FinApi<T extends EntityType> {
export interface FinApi<MeType extends EntityType> {
readonly System: System;

@@ -32,5 +32,5 @@ readonly Window: _WindowModule;

readonly Platform: PlatformModule;
readonly me: Me<T>;
readonly me: Me<MeType>;
}
export default class Fin<T extends EntityType = EntityType> extends EventEmitter implements FinApi<T> {
export default class Fin<MeType extends EntityType = EntityType> extends EventEmitter implements FinApi<MeType> {
private wire;

@@ -49,4 +49,4 @@ System: System;

Platform: PlatformModule;
readonly me: Me<T>;
constructor(wire: Transport<T>);
readonly me: Me<MeType>;
constructor(wire: Transport<MeType>);
}

@@ -30,3 +30,3 @@ import EntityType from '../shapes/EntityType';

export declare function getBaseMe<T extends EntityType = EntityType>(entityType: T, uuid: string, name: string): OpenFin.EntityInfo & EntityTypeHelpers<T>;
export declare type Me<T extends EntityType> = OpenFin.EntityInfo & (T extends EntityType.VIEW ? EntityTypeHelpers<EntityType.VIEW> & OpenFin.View : T extends EntityType.WINDOW ? EntityTypeHelpers<EntityType.WINDOW> & OpenFin.Window : T extends EntityType.IFRAME ? EntityTypeHelpers<EntityType.IFRAME> & OpenFin.Frame : EntityTypeHelpers<T>);
export declare function getMe<T extends EntityType>(wire: Transport<T>): Me<T>;
export declare type Me<MeType extends EntityType> = OpenFin.EntityInfo & (MeType extends EntityType.VIEW ? EntityTypeHelpers<EntityType.VIEW> & OpenFin.View : MeType extends EntityType.WINDOW ? EntityTypeHelpers<EntityType.WINDOW> & OpenFin.Window : MeType extends EntityType.IFRAME ? EntityTypeHelpers<EntityType.IFRAME> & OpenFin.Frame : EntityTypeHelpers<MeType>);
export declare function getMe<MeType extends EntityType>(wire: Transport<MeType>): Me<MeType>;

@@ -5,3 +5,2 @@ "use strict";

const base_1 = require("../base");
const platform_provider_1 = require("./renderer/platform-provider");
const index_1 = require("./layout/index");

@@ -46,3 +45,3 @@ const Instance_1 = require("./Instance");

this._channel = channel;
this._initializer = platform_provider_1.default(this.wire.environment);
this._initializer = (...args) => Promise.resolve().then(() => require('./renderer/platform-provider')).then(({ default: initConstructor }) => initConstructor(this.wire.environment)(...args));
/**

@@ -49,0 +48,0 @@ * @namespace

@@ -270,10 +270,5 @@ "use strict";

}
await this.getClient();
const client = await this.getClient();
const manifest = await this.fetchManifest(manifestUrl);
const userAppConfigArgs = { launchManifestIntoPlatform: manifest };
const app = fin.Application.wrapSync(this.identity);
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore using private variable.
// eslint-disable-next-line no-underscore-dangle
await app._run({ ...this.identity, userAppConfigArgs });
client.dispatch('launch-into-platform', { manifest });
return this;

@@ -280,0 +275,0 @@ }

@@ -21,3 +21,2 @@ "use strict";

const { initialOptions: initialAppOptions } = await app.getInfo();
const runRequestedLoopPreventionUrls = new Set();
let provider;

@@ -320,68 +319,17 @@ let platformProvider;

// TODO: non-any types would be better
const launchIntoPlatform = async ({ manifest, userAppConfigArgs = {} }) => {
const { launchManifestIntoPlatform, appManifestUrl } = userAppConfigArgs;
// launchManifestIntoPlatform in userAppConfigArgs means there is a separate manifest to launch than the target manifest,
// either from a fins link or launchContentManifest API call, this one should be launched instead
if (launchManifestIntoPlatform &&
(launchManifestIntoPlatform.startup_app || launchManifestIntoPlatform.snapshot)) {
try {
runRequestedLoopPreventionUrls.delete(appManifestUrl);
const { startup_app, snapshot } = launchManifestIntoPlatform;
// if there is a snapshot in that manifest, it takes precedence launch the snapshot and ignore the initial manifest
if (snapshot) {
return platformProvider.applySnapshot({ snapshot: await convertSnapshotWindowOptions(snapshot) }, fin.me.identity);
}
// if there is not a snapshot it is a legacy manifest, try to launch the main window described
// in startup_app as a single view in a new window
// TODO - we need a way to allow users to put this single view into a location in an existing window
startup_app.name = startup_app.uuid;
const layout = {
content: [
{
type: 'stack',
content: [
{
type: 'component',
componentName: 'view',
componentState: startup_app
}
]
}
]
};
const windowOptions = {
...(await convertWindowOptions({ layout })),
reason: Platform_1.WindowCreationReason.AppCreation
};
return platformProvider.createWindow(windowOptions, fin.me.identity);
}
catch (err) {
// there was a second manifest to launch but there were issues launching it, throw error
throw new Error(`Error launching manifest into platform: ${JSON.stringify(launchManifestIntoPlatform)}
${JSON.stringify(errors_1.errorToPOJO(err))}`);
}
}
// this logic may not be necessary, but essentially if there is an appManifestUrl, then the core SHOULD have added
// a launchManifestIntoPlatform property or thrown an error. There may be some multi-runtime instances where this is not true
// if that is the case, this will take one more trip to the core and go through the correct logic.
const handleRunRequested = async ({ manifest, userAppConfigArgs = {} }) => {
const { appManifestUrl } = userAppConfigArgs;
// If there is an appManifestUrl, use launchContentManifest to launch the content
if (appManifestUrl) {
if (runRequestedLoopPreventionUrls.has(appManifestUrl)) {
runRequestedLoopPreventionUrls.delete(appManifestUrl);
throw new Error(`Unable to fetch manifest at url ${appManifestUrl}`);
}
// if this fails to fetch in the core, it gets sent back
// this is in order to ensure that the first manifest fetch works successfully if it needs auth
runRequestedLoopPreventionUrls.add(appManifestUrl);
return fin.Platform.getCurrentSync().launchContentManifest(appManifestUrl);
}
// there was no second target manifest, this is a normal run-requested event
const snapshot = manifest === null || manifest === void 0 ? void 0 : manifest.snapshot;
if (snapshot) {
if (manifest === null || manifest === void 0 ? void 0 : manifest.snapshot) {
// check the original manifest for a snapshot and launch it
return platformProvider.applySnapshot({ snapshot: await convertSnapshotWindowOptions(snapshot) }, fin.me.identity);
return platformProvider.launchIntoPlatform(manifest);
}
throw new Error('Failed to launch into platform, no snapshot included in manifest.');
throw new Error('Failed to launch into platform from run-requested call. Requires an `appManifestUrl` query parameter or a snapshot in the manifest.');
};
// Startup setup needed ASAP
const startupRunRequestedPromise = app.on('run-requested', launchIntoPlatform);
const startupRunRequestedPromise = app.on('run-requested', handleRunRequested);
const startupWindowClosePromise = app.on('window-closed', async () => {

@@ -809,2 +757,30 @@ if (!isReplacingSnapshot) {

}
async launchIntoPlatform(payload) {
const { manifest } = payload;
if (!manifest || !(manifest.startup_app || manifest.snapshot)) {
throw new Error(`Error launching the following manifest into platform, does not include a snapshot or startup_app property: ${JSON.stringify(manifest)}`);
}
const { startup_app, snapshot } = manifest;
try {
// if there is a snapshot in that manifest, it takes precedence so launch the snapshot and ignore the startup_app
if (snapshot) {
await platformProvider.applySnapshot({ snapshot: await convertSnapshotWindowOptions(snapshot) }, fin.me.identity);
return;
}
// if there is not a snapshot it is a legacy manifest, try to launch the main window as a single view in a new window
startup_app.name = startup_app.uuid;
const layout = utils_1.generateLayoutContent(startup_app);
const windowOptions = {
...(await convertWindowOptions({ layout })),
reason: Platform_1.WindowCreationReason.AppCreation
};
await platformProvider.createWindow(windowOptions, fin.me.identity);
return;
}
catch (err) {
// there was a manifest to launch but there were issues launching it, throw error
throw new Error(`Error launching the following manifest into platform: ${JSON.stringify(manifest)}
${JSON.stringify(errors_1.errorToPOJO(err))}`);
}
}
}

@@ -831,2 +807,3 @@ platformProvider = new DefaultProvider();

provider.register('replace-layout', platformProvider.replaceLayout.bind(platformProvider));
provider.register('launch-into-platform', platformProvider.launchIntoPlatform.bind(platformProvider));
Object.keys(platformProvider).forEach((key) => {

@@ -833,0 +810,0 @@ provider.register(key, platformProvider[key].bind(platformProvider));

@@ -58,2 +58,5 @@ import type { ApplicationOption } from '../api/application/applicationOption';

}
export interface LaunchIntoPlatformPayload {
manifest: any;
}
export interface GetWindowContextPayload {

@@ -146,2 +149,3 @@ entityType: EntityType;

replaceLayout(payload: ReplaceLayoutPayload, identity?: OpenFin.Identity): Promise<void>;
launchIntoPlatform(payload: LaunchIntoPlatformPayload): Promise<void>;
/**

@@ -148,0 +152,0 @@ * Handles requests to set a window's context. `target` may be a window or a view.

@@ -10,3 +10,3 @@ /// <reference types="node" />

export declare type MessageHandler = (data: any) => boolean;
declare class Transport<T extends EntityType = EntityType> extends EventEmitter {
declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
#private;

@@ -18,3 +18,3 @@ protected wireListeners: Map<number, {

protected uncorrelatedListener: Function;
me: OpenFin.EntityInfo & EntityTypeHelpers<T>;
me: OpenFin.EntityInfo & EntityTypeHelpers<MeType>;
environment: Environment;

@@ -21,0 +21,0 @@ topicRefMap: Map<string, number>;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc