@openfin/node-adapter 38.81.41 → 38.81.44
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.
package/out/node-adapter.js
CHANGED
@@ -86,7 +86,7 @@ var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
86
86
|
var _EmitterBase_emitterAccessor;
|
87
87
|
Object.defineProperty(base$1, "__esModule", { value: true });
|
88
88
|
base$1.Reply = base$1.EmitterBase = base$1.Base = void 0;
|
89
|
-
const promises_1$
|
89
|
+
const promises_1$3 = promises;
|
90
90
|
class Base {
|
91
91
|
/**
|
92
92
|
* @internal
|
@@ -316,7 +316,7 @@ class EmitterBase extends Base {
|
|
316
316
|
}
|
317
317
|
else if (this.hasEmitter()) {
|
318
318
|
const events = this.getOrCreateEmitter().eventNames();
|
319
|
-
await (0, promises_1$
|
319
|
+
await (0, promises_1$3.promiseMap)(events, removeByEvent);
|
320
320
|
}
|
321
321
|
return this;
|
322
322
|
}
|
@@ -5633,7 +5633,7 @@ function requireWindow () {
|
|
5633
5633
|
Object.defineProperty(system$1, "__esModule", { value: true });
|
5634
5634
|
system$1.System = void 0;
|
5635
5635
|
const base_1$i = base$1;
|
5636
|
-
const transport_errors_1$
|
5636
|
+
const transport_errors_1$3 = transportErrors;
|
5637
5637
|
const window_1 = requireWindow();
|
5638
5638
|
const events_1$6 = require$$0;
|
5639
5639
|
/**
|
@@ -6711,9 +6711,9 @@ class System extends base_1$i.EmitterBase {
|
|
6711
6711
|
});
|
6712
6712
|
// node.js environment not supported
|
6713
6713
|
if (this.wire.environment.type !== 'openfin') {
|
6714
|
-
throw new transport_errors_1$
|
6714
|
+
throw new transport_errors_1$3.NotSupportedError('downloadAsset only supported in an OpenFin Render process');
|
6715
6715
|
}
|
6716
|
-
const callSite = transport_errors_1$
|
6716
|
+
const callSite = transport_errors_1$3.RuntimeError.getCallSite();
|
6717
6717
|
const downloadId = this.wire.environment.getNextMessageId().toString();
|
6718
6718
|
const dlProgressKey = `asset-download-progress-${downloadId}`;
|
6719
6719
|
const dlErrorKey = `asset-download-error-${downloadId}`;
|
@@ -6733,7 +6733,7 @@ class System extends base_1$i.EmitterBase {
|
|
6733
6733
|
const dlError = (payload) => {
|
6734
6734
|
cleanListeners();
|
6735
6735
|
const { reason, err: error } = payload;
|
6736
|
-
reject(new transport_errors_1$
|
6736
|
+
reject(new transport_errors_1$3.RuntimeError({ reason, error }, callSite));
|
6737
6737
|
};
|
6738
6738
|
const dlComplete = () => {
|
6739
6739
|
cleanListeners();
|
@@ -6784,11 +6784,11 @@ class System extends base_1$i.EmitterBase {
|
|
6784
6784
|
* ```
|
6785
6785
|
*/
|
6786
6786
|
downloadRuntime(options, progressListener) {
|
6787
|
-
const callsites = transport_errors_1$
|
6787
|
+
const callsites = transport_errors_1$3.RuntimeError.getCallSite();
|
6788
6788
|
return new Promise((resolve, reject) => {
|
6789
6789
|
// node.js environment not supported
|
6790
6790
|
if (this.wire.environment.type !== 'openfin') {
|
6791
|
-
reject(new transport_errors_1$
|
6791
|
+
reject(new transport_errors_1$3.NotSupportedError('downloadRuntime only supported in an OpenFin Render process'));
|
6792
6792
|
return;
|
6793
6793
|
}
|
6794
6794
|
const downloadId = this.wire.environment.getNextMessageId().toString();
|
@@ -6810,7 +6810,7 @@ class System extends base_1$i.EmitterBase {
|
|
6810
6810
|
const dlError = (payload) => {
|
6811
6811
|
cleanListeners();
|
6812
6812
|
const { reason, err: error } = payload;
|
6813
|
-
reject(new transport_errors_1$
|
6813
|
+
reject(new transport_errors_1$3.RuntimeError({ reason, error }, callsites));
|
6814
6814
|
};
|
6815
6815
|
const dlComplete = () => {
|
6816
6816
|
cleanListeners();
|
@@ -16717,7 +16717,7 @@ environment.notImplementedEnvErrorMsg = 'Not implemented in this environment';
|
|
16717
16717
|
|
16718
16718
|
var portDiscovery = {};
|
16719
16719
|
|
16720
|
-
var launcher = {};
|
16720
|
+
var launcher$1 = {};
|
16721
16721
|
|
16722
16722
|
var nixLaunch = {};
|
16723
16723
|
|
@@ -16832,12 +16832,12 @@ var http = {};
|
|
16832
16832
|
|
16833
16833
|
Object.defineProperty(util, "__esModule", { value: true });
|
16834
16834
|
util.resolveDir = util.first = util.resolveRuntimeVersion = util.rmDir = util.unzip = util.exists = void 0;
|
16835
|
-
const path$
|
16836
|
-
const fs$
|
16837
|
-
const child_process_1$
|
16838
|
-
const promises_1$
|
16839
|
-
const http_1$
|
16840
|
-
const stat = (0, promises_1$
|
16835
|
+
const path$4 = require$$1;
|
16836
|
+
const fs$3 = require$$0$2;
|
16837
|
+
const child_process_1$2 = require$$2;
|
16838
|
+
const promises_1$2 = promises;
|
16839
|
+
const http_1$2 = http;
|
16840
|
+
const stat = (0, promises_1$2.promisify)(fs$3.stat);
|
16841
16841
|
async function exists(filePath) {
|
16842
16842
|
try {
|
16843
16843
|
const existed = await stat(filePath);
|
@@ -16849,14 +16849,14 @@ async function exists(filePath) {
|
|
16849
16849
|
}
|
16850
16850
|
util.exists = exists;
|
16851
16851
|
async function unzip(file, dest) {
|
16852
|
-
const ex = (0, promises_1$
|
16852
|
+
const ex = (0, promises_1$2.promisify)(child_process_1$2.exec);
|
16853
16853
|
return ex(`unzip ${file} -d ${dest}`, { encoding: 'utf8' });
|
16854
16854
|
}
|
16855
16855
|
util.unzip = unzip;
|
16856
|
-
const lstat = (0, promises_1$
|
16857
|
-
const unlink = (0, promises_1$
|
16858
|
-
const readdir = (0, promises_1$
|
16859
|
-
const rmdir = (0, promises_1$
|
16856
|
+
const lstat = (0, promises_1$2.promisify)(fs$3.lstat);
|
16857
|
+
const unlink = (0, promises_1$2.promisify)(fs$3.unlink);
|
16858
|
+
const readdir = (0, promises_1$2.promisify)(fs$3.readdir);
|
16859
|
+
const rmdir = (0, promises_1$2.promisify)(fs$3.rmdir);
|
16860
16860
|
async function rmDir(dirPath, removeSelf = true) {
|
16861
16861
|
let files;
|
16862
16862
|
try {
|
@@ -16866,7 +16866,7 @@ async function rmDir(dirPath, removeSelf = true) {
|
|
16866
16866
|
return;
|
16867
16867
|
}
|
16868
16868
|
if (files.length > 0) {
|
16869
|
-
await (0, promises_1$
|
16869
|
+
await (0, promises_1$2.promiseMap)(files, async (f) => {
|
16870
16870
|
const filePath = `${dirPath}/${f}`;
|
16871
16871
|
const file = await lstat(filePath);
|
16872
16872
|
if (file.isFile() || file.isSymbolicLink()) {
|
@@ -16888,7 +16888,7 @@ async function resolveRuntimeVersion(versionOrChannel) {
|
|
16888
16888
|
if (isVersion) {
|
16889
16889
|
const mustMatch = takeWhile(splitVersion, (x) => x !== '*');
|
16890
16890
|
if (4 - mustMatch.length > 0) {
|
16891
|
-
const res = await (0, http_1$
|
16891
|
+
const res = await (0, http_1$2.fetch)('https://cdn.openfin.co/release/runtimeVersions');
|
16892
16892
|
const versions = res.split('\n');
|
16893
16893
|
const match = first(versions, (v) => v.split('.').slice(0, mustMatch.length).join('.') === mustMatch.join('.'));
|
16894
16894
|
if (match) {
|
@@ -16900,7 +16900,7 @@ async function resolveRuntimeVersion(versionOrChannel) {
|
|
16900
16900
|
}
|
16901
16901
|
}
|
16902
16902
|
try {
|
16903
|
-
return await (0, http_1$
|
16903
|
+
return await (0, http_1$2.fetch)(`https://cdn.openfin.co/release/runtime/${versionOrChannel}`);
|
16904
16904
|
}
|
16905
16905
|
catch (err) {
|
16906
16906
|
throw Error('Could not resolve runtime version');
|
@@ -16919,13 +16919,13 @@ util.first = first;
|
|
16919
16919
|
function takeWhile(arr, func) {
|
16920
16920
|
return arr.reduce(({ take, vals }, x, i, r) => take && func(x, i, r) ? { take: true, vals: [...vals, x] } : { take: false, vals }, { take: true, vals: [] }).vals;
|
16921
16921
|
}
|
16922
|
-
const mkdir = (0, promises_1$
|
16922
|
+
const mkdir$1 = (0, promises_1$2.promisify)(fs$3.mkdir);
|
16923
16923
|
async function resolveDir(base, paths) {
|
16924
16924
|
return paths.reduce(async (p, next) => {
|
16925
16925
|
try {
|
16926
16926
|
const prev = await p;
|
16927
|
-
await mkdir(path$
|
16928
|
-
return path$
|
16927
|
+
await mkdir$1(path$4.resolve(prev, next));
|
16928
|
+
return path$4.join(prev, next);
|
16929
16929
|
}
|
16930
16930
|
catch (err) {
|
16931
16931
|
return err.code === 'EEXIST' ? err.path : Promise.reject(err);
|
@@ -16934,157 +16934,109 @@ async function resolveDir(base, paths) {
|
|
16934
16934
|
}
|
16935
16935
|
util.resolveDir = resolveDir;
|
16936
16936
|
|
16937
|
-
|
16938
|
-
|
16939
|
-
|
16940
|
-
|
16941
|
-
|
16942
|
-
|
16943
|
-
|
16944
|
-
|
16945
|
-
|
16946
|
-
|
16947
|
-
|
16948
|
-
|
16949
|
-
|
16950
|
-
const appDirectoryHost = process.env.appDirectoryHost || 'https://app-directory.openfin.co';
|
16951
|
-
const lookupServiceUrl = async (serviceName) => {
|
16952
|
-
if (appDirectoryHost.length > 0) {
|
16953
|
-
const appUrl = `${appDirectoryHost}/api/v1/apps/services.${serviceName}`;
|
16954
|
-
const mani = await (0, http_1.fetchJson)(appUrl);
|
16955
|
-
return mani.manifest_url;
|
16956
|
-
}
|
16957
|
-
console.error(`error getting startup url for ${serviceName}, host: ${appDirectoryHost}`);
|
16958
|
-
return '';
|
16959
|
-
};
|
16960
|
-
exports.lookupServiceUrl = lookupServiceUrl;
|
16961
|
-
const launchService = async (service) => {
|
16962
|
-
let sURL = '';
|
16963
|
-
if (service.manifestUrl) {
|
16964
|
-
sURL = service.manifestUrl;
|
16965
|
-
}
|
16966
|
-
else {
|
16967
|
-
sURL = await (0, exports.lookupServiceUrl)(service.name);
|
16968
|
-
}
|
16969
|
-
await (0, main_1.launch)({ manifestUrl: sURL });
|
16970
|
-
};
|
16971
|
-
exports.launchService = launchService;
|
16972
|
-
const startServices = async (services) => {
|
16973
|
-
await (0, promises_1.promiseMapSerial)(services, exports.launchService);
|
16974
|
-
};
|
16975
|
-
exports.startServices = startServices;
|
16976
|
-
} (services));
|
16977
|
-
return services;
|
16937
|
+
Object.defineProperty(nixLaunch, "__esModule", { value: true });
|
16938
|
+
nixLaunch.launch = nixLaunch.install = nixLaunch.getRuntimePath = nixLaunch.download = nixLaunch.getUrl = void 0;
|
16939
|
+
const fs$2 = require$$0$2;
|
16940
|
+
const path$3 = require$$1;
|
16941
|
+
const child_process_1$1 = require$$2;
|
16942
|
+
const promises_1$1 = promises;
|
16943
|
+
const util_1$1 = util;
|
16944
|
+
const http_1$1 = http;
|
16945
|
+
const mkdir = (0, promises_1$1.promisify)(fs$2.mkdir);
|
16946
|
+
const downloads = {};
|
16947
|
+
function getUrl(version, urlPath) {
|
16948
|
+
const runtimeRoot = process.env.assetsUrl || 'https://cdn.openfin.co/release/runtime/';
|
16949
|
+
return `${runtimeRoot}${urlPath}/${version}`;
|
16978
16950
|
}
|
16979
|
-
|
16980
|
-
|
16981
|
-
|
16982
|
-
|
16983
|
-
|
16984
|
-
|
16985
|
-
|
16986
|
-
|
16987
|
-
|
16988
|
-
|
16989
|
-
|
16990
|
-
|
16991
|
-
|
16992
|
-
|
16993
|
-
|
16994
|
-
|
16995
|
-
|
16996
|
-
|
16997
|
-
|
16998
|
-
|
16999
|
-
|
17000
|
-
|
17001
|
-
|
17002
|
-
|
17003
|
-
|
17004
|
-
|
17005
|
-
|
17006
|
-
|
17007
|
-
|
17008
|
-
|
17009
|
-
|
17010
|
-
|
17011
|
-
|
17012
|
-
|
17013
|
-
|
17014
|
-
|
17015
|
-
|
17016
|
-
|
17017
|
-
|
17018
|
-
|
17019
|
-
|
17020
|
-
|
17021
|
-
|
17022
|
-
|
17023
|
-
|
17024
|
-
|
17025
|
-
|
17026
|
-
|
17027
|
-
|
17028
|
-
|
17029
|
-
|
17030
|
-
|
17031
|
-
|
17032
|
-
|
17033
|
-
|
17034
|
-
|
17035
|
-
|
17036
|
-
|
17037
|
-
|
17038
|
-
|
17039
|
-
|
17040
|
-
|
17041
|
-
|
17042
|
-
|
17043
|
-
|
17044
|
-
|
17045
|
-
|
17046
|
-
|
17047
|
-
|
17048
|
-
|
17049
|
-
|
17050
|
-
|
17051
|
-
|
17052
|
-
|
17053
|
-
|
17054
|
-
|
17055
|
-
|
17056
|
-
|
17057
|
-
|
17058
|
-
|
17059
|
-
|
17060
|
-
|
17061
|
-
|
17062
|
-
|
17063
|
-
|
17064
|
-
|
17065
|
-
|
17066
|
-
|
17067
|
-
|
17068
|
-
args.push(`--runtime-information-channel-v6=${osConfig.namedPipeName}`);
|
17069
|
-
if (config.runtime.securityRealm) {
|
17070
|
-
args.push(`--security-realm=${config.runtime.securityRealm}`);
|
17071
|
-
}
|
17072
|
-
if (config.runtime.verboseLogging) {
|
17073
|
-
args.push('--v=1');
|
17074
|
-
args.push('--attach-console');
|
17075
|
-
}
|
17076
|
-
if (typeof config.services !== 'undefined' && config.services !== null) {
|
17077
|
-
await (0, services_1.startServices)(config.services);
|
17078
|
-
}
|
17079
|
-
return (0, child_process_1.spawn)(runtimePath, args);
|
17080
|
-
}
|
17081
|
-
catch (e) {
|
17082
|
-
console.error('Failed to launch\n', e);
|
17083
|
-
throw e;
|
17084
|
-
}
|
17085
|
-
}
|
17086
|
-
nixLaunch.launch = launch;
|
17087
|
-
return nixLaunch;
|
16951
|
+
nixLaunch.getUrl = getUrl;
|
16952
|
+
async function download(version, folder, osConfig) {
|
16953
|
+
const url = getUrl(version, osConfig.urlPath);
|
16954
|
+
const tmp = 'tmp';
|
16955
|
+
await (0, util_1$1.rmDir)(folder, false);
|
16956
|
+
await mkdir(path$3.join(folder, tmp)).catch(() => {
|
16957
|
+
// empty block
|
16958
|
+
});
|
16959
|
+
const file = path$3.join(folder, tmp, 'tmp');
|
16960
|
+
await (0, http_1$1.downloadFile)(url, file);
|
16961
|
+
await (0, util_1$1.unzip)(file, folder);
|
16962
|
+
await (0, util_1$1.rmDir)(path$3.join(folder, tmp), true);
|
16963
|
+
return folder;
|
16964
|
+
}
|
16965
|
+
nixLaunch.download = download;
|
16966
|
+
async function getRuntimePath(version) {
|
16967
|
+
if (process.env.runtimeDirectory) {
|
16968
|
+
return (0, util_1$1.resolveDir)(process.env.runtimeDirectory, ['Runtime', version]);
|
16969
|
+
}
|
16970
|
+
const versionPath = ['OpenFin', 'Runtime', version];
|
16971
|
+
const { HOME } = process.env;
|
16972
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
16973
|
+
return (0, util_1$1.resolveDir)(HOME, versionPath);
|
16974
|
+
}
|
16975
|
+
nixLaunch.getRuntimePath = getRuntimePath;
|
16976
|
+
async function install(versionOrChannel, osConfig) {
|
16977
|
+
const version = await (0, util_1$1.resolveRuntimeVersion)(versionOrChannel);
|
16978
|
+
const rtFolder = await getRuntimePath(version);
|
16979
|
+
const rtPath = path$3.join(rtFolder, osConfig.executablePath);
|
16980
|
+
const rtExists = await (0, util_1$1.exists)(rtPath);
|
16981
|
+
if (rtExists) {
|
16982
|
+
await (0, promises_1$1.promisify)(fs$2.chmod)(rtPath, 0o755);
|
16983
|
+
}
|
16984
|
+
else {
|
16985
|
+
try {
|
16986
|
+
if (!downloads[version]) {
|
16987
|
+
downloads[version] = download(version, rtFolder, osConfig);
|
16988
|
+
}
|
16989
|
+
await downloads[version];
|
16990
|
+
delete downloads[version];
|
16991
|
+
}
|
16992
|
+
catch (err) {
|
16993
|
+
console.error(`Failed to download, attempting to empty ${rtFolder}`);
|
16994
|
+
await (0, util_1$1.rmDir)(rtFolder, false);
|
16995
|
+
throw Error(`Could not install runtime ${versionOrChannel} (${version})`);
|
16996
|
+
}
|
16997
|
+
}
|
16998
|
+
return rtPath;
|
16999
|
+
}
|
17000
|
+
nixLaunch.install = install;
|
17001
|
+
async function launch$1(config, osConfig) {
|
17002
|
+
try {
|
17003
|
+
let fb = false;
|
17004
|
+
const runtimePath = await install(config.runtime.version, osConfig).catch((e) => {
|
17005
|
+
if (config.runtime.fallbackVersion !== undefined) {
|
17006
|
+
fb = true;
|
17007
|
+
console.warn(`could not install openfin ${config.runtime.version}`);
|
17008
|
+
console.warn(`trying fallback ${config.runtime.fallbackVersion}`);
|
17009
|
+
return install(config.runtime.fallbackVersion, osConfig);
|
17010
|
+
}
|
17011
|
+
return Promise.reject(e);
|
17012
|
+
});
|
17013
|
+
const args = config.runtime.arguments ? config.runtime.arguments.split(' ') : [];
|
17014
|
+
if (process.env.runtimeArgs) {
|
17015
|
+
args.push(process.env.runtimeArgs.split(' '));
|
17016
|
+
}
|
17017
|
+
args.unshift(`--startup-url=${osConfig.manifestLocation}`);
|
17018
|
+
args.push(`--version-keyword=${fb ? config.runtime.fallbackVersion : config.runtime.version}`);
|
17019
|
+
args.push(`--runtime-information-channel-v6=${osConfig.namedPipeName}`);
|
17020
|
+
if (config.runtime.securityRealm) {
|
17021
|
+
args.push(`--security-realm=${config.runtime.securityRealm}`);
|
17022
|
+
}
|
17023
|
+
if (config.runtime.verboseLogging) {
|
17024
|
+
args.push('--v=1');
|
17025
|
+
args.push('--attach-console');
|
17026
|
+
}
|
17027
|
+
warnIfServicesProvided(config);
|
17028
|
+
return (0, child_process_1$1.spawn)(runtimePath, args);
|
17029
|
+
}
|
17030
|
+
catch (e) {
|
17031
|
+
console.error('Failed to launch\n', e);
|
17032
|
+
throw e;
|
17033
|
+
}
|
17034
|
+
}
|
17035
|
+
nixLaunch.launch = launch$1;
|
17036
|
+
function warnIfServicesProvided(config) {
|
17037
|
+
if (typeof config.services !== 'undefined' && config.services !== null) {
|
17038
|
+
console.warn('services are deprecated and will be ignored');
|
17039
|
+
}
|
17088
17040
|
}
|
17089
17041
|
|
17090
17042
|
var rvmLaunch = {};
|
@@ -17092,16 +17044,16 @@ var rvmLaunch = {};
|
|
17092
17044
|
Object.defineProperty(rvmLaunch, "__esModule", { value: true });
|
17093
17045
|
rvmLaunch.launch = void 0;
|
17094
17046
|
const child_process_1 = require$$2;
|
17095
|
-
const os = require$$1$1;
|
17096
|
-
const path = require$$1;
|
17047
|
+
const os$2 = require$$1$1;
|
17048
|
+
const path$2 = require$$1;
|
17097
17049
|
const util_1 = util;
|
17098
17050
|
const getRvmPath = () => {
|
17099
17051
|
switch (process.platform) {
|
17100
17052
|
case 'darwin':
|
17101
|
-
return path.resolve(os.homedir(), 'Applications', 'OpenFinRVM.app', 'Contents', 'MacOS', 'OpenFinRVM');
|
17053
|
+
return path$2.resolve(os$2.homedir(), 'Applications', 'OpenFinRVM.app', 'Contents', 'MacOS', 'OpenFinRVM');
|
17102
17054
|
case 'win32':
|
17103
17055
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
17104
|
-
return path.resolve(process.env.LOCALAPPDATA, 'OpenFin', 'OpenFinRVM.exe');
|
17056
|
+
return path$2.resolve(process.env.LOCALAPPDATA, 'OpenFin', 'OpenFinRVM.exe');
|
17105
17057
|
default:
|
17106
17058
|
throw new Error(`Unsupported platform: ${process.platform}`);
|
17107
17059
|
}
|
@@ -17109,9 +17061,9 @@ const getRvmPath = () => {
|
|
17109
17061
|
const getRvmLocalPath = () => {
|
17110
17062
|
switch (process.platform) {
|
17111
17063
|
case 'darwin':
|
17112
|
-
return path.resolve(__dirname, '..', 'resources', 'darwin', 'OpenFinRVM.app', 'Contents', 'MacOS', 'OpenFinRVM');
|
17064
|
+
return path$2.resolve(__dirname, '..', 'resources', 'darwin', 'OpenFinRVM.app', 'Contents', 'MacOS', 'OpenFinRVM');
|
17113
17065
|
case 'win32':
|
17114
|
-
return path.resolve(__dirname, '..', 'resources', 'win', 'OpenFinRVM.exe');
|
17066
|
+
return path$2.resolve(__dirname, '..', 'resources', 'win', 'OpenFinRVM.exe');
|
17115
17067
|
default:
|
17116
17068
|
throw new Error(`Unsupported platform: ${process.platform}`);
|
17117
17069
|
}
|
@@ -17160,51 +17112,44 @@ function makeQueued(func) {
|
|
17160
17112
|
};
|
17161
17113
|
}
|
17162
17114
|
|
17163
|
-
|
17164
|
-
|
17165
|
-
|
17166
|
-
|
17167
|
-
|
17168
|
-
|
17169
|
-
|
17170
|
-
|
17171
|
-
|
17172
|
-
|
17173
|
-
|
17174
|
-
|
17175
|
-
|
17176
|
-
|
17177
|
-
|
17178
|
-
|
17179
|
-
|
17180
|
-
|
17181
|
-
|
17182
|
-
|
17183
|
-
|
17184
|
-
|
17185
|
-
|
17186
|
-
|
17187
|
-
|
17188
|
-
|
17189
|
-
|
17190
|
-
|
17191
|
-
|
17192
|
-
|
17193
|
-
|
17194
|
-
|
17195
|
-
|
17196
|
-
|
17197
|
-
|
17198
|
-
|
17199
|
-
}
|
17200
|
-
static RVM_SUPPORTED() {
|
17201
|
-
const platform = os.platform();
|
17202
|
-
return ['win32', 'darwin'].includes(platform);
|
17203
|
-
}
|
17204
|
-
}
|
17205
|
-
launcher.default = Launcher;
|
17206
|
-
return launcher;
|
17115
|
+
Object.defineProperty(launcher$1, "__esModule", { value: true });
|
17116
|
+
const os$1 = require$$1$1;
|
17117
|
+
const path$1 = require$$1;
|
17118
|
+
const nix_launch_1 = nixLaunch;
|
17119
|
+
const rvm_launch_1 = rvmLaunch;
|
17120
|
+
class Launcher {
|
17121
|
+
constructor() {
|
17122
|
+
this.Installer_Work_Dir = path$1.join(os$1.tmpdir(), 'openfinnode');
|
17123
|
+
this.Security_Realm_Config_Key = '--security-realm=';
|
17124
|
+
if (!Launcher.IS_SUPPORTED()) {
|
17125
|
+
throw new Error(`Launching not supported on ${os$1.platform()}`);
|
17126
|
+
}
|
17127
|
+
}
|
17128
|
+
async launch(config, manifestLocation, namedPipeName) {
|
17129
|
+
if (Launcher.RVM_SUPPORTED()) {
|
17130
|
+
return (0, rvm_launch_1.launch)(config, manifestLocation, namedPipeName);
|
17131
|
+
}
|
17132
|
+
if (os$1.platform() === 'linux') {
|
17133
|
+
const osConfig = {
|
17134
|
+
manifestLocation,
|
17135
|
+
namedPipeName,
|
17136
|
+
urlPath: `linux/${os$1.arch()}`,
|
17137
|
+
executablePath: 'openfin'
|
17138
|
+
};
|
17139
|
+
return (0, nix_launch_1.launch)(config, osConfig);
|
17140
|
+
}
|
17141
|
+
throw new Error(`Launching not supported on ${os$1.platform()}`);
|
17142
|
+
}
|
17143
|
+
static IS_SUPPORTED() {
|
17144
|
+
const platform = os$1.platform();
|
17145
|
+
return ['win32', 'darwin', 'linux'].includes(platform);
|
17146
|
+
}
|
17147
|
+
static RVM_SUPPORTED() {
|
17148
|
+
const platform = os$1.platform();
|
17149
|
+
return ['win32', 'darwin'].includes(platform);
|
17150
|
+
}
|
17207
17151
|
}
|
17152
|
+
launcher$1.default = Launcher;
|
17208
17153
|
|
17209
17154
|
var bufferReader = {};
|
17210
17155
|
|
@@ -17238,260 +17183,253 @@ class BufferReader {
|
|
17238
17183
|
}
|
17239
17184
|
bufferReader.BufferReader = BufferReader;
|
17240
17185
|
|
17241
|
-
|
17242
|
-
|
17243
|
-
|
17244
|
-
|
17245
|
-
|
17246
|
-
|
17247
|
-
|
17248
|
-
|
17249
|
-
|
17250
|
-
|
17251
|
-
|
17252
|
-
|
17253
|
-
|
17254
|
-
|
17255
|
-
|
17256
|
-
|
17257
|
-
|
17258
|
-
|
17259
|
-
|
17260
|
-
|
17261
|
-
|
17262
|
-
|
17263
|
-
|
17264
|
-
|
17265
|
-
|
17266
|
-
|
17267
|
-
|
17268
|
-
|
17269
|
-
|
17270
|
-
|
17271
|
-
|
17272
|
-
|
17273
|
-
|
17274
|
-
|
17275
|
-
|
17276
|
-
|
17277
|
-
|
17278
|
-
|
17279
|
-
|
17280
|
-
|
17281
|
-
|
17282
|
-
|
17283
|
-
|
17284
|
-
|
17285
|
-
|
17286
|
-
|
17287
|
-
|
17288
|
-
|
17289
|
-
|
17290
|
-
|
17291
|
-
|
17292
|
-
|
17293
|
-
|
17294
|
-
|
17295
|
-
|
17296
|
-
|
17297
|
-
|
17298
|
-
|
17299
|
-
|
17300
|
-
|
17301
|
-
|
17302
|
-
|
17303
|
-
|
17304
|
-
config.customItems.forEach((value) => {
|
17305
|
-
Object.assign(manifest, value);
|
17306
|
-
});
|
17307
|
-
}
|
17308
|
-
return manifest;
|
17309
|
-
}
|
17310
|
-
function onRuntimeHello(data, conn) {
|
17311
|
-
const reader = new buffer_reader_1.BufferReader(data);
|
17312
|
-
const header = readHeader(reader);
|
17313
|
-
if (header.message_type === ChromiumMessageType.RUNTIME_HELLO_MESSAGE) {
|
17314
|
-
conn.write(data);
|
17315
|
-
}
|
17316
|
-
else {
|
17317
|
-
console.error(`[port-discovery] Invalid port discovery hello message type ${header.message_type}`);
|
17318
|
-
}
|
17319
|
-
}
|
17320
|
-
function onDiscoverMessage(data) {
|
17321
|
-
const reader = new buffer_reader_1.BufferReader(data);
|
17322
|
-
const header = readHeader(reader);
|
17323
|
-
if (header.message_type === ChromiumMessageType.RUNTIME_STRING_MESSAGE) {
|
17324
|
-
const messageLength = reader.readInt32();
|
17325
|
-
const msg = reader.readString(messageLength);
|
17326
|
-
try {
|
17327
|
-
const env = JSON.parse(msg);
|
17328
|
-
if (env?.payload) {
|
17329
|
-
return env.payload;
|
17330
|
-
}
|
17331
|
-
console.warn(`[port-discovery] Discovery message did not have payload`, {
|
17332
|
-
header,
|
17333
|
-
msg,
|
17334
|
-
messageLength
|
17335
|
-
});
|
17336
|
-
}
|
17337
|
-
catch (e) {
|
17338
|
-
console.error(`[port-discovery] Error parsing discovery message: ${e.message}`, {
|
17339
|
-
header,
|
17340
|
-
msg,
|
17341
|
-
messageLength
|
17342
|
-
});
|
17343
|
-
}
|
17344
|
-
}
|
17345
|
-
else {
|
17346
|
-
console.error(`[port-discovery] Invalid port discovery message type ${header.message_type}`);
|
17347
|
-
}
|
17348
|
-
return undefined;
|
17349
|
-
}
|
17350
|
-
function readHeader(reader) {
|
17351
|
-
const header = {};
|
17352
|
-
header.payload_size = reader.readInt32();
|
17353
|
-
header.routing_id = reader.readInt32();
|
17354
|
-
header.message_type = reader.readInt32();
|
17355
|
-
header.flags = reader.readInt32();
|
17356
|
-
header.attachment_count = reader.readInt32();
|
17357
|
-
header.os = os.platform();
|
17358
|
-
if (header.os !== 'win32') {
|
17359
|
-
header.num_fds = reader.readInt16();
|
17360
|
-
header.pad = reader.readInt16();
|
17361
|
-
}
|
17362
|
-
return header;
|
17363
|
-
}
|
17364
|
-
class PortDiscovery {
|
17365
|
-
constructor(config, environment) {
|
17366
|
-
this.savedConfig = { ...config };
|
17367
|
-
this.environment = environment;
|
17368
|
-
}
|
17369
|
-
async retrievePort() {
|
17370
|
-
try {
|
17371
|
-
await this.createManifest();
|
17372
|
-
await this.createDiscoveryNamedPipe();
|
17373
|
-
const mPromise = this.listenDiscoveryMessage();
|
17374
|
-
const msg = await Promise.race([
|
17375
|
-
(async () => {
|
17376
|
-
const openfin = await launcher.launch(this.savedConfig, this.manifestLocation, this.namedPipeName);
|
17377
|
-
openfin.on('error', (err) => {
|
17378
|
-
throw err;
|
17379
|
-
});
|
17380
|
-
if (this.savedConfig.runtime.verboseLogging && openfin.stdout && openfin.stderr) {
|
17381
|
-
openfin.stdout.pipe(process.stdout);
|
17382
|
-
openfin.stderr.pipe(process.stderr);
|
17383
|
-
}
|
17384
|
-
this.timeoutTimer = (0, timers_1.setTimeout)(() => {
|
17385
|
-
// provide a log to aid in debugging in case of a hanging promise
|
17386
|
-
console.warn('Port Discovery is taking a while. Either the runtime is downloading or it failed to retrieve the port.');
|
17387
|
-
}, 30 * 1000);
|
17388
|
-
return mPromise;
|
17389
|
-
})(),
|
17390
|
-
mPromise
|
17391
|
-
]);
|
17392
|
-
this.cleanup();
|
17393
|
-
return msg.port;
|
17394
|
-
}
|
17395
|
-
catch (reason) {
|
17396
|
-
this.cleanup();
|
17397
|
-
throw reason;
|
17398
|
-
}
|
17399
|
-
}
|
17400
|
-
createDiscoveryNamedPipe() {
|
17401
|
-
return new Promise((resolve, reject) => {
|
17402
|
-
let unix = false;
|
17403
|
-
const randomNum = this.environment.getRandomId();
|
17404
|
-
this.namedPipeName = `NodeAdapter.${randomNum}`;
|
17405
|
-
this.namedPipeServer = net.createServer();
|
17406
|
-
const pipePath = os.platform() === 'win32'
|
17407
|
-
? path.join('\\\\.\\pipe\\', `chrome.${this.namedPipeName}`)
|
17408
|
-
: path.join(os.tmpdir(), `${this.namedPipeName}.sock`);
|
17409
|
-
if (os.platform() !== 'win32') {
|
17410
|
-
unix = true;
|
17411
|
-
this.namedPipeName = pipePath;
|
17412
|
-
}
|
17413
|
-
this.namedPipeServer.listen(pipePath, () => {
|
17414
|
-
if (unix) {
|
17415
|
-
const address = this.namedPipeServer.address();
|
17416
|
-
this.namedPipeName = address;
|
17417
|
-
fs.chmodSync(pipePath, 0o777);
|
17418
|
-
}
|
17419
|
-
resolve();
|
17420
|
-
});
|
17421
|
-
});
|
17422
|
-
}
|
17423
|
-
listenDiscoveryMessage() {
|
17424
|
-
return new Promise((resolve, reject) => {
|
17425
|
-
this.namedPipeServer.on('connection', (conn) => {
|
17426
|
-
let discoverState = DiscoverState.INIT;
|
17427
|
-
conn.on('data', (data) => {
|
17428
|
-
if (discoverState === DiscoverState.INIT) {
|
17429
|
-
onRuntimeHello(data, conn);
|
17430
|
-
discoverState = DiscoverState.HELLO;
|
17431
|
-
}
|
17432
|
-
else if (discoverState === DiscoverState.HELLO) {
|
17433
|
-
const msg = onDiscoverMessage(data);
|
17434
|
-
if (msg && matchRuntimeInstance(this.savedConfig, msg)) {
|
17435
|
-
resolve(msg);
|
17436
|
-
}
|
17437
|
-
else {
|
17438
|
-
console.warn('Received Port Discovery message from unexpected runtime');
|
17439
|
-
}
|
17440
|
-
}
|
17441
|
-
});
|
17442
|
-
});
|
17443
|
-
this.namedPipeServer.on('error', (err) => {
|
17444
|
-
reject(err);
|
17445
|
-
});
|
17446
|
-
});
|
17447
|
-
}
|
17448
|
-
createManifest() {
|
17449
|
-
return new Promise((resolve, reject) => {
|
17450
|
-
if ((0, wire_1.isExternalConfig)(this.savedConfig)) {
|
17451
|
-
this.manifestLocation = this.savedConfig.manifestUrl;
|
17452
|
-
resolve();
|
17453
|
-
}
|
17454
|
-
else {
|
17455
|
-
const manifestFileName = `NodeAdapter-${this.savedConfig.uuid.replace(/ /g, '-')}.json`;
|
17456
|
-
try {
|
17457
|
-
fs.mkdirSync(launcher.Installer_Work_Dir);
|
17458
|
-
}
|
17459
|
-
catch (e) {
|
17460
|
-
if (!e.message.includes('file already exists')) {
|
17461
|
-
reject(new Error(`Error creating work directory ${e.message}`));
|
17462
|
-
return;
|
17463
|
-
}
|
17464
|
-
}
|
17465
|
-
this.manifestLocation = path.join(launcher.Installer_Work_Dir, manifestFileName);
|
17466
|
-
const wr = fs.createWriteStream(this.manifestLocation);
|
17467
|
-
const manifest = generateManifest(this.savedConfig);
|
17468
|
-
wr.on('error', (err) => {
|
17469
|
-
reject(err);
|
17470
|
-
});
|
17471
|
-
wr.on('finish', () => {
|
17472
|
-
resolve();
|
17473
|
-
});
|
17474
|
-
wr.write(JSON.stringify(manifest), () => {
|
17475
|
-
wr.end();
|
17476
|
-
});
|
17477
|
-
}
|
17478
|
-
});
|
17479
|
-
}
|
17480
|
-
cleanup() {
|
17481
|
-
if (this.namedPipeServer) {
|
17482
|
-
if (this.pipeConnection) {
|
17483
|
-
this.pipeConnection.end();
|
17484
|
-
}
|
17485
|
-
this.namedPipeServer.close();
|
17486
|
-
}
|
17487
|
-
if (this.timeoutTimer) {
|
17488
|
-
clearTimeout(this.timeoutTimer);
|
17489
|
-
}
|
17490
|
-
}
|
17491
|
-
}
|
17492
|
-
portDiscovery.default = PortDiscovery;
|
17493
|
-
return portDiscovery;
|
17186
|
+
Object.defineProperty(portDiscovery, "__esModule", { value: true });
|
17187
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
17188
|
+
const fs$1 = require$$0$2;
|
17189
|
+
const net = require$$1$2;
|
17190
|
+
const os = require$$1$1;
|
17191
|
+
const path = require$$1;
|
17192
|
+
const timers_1 = require$$4;
|
17193
|
+
const launcher_1 = launcher$1;
|
17194
|
+
const buffer_reader_1 = bufferReader;
|
17195
|
+
const wire_1$2 = wire;
|
17196
|
+
const launcher = new launcher_1.default();
|
17197
|
+
// value for message_type
|
17198
|
+
var ChromiumMessageType;
|
17199
|
+
(function (ChromiumMessageType) {
|
17200
|
+
ChromiumMessageType[ChromiumMessageType["RUNTIME_HELLO_MESSAGE"] = 65535] = "RUNTIME_HELLO_MESSAGE";
|
17201
|
+
ChromiumMessageType[ChromiumMessageType["RUNTIME_STRING_MESSAGE"] = 0] = "RUNTIME_STRING_MESSAGE";
|
17202
|
+
})(ChromiumMessageType || (ChromiumMessageType = {}));
|
17203
|
+
var DiscoverState;
|
17204
|
+
(function (DiscoverState) {
|
17205
|
+
DiscoverState[DiscoverState["INIT"] = 0] = "INIT";
|
17206
|
+
DiscoverState[DiscoverState["HELLO"] = 1] = "HELLO";
|
17207
|
+
DiscoverState[DiscoverState["PORT_MESSAGE"] = 2] = "PORT_MESSAGE";
|
17208
|
+
})(DiscoverState || (DiscoverState = {}));
|
17209
|
+
function matchRuntimeInstance(config, message) {
|
17210
|
+
const args = config.runtime.arguments || '';
|
17211
|
+
const realm = config.runtime.securityRealm || (args.split('--security-realm=')[1] || '').split(' ')[0];
|
17212
|
+
if (config.runtime.version && realm) {
|
17213
|
+
return config.runtime.version === message.requestedVersion && realm === message.securityRealm;
|
17214
|
+
}
|
17215
|
+
if (config.runtime.version) {
|
17216
|
+
return config.runtime.version === message.requestedVersion && !message.securityRealm;
|
17217
|
+
}
|
17218
|
+
return false;
|
17219
|
+
}
|
17220
|
+
function generateManifest(config) {
|
17221
|
+
const manifest = {
|
17222
|
+
devtools_port: config.devToolsPort,
|
17223
|
+
startup_app: config.startupApp,
|
17224
|
+
lrsUrl: config.lrsUrl,
|
17225
|
+
assetsUrl: config.assetsUrl,
|
17226
|
+
licenseKey: config.licenseKey,
|
17227
|
+
appAssets: config.appAssets
|
17228
|
+
};
|
17229
|
+
if (config.runtime) {
|
17230
|
+
let runtimeArgs = '';
|
17231
|
+
manifest.runtime = { version: config.runtime.version, fallbackVersion: config.runtime.fallbackVersion };
|
17232
|
+
if (config.runtime.securityRealm) {
|
17233
|
+
runtimeArgs = runtimeArgs.concat(`${launcher.Security_Realm_Config_Key}${config.runtime.securityRealm} `);
|
17234
|
+
}
|
17235
|
+
if (config.runtime.verboseLogging === true) {
|
17236
|
+
runtimeArgs = runtimeArgs.concat('--v=1 --attach-console ');
|
17237
|
+
}
|
17238
|
+
if (config.runtime.arguments) {
|
17239
|
+
runtimeArgs = runtimeArgs.concat(`${config.runtime.arguments}`);
|
17240
|
+
}
|
17241
|
+
manifest.runtime.arguments = runtimeArgs;
|
17242
|
+
}
|
17243
|
+
if (config.customItems) {
|
17244
|
+
config.customItems.forEach((value) => {
|
17245
|
+
Object.assign(manifest, value);
|
17246
|
+
});
|
17247
|
+
}
|
17248
|
+
return manifest;
|
17494
17249
|
}
|
17250
|
+
function onRuntimeHello(data, conn) {
|
17251
|
+
const reader = new buffer_reader_1.BufferReader(data);
|
17252
|
+
const header = readHeader(reader);
|
17253
|
+
if (header.message_type === ChromiumMessageType.RUNTIME_HELLO_MESSAGE) {
|
17254
|
+
conn.write(data);
|
17255
|
+
}
|
17256
|
+
else {
|
17257
|
+
console.error(`[port-discovery] Invalid port discovery hello message type ${header.message_type}`);
|
17258
|
+
}
|
17259
|
+
}
|
17260
|
+
function onDiscoverMessage(data) {
|
17261
|
+
const reader = new buffer_reader_1.BufferReader(data);
|
17262
|
+
const header = readHeader(reader);
|
17263
|
+
if (header.message_type === ChromiumMessageType.RUNTIME_STRING_MESSAGE) {
|
17264
|
+
const messageLength = reader.readInt32();
|
17265
|
+
const msg = reader.readString(messageLength);
|
17266
|
+
try {
|
17267
|
+
const env = JSON.parse(msg);
|
17268
|
+
if (env?.payload) {
|
17269
|
+
return env.payload;
|
17270
|
+
}
|
17271
|
+
console.warn(`[port-discovery] Discovery message did not have payload`, {
|
17272
|
+
header,
|
17273
|
+
msg,
|
17274
|
+
messageLength
|
17275
|
+
});
|
17276
|
+
}
|
17277
|
+
catch (e) {
|
17278
|
+
console.error(`[port-discovery] Error parsing discovery message: ${e.message}`, {
|
17279
|
+
header,
|
17280
|
+
msg,
|
17281
|
+
messageLength
|
17282
|
+
});
|
17283
|
+
}
|
17284
|
+
}
|
17285
|
+
else {
|
17286
|
+
console.error(`[port-discovery] Invalid port discovery message type ${header.message_type}`);
|
17287
|
+
}
|
17288
|
+
return undefined;
|
17289
|
+
}
|
17290
|
+
function readHeader(reader) {
|
17291
|
+
const header = {};
|
17292
|
+
header.payload_size = reader.readInt32();
|
17293
|
+
header.routing_id = reader.readInt32();
|
17294
|
+
header.message_type = reader.readInt32();
|
17295
|
+
header.flags = reader.readInt32();
|
17296
|
+
header.attachment_count = reader.readInt32();
|
17297
|
+
header.os = os.platform();
|
17298
|
+
if (header.os !== 'win32') {
|
17299
|
+
header.num_fds = reader.readInt16();
|
17300
|
+
header.pad = reader.readInt16();
|
17301
|
+
}
|
17302
|
+
return header;
|
17303
|
+
}
|
17304
|
+
class PortDiscovery {
|
17305
|
+
constructor(config, environment) {
|
17306
|
+
this.savedConfig = { ...config };
|
17307
|
+
this.environment = environment;
|
17308
|
+
}
|
17309
|
+
async retrievePort() {
|
17310
|
+
try {
|
17311
|
+
await this.createManifest();
|
17312
|
+
await this.createDiscoveryNamedPipe();
|
17313
|
+
const mPromise = this.listenDiscoveryMessage();
|
17314
|
+
const msg = await Promise.race([
|
17315
|
+
(async () => {
|
17316
|
+
const openfin = await launcher.launch(this.savedConfig, this.manifestLocation, this.namedPipeName);
|
17317
|
+
openfin.on('error', (err) => {
|
17318
|
+
throw err;
|
17319
|
+
});
|
17320
|
+
if (this.savedConfig.runtime.verboseLogging && openfin.stdout && openfin.stderr) {
|
17321
|
+
openfin.stdout.pipe(process.stdout);
|
17322
|
+
openfin.stderr.pipe(process.stderr);
|
17323
|
+
}
|
17324
|
+
this.timeoutTimer = (0, timers_1.setTimeout)(() => {
|
17325
|
+
// provide a log to aid in debugging in case of a hanging promise
|
17326
|
+
console.warn('Port Discovery is taking a while. Either the runtime is downloading or it failed to retrieve the port.');
|
17327
|
+
}, 30 * 1000);
|
17328
|
+
return mPromise;
|
17329
|
+
})(),
|
17330
|
+
mPromise
|
17331
|
+
]);
|
17332
|
+
this.cleanup();
|
17333
|
+
return msg.port;
|
17334
|
+
}
|
17335
|
+
catch (reason) {
|
17336
|
+
this.cleanup();
|
17337
|
+
throw reason;
|
17338
|
+
}
|
17339
|
+
}
|
17340
|
+
createDiscoveryNamedPipe() {
|
17341
|
+
return new Promise((resolve, reject) => {
|
17342
|
+
let unix = false;
|
17343
|
+
const randomNum = this.environment.getRandomId();
|
17344
|
+
this.namedPipeName = `NodeAdapter.${randomNum}`;
|
17345
|
+
this.namedPipeServer = net.createServer();
|
17346
|
+
const pipePath = os.platform() === 'win32'
|
17347
|
+
? path.join('\\\\.\\pipe\\', `chrome.${this.namedPipeName}`)
|
17348
|
+
: path.join(os.tmpdir(), `${this.namedPipeName}.sock`);
|
17349
|
+
if (os.platform() !== 'win32') {
|
17350
|
+
unix = true;
|
17351
|
+
this.namedPipeName = pipePath;
|
17352
|
+
}
|
17353
|
+
this.namedPipeServer.listen(pipePath, () => {
|
17354
|
+
if (unix) {
|
17355
|
+
const address = this.namedPipeServer.address();
|
17356
|
+
this.namedPipeName = address;
|
17357
|
+
fs$1.chmodSync(pipePath, 0o777);
|
17358
|
+
}
|
17359
|
+
resolve();
|
17360
|
+
});
|
17361
|
+
});
|
17362
|
+
}
|
17363
|
+
listenDiscoveryMessage() {
|
17364
|
+
return new Promise((resolve, reject) => {
|
17365
|
+
this.namedPipeServer.on('connection', (conn) => {
|
17366
|
+
let discoverState = DiscoverState.INIT;
|
17367
|
+
conn.on('data', (data) => {
|
17368
|
+
if (discoverState === DiscoverState.INIT) {
|
17369
|
+
onRuntimeHello(data, conn);
|
17370
|
+
discoverState = DiscoverState.HELLO;
|
17371
|
+
}
|
17372
|
+
else if (discoverState === DiscoverState.HELLO) {
|
17373
|
+
const msg = onDiscoverMessage(data);
|
17374
|
+
if (msg && matchRuntimeInstance(this.savedConfig, msg)) {
|
17375
|
+
resolve(msg);
|
17376
|
+
}
|
17377
|
+
else {
|
17378
|
+
console.warn('Received Port Discovery message from unexpected runtime');
|
17379
|
+
}
|
17380
|
+
}
|
17381
|
+
});
|
17382
|
+
});
|
17383
|
+
this.namedPipeServer.on('error', (err) => {
|
17384
|
+
reject(err);
|
17385
|
+
});
|
17386
|
+
});
|
17387
|
+
}
|
17388
|
+
createManifest() {
|
17389
|
+
return new Promise((resolve, reject) => {
|
17390
|
+
if ((0, wire_1$2.isExternalConfig)(this.savedConfig)) {
|
17391
|
+
this.manifestLocation = this.savedConfig.manifestUrl;
|
17392
|
+
resolve();
|
17393
|
+
}
|
17394
|
+
else {
|
17395
|
+
const manifestFileName = `NodeAdapter-${this.savedConfig.uuid.replace(/ /g, '-')}.json`;
|
17396
|
+
try {
|
17397
|
+
fs$1.mkdirSync(launcher.Installer_Work_Dir);
|
17398
|
+
}
|
17399
|
+
catch (e) {
|
17400
|
+
if (!e.message.includes('file already exists')) {
|
17401
|
+
reject(new Error(`Error creating work directory ${e.message}`));
|
17402
|
+
return;
|
17403
|
+
}
|
17404
|
+
}
|
17405
|
+
this.manifestLocation = path.join(launcher.Installer_Work_Dir, manifestFileName);
|
17406
|
+
const wr = fs$1.createWriteStream(this.manifestLocation);
|
17407
|
+
const manifest = generateManifest(this.savedConfig);
|
17408
|
+
wr.on('error', (err) => {
|
17409
|
+
reject(err);
|
17410
|
+
});
|
17411
|
+
wr.on('finish', () => {
|
17412
|
+
resolve();
|
17413
|
+
});
|
17414
|
+
wr.write(JSON.stringify(manifest), () => {
|
17415
|
+
wr.end();
|
17416
|
+
});
|
17417
|
+
}
|
17418
|
+
});
|
17419
|
+
}
|
17420
|
+
cleanup() {
|
17421
|
+
if (this.namedPipeServer) {
|
17422
|
+
if (this.pipeConnection) {
|
17423
|
+
this.pipeConnection.end();
|
17424
|
+
}
|
17425
|
+
this.namedPipeServer.close();
|
17426
|
+
}
|
17427
|
+
if (this.timeoutTimer) {
|
17428
|
+
clearTimeout(this.timeoutTimer);
|
17429
|
+
}
|
17430
|
+
}
|
17431
|
+
}
|
17432
|
+
portDiscovery.default = PortDiscovery;
|
17495
17433
|
|
17496
17434
|
var baseEnv = {};
|
17497
17435
|
|
@@ -17517,107 +17455,100 @@ class BaseEnvironment {
|
|
17517
17455
|
}
|
17518
17456
|
baseEnv.BaseEnvironment = BaseEnvironment;
|
17519
17457
|
|
17520
|
-
|
17521
|
-
|
17522
|
-
|
17523
|
-
|
17524
|
-
|
17525
|
-
|
17526
|
-
|
17527
|
-
|
17528
|
-
|
17529
|
-
|
17530
|
-
|
17531
|
-
|
17532
|
-
|
17533
|
-
|
17534
|
-
|
17535
|
-
|
17536
|
-
|
17537
|
-
|
17538
|
-
|
17539
|
-
|
17540
|
-
|
17541
|
-
|
17542
|
-
|
17543
|
-
|
17544
|
-
|
17545
|
-
|
17546
|
-
|
17547
|
-
|
17548
|
-
|
17549
|
-
|
17550
|
-
|
17551
|
-
|
17552
|
-
|
17553
|
-
|
17554
|
-
|
17555
|
-
|
17556
|
-
|
17557
|
-
|
17558
|
-
|
17559
|
-
|
17560
|
-
|
17561
|
-
|
17562
|
-
|
17563
|
-
|
17564
|
-
|
17565
|
-
|
17566
|
-
|
17567
|
-
|
17568
|
-
|
17569
|
-
|
17570
|
-
|
17571
|
-
|
17572
|
-
|
17573
|
-
|
17574
|
-
|
17575
|
-
|
17576
|
-
|
17577
|
-
|
17578
|
-
|
17579
|
-
|
17580
|
-
|
17581
|
-
|
17582
|
-
|
17583
|
-
|
17584
|
-
|
17585
|
-
|
17586
|
-
|
17587
|
-
|
17588
|
-
|
17589
|
-
|
17590
|
-
|
17591
|
-
|
17592
|
-
|
17593
|
-
|
17594
|
-
|
17595
|
-
|
17596
|
-
|
17597
|
-
|
17598
|
-
|
17599
|
-
|
17600
|
-
|
17601
|
-
|
17602
|
-
|
17603
|
-
|
17604
|
-
|
17605
|
-
|
17606
|
-
|
17607
|
-
|
17608
|
-
|
17609
|
-
|
17610
|
-
|
17611
|
-
|
17612
|
-
}
|
17613
|
-
getWsConstructor() {
|
17614
|
-
// @ts-expect-error
|
17615
|
-
return WS;
|
17616
|
-
}
|
17617
|
-
}
|
17618
|
-
nodeEnv.default = NodeEnvironment;
|
17619
|
-
return nodeEnv;
|
17458
|
+
Object.defineProperty(nodeEnv, "__esModule", { value: true });
|
17459
|
+
/* eslint-disable class-methods-use-this */
|
17460
|
+
const fs_1 = require$$0$2;
|
17461
|
+
const crypto_1 = require$$1$3;
|
17462
|
+
const _WS = require$$2$1;
|
17463
|
+
const environment_1 = environment;
|
17464
|
+
const port_discovery_1 = portDiscovery;
|
17465
|
+
const transport_errors_1$2 = transportErrors;
|
17466
|
+
const base_env_1 = baseEnv;
|
17467
|
+
// Due to https://github.com/rollup/rollup/issues/1267, we need this guard
|
17468
|
+
// to ensure the import works with and without the 'esModuleInterop' ts flag.
|
17469
|
+
// This is due to our mocha tests not being compatible with esModuleInterop,
|
17470
|
+
// whereas rollup enforces it.
|
17471
|
+
const WS = _WS.default || _WS;
|
17472
|
+
class NodeEnvironment extends base_env_1.BaseEnvironment {
|
17473
|
+
constructor() {
|
17474
|
+
super(...arguments);
|
17475
|
+
this.type = 'node';
|
17476
|
+
this.messageCounter = 0;
|
17477
|
+
this.childViews = false;
|
17478
|
+
this.writeToken = (path, token) => {
|
17479
|
+
return new Promise((resolve) => {
|
17480
|
+
(0, fs_1.writeFile)(path, token, () => resolve(token));
|
17481
|
+
});
|
17482
|
+
};
|
17483
|
+
this.retrievePort = (config) => {
|
17484
|
+
const pd = new port_discovery_1.default(config, this);
|
17485
|
+
return pd.retrievePort();
|
17486
|
+
};
|
17487
|
+
this.getNextMessageId = () => {
|
17488
|
+
// eslint-disable-next-line no-plusplus
|
17489
|
+
return this.messageCounter++;
|
17490
|
+
};
|
17491
|
+
this.getRandomId = () => {
|
17492
|
+
return (0, crypto_1.randomBytes)(16).toString('hex');
|
17493
|
+
};
|
17494
|
+
this.getWebWindow = (identity) => {
|
17495
|
+
throw new transport_errors_1$2.NotSupportedError('Not supported outside of OpenFin web context');
|
17496
|
+
};
|
17497
|
+
this.getCurrentEntityIdentity = () => {
|
17498
|
+
throw new transport_errors_1$2.NotImplementedError(environment_1.notImplementedEnvErrorMsg);
|
17499
|
+
};
|
17500
|
+
this.getCurrentEntityType = () => {
|
17501
|
+
return 'external connection';
|
17502
|
+
};
|
17503
|
+
this.raiseEvent = (eventName, eventArgs) => {
|
17504
|
+
throw new transport_errors_1$2.NotImplementedError(environment_1.notImplementedEnvErrorMsg);
|
17505
|
+
};
|
17506
|
+
this.getUrl = () => {
|
17507
|
+
throw new transport_errors_1$2.NotImplementedError('Not Implemented');
|
17508
|
+
};
|
17509
|
+
}
|
17510
|
+
observeBounds(element, onChange) {
|
17511
|
+
throw new Error('Method not implemented.');
|
17512
|
+
}
|
17513
|
+
getDefaultChannelOptions() {
|
17514
|
+
return { create: {}, connect: {} };
|
17515
|
+
}
|
17516
|
+
getRtcPeer() {
|
17517
|
+
throw new Error('Method not implemented.');
|
17518
|
+
}
|
17519
|
+
layoutAllowedInContext(_fin) {
|
17520
|
+
throw new Error('Method not implemented.');
|
17521
|
+
}
|
17522
|
+
async initLayoutManager() {
|
17523
|
+
throw new Error('Method not implemented.');
|
17524
|
+
}
|
17525
|
+
async applyLayoutSnapshot() {
|
17526
|
+
throw new Error('Method not implemented.');
|
17527
|
+
}
|
17528
|
+
async createLayout() {
|
17529
|
+
throw new Error('Method not implemented.');
|
17530
|
+
}
|
17531
|
+
async destroyLayout() {
|
17532
|
+
throw new Error('Method not implemented.');
|
17533
|
+
}
|
17534
|
+
async resolveLayout() {
|
17535
|
+
throw new Error('Method not implemented.');
|
17536
|
+
}
|
17537
|
+
async initPlatform() {
|
17538
|
+
throw new Error('Method not implemented.');
|
17539
|
+
}
|
17540
|
+
whenReady() {
|
17541
|
+
return Promise.resolve();
|
17542
|
+
}
|
17543
|
+
createChildContent(options) {
|
17544
|
+
throw new transport_errors_1$2.NotImplementedError('Not Implemented');
|
17545
|
+
}
|
17546
|
+
getWsConstructor() {
|
17547
|
+
// @ts-expect-error
|
17548
|
+
return WS;
|
17549
|
+
}
|
17620
17550
|
}
|
17551
|
+
nodeEnv.default = NodeEnvironment;
|
17621
17552
|
|
17622
17553
|
var transport = {};
|
17623
17554
|
|
@@ -18034,9 +17965,6 @@ async function normalizeConfig(config) {
|
|
18034
17965
|
if (typeof loadedConfig.assetsUrl === 'string') {
|
18035
17966
|
testThisConfig.assetsUrl = loadedConfig.assetsUrl;
|
18036
17967
|
}
|
18037
|
-
if (Array.isArray(loadedConfig.services)) {
|
18038
|
-
testThisConfig.services = loadedConfig.services;
|
18039
|
-
}
|
18040
17968
|
}
|
18041
17969
|
return testThisConfig;
|
18042
17970
|
}
|
@@ -18050,62 +17978,53 @@ async function validateConfig(config) {
|
|
18050
17978
|
}
|
18051
17979
|
normalizeConfig$1.validateConfig = validateConfig;
|
18052
17980
|
|
18053
|
-
|
18054
|
-
|
18055
|
-
|
18056
|
-
|
18057
|
-
|
18058
|
-
|
18059
|
-
|
18060
|
-
|
18061
|
-
|
18062
|
-
|
18063
|
-
|
18064
|
-
|
18065
|
-
|
18066
|
-
|
18067
|
-
|
18068
|
-
|
18069
|
-
|
18070
|
-
|
18071
|
-
|
18072
|
-
|
18073
|
-
|
18074
|
-
|
18075
|
-
|
18076
|
-
|
18077
|
-
|
18078
|
-
|
18079
|
-
|
18080
|
-
|
18081
|
-
|
18082
|
-
|
18083
|
-
|
18084
|
-
|
18085
|
-
|
18086
|
-
|
18087
|
-
|
18088
|
-
|
18089
|
-
|
18090
|
-
|
18091
|
-
|
18092
|
-
|
18093
|
-
|
18094
|
-
|
18095
|
-
|
18096
|
-
|
18097
|
-
|
18098
|
-
|
18099
|
-
|
18100
|
-
const pd = new port_discovery_1.default(normalized, environment);
|
18101
|
-
return pd.retrievePort();
|
18102
|
-
}
|
18103
|
-
exports.launch = launch;
|
18104
|
-
} (main$1));
|
18105
|
-
return main$1;
|
18106
|
-
}
|
18107
|
-
|
18108
|
-
var mainExports = requireMain();
|
17981
|
+
(function (exports) {
|
17982
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17983
|
+
exports.ChannelProvider = exports.ChannelClient = exports.Frame = exports.View = exports.System = exports.Window = exports.Application = exports.Fin = exports.launch = exports.connect = void 0;
|
17984
|
+
const fin_1 = fin$1;
|
17985
|
+
Object.defineProperty(exports, "Fin", { enumerable: true, get: function () { return fin_1.Fin; } });
|
17986
|
+
const index_1 = requireApplication();
|
17987
|
+
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return index_1.Application; } });
|
17988
|
+
const window_1 = requireWindow();
|
17989
|
+
Object.defineProperty(exports, "Window", { enumerable: true, get: function () { return window_1._Window; } });
|
17990
|
+
const view_1 = requireView();
|
17991
|
+
Object.defineProperty(exports, "View", { enumerable: true, get: function () { return view_1.View; } });
|
17992
|
+
const client_1 = client;
|
17993
|
+
Object.defineProperty(exports, "ChannelClient", { enumerable: true, get: function () { return client_1.ChannelClient; } });
|
17994
|
+
const provider_1 = provider;
|
17995
|
+
Object.defineProperty(exports, "ChannelProvider", { enumerable: true, get: function () { return provider_1.ChannelProvider; } });
|
17996
|
+
const frame_1 = frame$1;
|
17997
|
+
Object.defineProperty(exports, "Frame", { enumerable: true, get: function () { return frame_1._Frame; } });
|
17998
|
+
const system_1 = system$1;
|
17999
|
+
Object.defineProperty(exports, "System", { enumerable: true, get: function () { return system_1.System; } });
|
18000
|
+
const wire_1 = wire;
|
18001
|
+
const node_env_1 = nodeEnv;
|
18002
|
+
const transport_1 = transport;
|
18003
|
+
const websocket_1 = websocket;
|
18004
|
+
const port_discovery_1 = portDiscovery;
|
18005
|
+
const normalize_config_1 = normalizeConfig$1;
|
18006
|
+
const environment = new node_env_1.default();
|
18007
|
+
// Connect to an OpenFin Runtime
|
18008
|
+
async function connect(config) {
|
18009
|
+
const normalized = await (0, normalize_config_1.validateConfig)(config);
|
18010
|
+
const wire = new transport_1.Transport(websocket_1.default, environment, {
|
18011
|
+
...normalized,
|
18012
|
+
name: normalized.name ?? normalized.uuid
|
18013
|
+
});
|
18014
|
+
await wire.connect(normalized);
|
18015
|
+
return new fin_1.Fin(wire);
|
18016
|
+
}
|
18017
|
+
exports.connect = connect;
|
18018
|
+
async function launch(config) {
|
18019
|
+
const normalized = await (0, normalize_config_1.normalizeConfig)(config);
|
18020
|
+
if (!(0, wire_1.isPortDiscoveryConfig)(normalized)) {
|
18021
|
+
throw new Error('Invalid Config');
|
18022
|
+
}
|
18023
|
+
const pd = new port_discovery_1.default(normalized, environment);
|
18024
|
+
return pd.retrievePort();
|
18025
|
+
}
|
18026
|
+
exports.launch = launch;
|
18027
|
+
} (main$1));
|
18109
18028
|
|
18110
18029
|
var OpenFin$2 = {};
|
18111
18030
|
|
@@ -18369,6 +18288,6 @@ var OpenFin$1 = /*#__PURE__*/_mergeNamespaces({
|
|
18369
18288
|
default: OpenFin
|
18370
18289
|
}, [OpenFin$2]);
|
18371
18290
|
|
18372
|
-
exports.connect =
|
18291
|
+
exports.connect = main$1.connect;
|
18373
18292
|
exports.default = OpenFin$1;
|
18374
|
-
exports.launch =
|
18293
|
+
exports.launch = main$1.launch;
|