New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@openfin/node-adapter

Package Overview
Dependencies
Maintainers
52
Versions
443
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfin/node-adapter

See README.md

  • 34.78.3
  • npm
  • Socket score

Version published
Weekly downloads
3.2K
decreased by-41.53%
Maintainers
52
Weekly downloads
 
Created
Source

OpenFin Node.js adapter

Allows the use of the OpenFin API from node.js. Please note the launch and connect methods are specific to a node environment.

Requirements

  • Node.js 16 or greater

Usage

Connect

connect can be used to establish a connection to an OpenFin runtime from node.

A uuid must be provided to identify the connection. Multiple connections will require distinct uuids.

A runtime version or manifest url must also be specified.

Note - connect will instantiate a runtime instance if one does not exist for the given configuration. If the runtime is already running, connect will simply establish a new connection.

Connecting via Runtime Version

import { connect } from '@openfin/node-adapter';

(async () => {
    const fin = await connect({
        uuid: 'my-uuid-123',
        runtime: {
            version: 'stable'
        }
    });
    await fin.Platform.startFromManifest('http://www.your-domain-goes-here.com/manifest.json');
})();

Connecting via Manifest Url

import { connect } from '@openfin/node-adapter';

(async () => {
    const fin = await connect({
        uuid: 'connection-id',
        manifestUrl: 'http://www.your-domain-goes-here.com/manifest'
    });
})();

Launch

Unlike connect, launch starts an OpenFin application if not running and returns a port number instead of a fin object.

This can be provided to connect to create a fin object for the runtime that has been created on the specific port.

launch can be called multiple times for a given application, however launches for an application that is already running will result in a run-requested event being triggered instead of a relaunch. If the application is an OpenFin platform, this will result in the layout windows reloading.

Launching and Connecting via Port

import { launch, connect } from '@openfin/node-adapter';

(async () => {
    const port = await launch({
        manifestUrl: 'http://www.your-domain-goes-here.com/manifest'
    });

    const fin = await connect({
        address: `ws://localhost:${port}`,
        uuid: 'external-app-via-launch'
    });

    console.log(await fin.System.getRuntimeInfo());
})();

Types

@openfin/node-adapter comes bundled with its own types types.

If you wish to explicitly reference OpenFin types, the OpenFin namespace export may be used as follows:

Type Usage Example

import OpenFin, { connect } from '@openfin/node-adapter';

(async () => {
    const fin: OpenFin.Fin<'external connection'> = await connect({
        uuid: 'connection-id'
    });
    const platform: OpenFin.Platform = await fin.Platform.startFromManifest(
        'http://www.your-domain-goes-here.com/manifest'
    );
})();

Migrating from openfin-adapter to @openfin/node-adapter

For users of the connect and launch functions in openfin-adapter, no changes are necessary, other than updating the dependency name.

If using the exported types from openfin-adapter, an OpenFin export has been created that encapsualates them.

Before

import { launch, connect, Application, Fin } from 'openfin-adapter';

(async () => {
    const fin: Fin = await connect({
        uuid: 'external-connection-1', 
        runtime: { version: 'stable' } 
    });
    const app: Application = await fin.Application.start({...});
})()

After

import OpenFin, { launch, connect } from '@openfin/node-adapter';
(async () => {
    const fin: OpenFin.Fin<'external connection'> = await connect({ 
        uuid: 'external-connection-1', 
        runtime: { version: 'stable' } 
    });
    const app: OpenFin.Application = await fin.Application.start({...});
})()


Further Reading

License

Copyright 2020-2023 OpenFin

The code in this package is distributed under the Apache License, Version 2.0.

However, if you run this code, it may call on the OpenFin RVM or OpenFin Runtime, which are covered by OpenFin's Developer, Community, and Enterprise licenses. You can learn more about OpenFin licensing at the links listed below or email us at support@openfin.co with questions.

FAQs

Package last updated on 19 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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