@interopio/fdc3 2.7.1 → 2.7.2
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/changelog.md +2 -0
- package/dist/fdc3.electron.es.js +69 -44
- package/dist/fdc3.electron.umd.js +69 -44
- package/dist/fdc3.es.js +69 -44
- package/dist/fdc3.umd.js +69 -44
- package/package.json +2 -2
package/changelog.md
CHANGED
package/dist/fdc3.electron.es.js
CHANGED
|
@@ -6314,12 +6314,12 @@ class GlueController {
|
|
|
6314
6314
|
interopInstance() {
|
|
6315
6315
|
return this.glue.interop.instance;
|
|
6316
6316
|
}
|
|
6317
|
-
async getApplication(
|
|
6317
|
+
async getApplication(options) {
|
|
6318
6318
|
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6319
6319
|
if (!isAppsAPIAvailable) {
|
|
6320
|
-
return this.glue.appManager.application(name);
|
|
6320
|
+
return this.glue.appManager.application(options.name);
|
|
6321
6321
|
}
|
|
6322
|
-
const app = await this.glue.apps.registry.get(
|
|
6322
|
+
const app = await this.glue.apps.registry.get(options);
|
|
6323
6323
|
return app ?? undefined;
|
|
6324
6324
|
}
|
|
6325
6325
|
async getApplicationInstances(appName) {
|
|
@@ -6338,6 +6338,21 @@ class GlueController {
|
|
|
6338
6338
|
const appInstance = await this.glue.apps.instances.get({ id });
|
|
6339
6339
|
return appInstance ?? undefined;
|
|
6340
6340
|
}
|
|
6341
|
+
async getIoCDAppConfiguration(app) {
|
|
6342
|
+
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6343
|
+
if (!isAppsAPIAvailable) {
|
|
6344
|
+
return app.getConfiguration();
|
|
6345
|
+
}
|
|
6346
|
+
const definition = app.definition;
|
|
6347
|
+
if (definition) {
|
|
6348
|
+
return definition;
|
|
6349
|
+
}
|
|
6350
|
+
const appWithDefinition = await this.glue.apps.registry.get({ name: app.name, includeDefinition: true });
|
|
6351
|
+
if (!appWithDefinition?.definition) {
|
|
6352
|
+
throw new Error(`Application definition for app '${app.name}' could not be found`);
|
|
6353
|
+
}
|
|
6354
|
+
return appWithDefinition.definition;
|
|
6355
|
+
}
|
|
6341
6356
|
async startApplication({ app, context, waitForInstanceReady }) {
|
|
6342
6357
|
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6343
6358
|
if (!isAppsAPIAvailable) {
|
|
@@ -6348,7 +6363,7 @@ class GlueController {
|
|
|
6348
6363
|
if (!waitForInstanceReady) {
|
|
6349
6364
|
return glueInstance;
|
|
6350
6365
|
}
|
|
6351
|
-
await this.glue.apps
|
|
6366
|
+
await this.glue.apps.instances.waitForReady({ id: glueInstance.id });
|
|
6352
6367
|
return glueInstance;
|
|
6353
6368
|
}
|
|
6354
6369
|
async findIntents(intentFilter) {
|
|
@@ -8664,7 +8679,7 @@ class IntentsController {
|
|
|
8664
8679
|
if (!context && !resultType) {
|
|
8665
8680
|
return this.convertGlue42IntentToFDC3Intent(searchedGlueIntent);
|
|
8666
8681
|
}
|
|
8667
|
-
const contextType =
|
|
8682
|
+
const contextType = context?.type === fdc3NothingContextType ? undefined : context?.type;
|
|
8668
8683
|
const filteredIntent = this.getGlueIntentWithFilteredHandlers(searchedGlueIntent, { contextType, resultType });
|
|
8669
8684
|
if (!filteredIntent.handlers.length) {
|
|
8670
8685
|
throw new Error(ResolveError.NoAppsFound);
|
|
@@ -8816,7 +8831,7 @@ class IntentsController {
|
|
|
8816
8831
|
const appName = typeof target === "string" ? target : target.appId;
|
|
8817
8832
|
const instanceId = typeof target === "string" ? undefined : target.instanceId;
|
|
8818
8833
|
this.logger?.info(`[${commandId}] - Checking if application with name ${appName} exists`);
|
|
8819
|
-
const app = await this.glueController.getApplication(appName);
|
|
8834
|
+
const app = await this.glueController.getApplication({ name: appName, includeDefinition: true, includeInstances: true });
|
|
8820
8835
|
const serverInstances = this.serverInstanceAsIntentHandler(intent.name);
|
|
8821
8836
|
if (!app && (typeof target === "string" || !target.instanceId || !serverInstances.length)) {
|
|
8822
8837
|
throw new Error(ResolveError.TargetAppUnavailable);
|
|
@@ -8830,8 +8845,9 @@ class IntentsController {
|
|
|
8830
8845
|
this.logger?.log(`[${commandId}] - returning all handlers for intent ${intent.name} and target: ${JSON.stringify(target)}`);
|
|
8831
8846
|
return { name: intent.name, handlers: validHandlersByApplicationName };
|
|
8832
8847
|
}
|
|
8848
|
+
const appInstances = app?.instances ?? await (this.glueController.getApplicationInstances(appName));
|
|
8833
8849
|
const isValidInstanceOfTheApp = app
|
|
8834
|
-
?
|
|
8850
|
+
? appInstances.find((inst) => inst.id === instanceId)
|
|
8835
8851
|
: serverInstances.find((inst) => inst.instance === instanceId);
|
|
8836
8852
|
if (!isValidInstanceOfTheApp) {
|
|
8837
8853
|
throw new Error(ResolveError.TargetInstanceUnavailable);
|
|
@@ -8900,15 +8916,20 @@ class IntentsController {
|
|
|
8900
8916
|
const { name, handlers } = glueIntent;
|
|
8901
8917
|
const apps = await Promise.all(handlers.map(async (handler) => {
|
|
8902
8918
|
const appName = handler.applicationName;
|
|
8903
|
-
const app = await this.glueController.getApplication(appName);
|
|
8904
|
-
const icons =
|
|
8905
|
-
|
|
8919
|
+
const app = await this.glueController.getApplication({ name: appName, includeDefinition: true });
|
|
8920
|
+
const icons = [app?.icon, ...(app?.userProperties?.icons ?? []), ...(app?.customProperties?.icons ?? [])]
|
|
8921
|
+
.filter((icon) => !!icon)
|
|
8922
|
+
.map((icon) => ({ src: icon }));
|
|
8923
|
+
const images = [...(app?.userProperties?.images ?? []), ...(app?.customProperties?.images ?? [])]
|
|
8924
|
+
.filter((image) => !!image)
|
|
8925
|
+
.map((image) => ({ src: image }));
|
|
8926
|
+
const tooltip = app?.title || app?.userProperties?.tooltip || `${appName} (${handler.type})`;
|
|
8906
8927
|
return {
|
|
8907
8928
|
appId: appName,
|
|
8908
8929
|
instanceId: handler.instanceId,
|
|
8909
8930
|
name: appName,
|
|
8910
8931
|
title: handler.applicationTitle || handler.instanceTitle || appName,
|
|
8911
|
-
tooltip
|
|
8932
|
+
tooltip,
|
|
8912
8933
|
description: handler.applicationDescription,
|
|
8913
8934
|
icons,
|
|
8914
8935
|
images,
|
|
@@ -9030,7 +9051,7 @@ class ApplicationsController {
|
|
|
9030
9051
|
await this.glueController.gluePromise;
|
|
9031
9052
|
this.logger?.log(`[${commandId}] - open() invoked with target ${JSON.stringify(target)} ${context ? `and contextType ${context.type}` : ""}`);
|
|
9032
9053
|
const name = typeof target === "object" ? target.appId : target;
|
|
9033
|
-
const app = await this.glueController.getApplication(name);
|
|
9054
|
+
const app = await this.glueController.getApplication({ name });
|
|
9034
9055
|
if (!app) {
|
|
9035
9056
|
throw new Error(OpenError.AppNotFound);
|
|
9036
9057
|
}
|
|
@@ -9053,12 +9074,12 @@ class ApplicationsController {
|
|
|
9053
9074
|
await this.glueController.gluePromise;
|
|
9054
9075
|
this.logger?.info(`[${commandId}] - findInstances() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
|
|
9055
9076
|
const { appId } = appIdentifier;
|
|
9056
|
-
const app = await this.glueController.getApplication(appId);
|
|
9077
|
+
const app = await this.glueController.getApplication({ name: appId, includeInstances: true, includeDefinition: true });
|
|
9057
9078
|
if (!app) {
|
|
9058
9079
|
throw new Error(ResolveError.NoAppsFound);
|
|
9059
9080
|
}
|
|
9060
|
-
const
|
|
9061
|
-
const fdc3Instances =
|
|
9081
|
+
const appInstances = app.instances ?? await this.glueController.getApplicationInstances(appId);
|
|
9082
|
+
const fdc3Instances = appInstances.map(glueInst => this.parseGlueInstToAppIdentifier(glueInst));
|
|
9062
9083
|
this.logger?.info(`[${commandId}] - ids of opened instances for appIdentifier ${JSON.stringify(appIdentifier)}: ${JSON.stringify(fdc3Instances.map(inst => inst.instanceId))}`);
|
|
9063
9084
|
return fdc3Instances;
|
|
9064
9085
|
}
|
|
@@ -9066,7 +9087,7 @@ class ApplicationsController {
|
|
|
9066
9087
|
await this.glueController.gluePromise;
|
|
9067
9088
|
this.logger?.info(`[${commandId}] - getAppMetadata() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
|
|
9068
9089
|
const { appId, instanceId } = appIdentifier;
|
|
9069
|
-
const app = await this.glueController.getApplication(appId);
|
|
9090
|
+
const app = await this.glueController.getApplication({ name: appId, includeDefinition: true, includeInstances: true });
|
|
9070
9091
|
if (!app) {
|
|
9071
9092
|
throw new Error(OpenError.AppNotFound);
|
|
9072
9093
|
}
|
|
@@ -9100,7 +9121,7 @@ class ApplicationsController {
|
|
|
9100
9121
|
async getCurrentAppMetadata() {
|
|
9101
9122
|
const myInstance = this.glueController.interopInstance();
|
|
9102
9123
|
const myInstanceApplicationName = myInstance.application ?? myInstance.applicationName;
|
|
9103
|
-
const myApp = await this.glueController.getApplication(myInstanceApplicationName);
|
|
9124
|
+
const myApp = await this.glueController.getApplication({ name: myInstanceApplicationName, includeDefinition: true });
|
|
9104
9125
|
if (myApp) {
|
|
9105
9126
|
return { appId: myApp.name, instanceId: myInstance.instance };
|
|
9106
9127
|
}
|
|
@@ -9114,40 +9135,43 @@ class ApplicationsController {
|
|
|
9114
9135
|
};
|
|
9115
9136
|
}
|
|
9116
9137
|
async parseGlueAppToAppMetadata(app, instance) {
|
|
9117
|
-
const
|
|
9138
|
+
const inBrowserNamespace = this.glueController.isRunningInBrowser();
|
|
9139
|
+
const appMetadata = inBrowserNamespace
|
|
9140
|
+
? await this.getBaseGlueAppToAppMetadataInBrowser(app)
|
|
9141
|
+
: await this.getBaseGlueAppToAppMetadataInDesktop(app);
|
|
9118
9142
|
if (!instance) {
|
|
9119
9143
|
return appMetadata;
|
|
9120
9144
|
}
|
|
9121
|
-
|
|
9145
|
+
const instanceData = {
|
|
9146
|
+
instanceId: instance.id,
|
|
9147
|
+
instanceMetadata: this.isApplicationInstance(instance) ? instance.interopInstance : instance.agm
|
|
9148
|
+
};
|
|
9149
|
+
return { ...appMetadata, ...instanceData };
|
|
9122
9150
|
}
|
|
9123
|
-
async
|
|
9124
|
-
const
|
|
9125
|
-
const
|
|
9126
|
-
? app.userProperties
|
|
9127
|
-
: await app.getConfiguration();
|
|
9128
|
-
const icon = inBrowserNamespace
|
|
9129
|
-
? app.icon
|
|
9130
|
-
: (await app.getConfiguration()).icon;
|
|
9131
|
-
const desktopScreenshots = appConfiguration.customProperties?.screenshots ?? appConfiguration.userProperties?.screenshots;
|
|
9132
|
-
const screenshots = inBrowserNamespace
|
|
9133
|
-
? appConfiguration.screenshots
|
|
9134
|
-
: desktopScreenshots;
|
|
9151
|
+
async getBaseGlueAppToAppMetadataInDesktop(app) {
|
|
9152
|
+
const appConfiguration = await this.glueController.getIoCDAppConfiguration(app);
|
|
9153
|
+
const screenshots = appConfiguration.customProperties?.screenshots ?? appConfiguration.userProperties?.screenshots;
|
|
9135
9154
|
return {
|
|
9136
|
-
appId:
|
|
9137
|
-
name:
|
|
9138
|
-
version:
|
|
9155
|
+
appId: appConfiguration.name,
|
|
9156
|
+
name: appConfiguration.name,
|
|
9157
|
+
version: appConfiguration.version,
|
|
9139
9158
|
description: appConfiguration.description,
|
|
9140
|
-
title:
|
|
9141
|
-
icons: icon ? [{ src: icon }] : [],
|
|
9159
|
+
title: appConfiguration.title,
|
|
9160
|
+
icons: appConfiguration.icon ? [{ src: appConfiguration.icon }] : [],
|
|
9142
9161
|
tooltip: appConfiguration.tooltip,
|
|
9143
9162
|
screenshots
|
|
9144
9163
|
};
|
|
9145
9164
|
}
|
|
9146
|
-
|
|
9165
|
+
async getBaseGlueAppToAppMetadataInBrowser(app) {
|
|
9147
9166
|
return {
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9167
|
+
appId: app.name,
|
|
9168
|
+
name: app.name,
|
|
9169
|
+
version: app.version,
|
|
9170
|
+
description: app.userProperties.description,
|
|
9171
|
+
title: app.title,
|
|
9172
|
+
icons: app.icon ? [{ src: app.icon }] : [],
|
|
9173
|
+
tooltip: app.userProperties.tooltip,
|
|
9174
|
+
screenshots: app.userProperties.screenshots
|
|
9151
9175
|
};
|
|
9152
9176
|
}
|
|
9153
9177
|
isApplicationInstance(instance) {
|
|
@@ -9156,7 +9180,7 @@ class ApplicationsController {
|
|
|
9156
9180
|
async openAppWithContext(app, context) {
|
|
9157
9181
|
const guid = nanoid();
|
|
9158
9182
|
const startContext = this.buildStartContext(context, guid);
|
|
9159
|
-
const wrappedPromise = this.createContextListenerWrappedPromise(app);
|
|
9183
|
+
const wrappedPromise = this.createContextListenerWrappedPromise(app.name);
|
|
9160
9184
|
this.appsStateStore.addOpenAppPromise(guid, wrappedPromise);
|
|
9161
9185
|
try {
|
|
9162
9186
|
const glueInst = await this.glueController.startApplication({
|
|
@@ -9190,15 +9214,16 @@ class ApplicationsController {
|
|
|
9190
9214
|
}
|
|
9191
9215
|
};
|
|
9192
9216
|
}
|
|
9193
|
-
createContextListenerWrappedPromise(
|
|
9217
|
+
createContextListenerWrappedPromise(appName) {
|
|
9194
9218
|
let resolve = () => { };
|
|
9195
9219
|
let reject = () => { };
|
|
9220
|
+
const timeoutMessage = `Timeout of ${this.defaultContextListenerInvokedPromiseTimeout}ms hit waiting for application with appId: ${appName} to register context listener`;
|
|
9196
9221
|
const promise = promisePlus(() => {
|
|
9197
9222
|
return new Promise((res, rej) => {
|
|
9198
9223
|
resolve = res;
|
|
9199
9224
|
reject = rej;
|
|
9200
9225
|
});
|
|
9201
|
-
}, this.defaultContextListenerInvokedPromiseTimeout,
|
|
9226
|
+
}, this.defaultContextListenerInvokedPromiseTimeout, timeoutMessage);
|
|
9202
9227
|
return { promise, resolve, reject };
|
|
9203
9228
|
}
|
|
9204
9229
|
}
|
|
@@ -10535,7 +10560,7 @@ const fdc3Factory = () => {
|
|
|
10535
10560
|
return ioc.fdc3;
|
|
10536
10561
|
};
|
|
10537
10562
|
|
|
10538
|
-
var version = "2.7.
|
|
10563
|
+
var version = "2.7.2";
|
|
10539
10564
|
|
|
10540
10565
|
const globalScope = typeof process !== "undefined" ? process : window;
|
|
10541
10566
|
globalScope.fdc3Info = {
|
|
@@ -6320,12 +6320,12 @@
|
|
|
6320
6320
|
interopInstance() {
|
|
6321
6321
|
return this.glue.interop.instance;
|
|
6322
6322
|
}
|
|
6323
|
-
async getApplication(
|
|
6323
|
+
async getApplication(options) {
|
|
6324
6324
|
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6325
6325
|
if (!isAppsAPIAvailable) {
|
|
6326
|
-
return this.glue.appManager.application(name);
|
|
6326
|
+
return this.glue.appManager.application(options.name);
|
|
6327
6327
|
}
|
|
6328
|
-
const app = await this.glue.apps.registry.get(
|
|
6328
|
+
const app = await this.glue.apps.registry.get(options);
|
|
6329
6329
|
return app ?? undefined;
|
|
6330
6330
|
}
|
|
6331
6331
|
async getApplicationInstances(appName) {
|
|
@@ -6344,6 +6344,21 @@
|
|
|
6344
6344
|
const appInstance = await this.glue.apps.instances.get({ id });
|
|
6345
6345
|
return appInstance ?? undefined;
|
|
6346
6346
|
}
|
|
6347
|
+
async getIoCDAppConfiguration(app) {
|
|
6348
|
+
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6349
|
+
if (!isAppsAPIAvailable) {
|
|
6350
|
+
return app.getConfiguration();
|
|
6351
|
+
}
|
|
6352
|
+
const definition = app.definition;
|
|
6353
|
+
if (definition) {
|
|
6354
|
+
return definition;
|
|
6355
|
+
}
|
|
6356
|
+
const appWithDefinition = await this.glue.apps.registry.get({ name: app.name, includeDefinition: true });
|
|
6357
|
+
if (!appWithDefinition?.definition) {
|
|
6358
|
+
throw new Error(`Application definition for app '${app.name}' could not be found`);
|
|
6359
|
+
}
|
|
6360
|
+
return appWithDefinition.definition;
|
|
6361
|
+
}
|
|
6347
6362
|
async startApplication({ app, context, waitForInstanceReady }) {
|
|
6348
6363
|
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6349
6364
|
if (!isAppsAPIAvailable) {
|
|
@@ -6354,7 +6369,7 @@
|
|
|
6354
6369
|
if (!waitForInstanceReady) {
|
|
6355
6370
|
return glueInstance;
|
|
6356
6371
|
}
|
|
6357
|
-
await this.glue.apps
|
|
6372
|
+
await this.glue.apps.instances.waitForReady({ id: glueInstance.id });
|
|
6358
6373
|
return glueInstance;
|
|
6359
6374
|
}
|
|
6360
6375
|
async findIntents(intentFilter) {
|
|
@@ -8670,7 +8685,7 @@
|
|
|
8670
8685
|
if (!context && !resultType) {
|
|
8671
8686
|
return this.convertGlue42IntentToFDC3Intent(searchedGlueIntent);
|
|
8672
8687
|
}
|
|
8673
|
-
const contextType =
|
|
8688
|
+
const contextType = context?.type === fdc3NothingContextType ? undefined : context?.type;
|
|
8674
8689
|
const filteredIntent = this.getGlueIntentWithFilteredHandlers(searchedGlueIntent, { contextType, resultType });
|
|
8675
8690
|
if (!filteredIntent.handlers.length) {
|
|
8676
8691
|
throw new Error(ResolveError.NoAppsFound);
|
|
@@ -8822,7 +8837,7 @@
|
|
|
8822
8837
|
const appName = typeof target === "string" ? target : target.appId;
|
|
8823
8838
|
const instanceId = typeof target === "string" ? undefined : target.instanceId;
|
|
8824
8839
|
this.logger?.info(`[${commandId}] - Checking if application with name ${appName} exists`);
|
|
8825
|
-
const app = await this.glueController.getApplication(appName);
|
|
8840
|
+
const app = await this.glueController.getApplication({ name: appName, includeDefinition: true, includeInstances: true });
|
|
8826
8841
|
const serverInstances = this.serverInstanceAsIntentHandler(intent.name);
|
|
8827
8842
|
if (!app && (typeof target === "string" || !target.instanceId || !serverInstances.length)) {
|
|
8828
8843
|
throw new Error(ResolveError.TargetAppUnavailable);
|
|
@@ -8836,8 +8851,9 @@
|
|
|
8836
8851
|
this.logger?.log(`[${commandId}] - returning all handlers for intent ${intent.name} and target: ${JSON.stringify(target)}`);
|
|
8837
8852
|
return { name: intent.name, handlers: validHandlersByApplicationName };
|
|
8838
8853
|
}
|
|
8854
|
+
const appInstances = app?.instances ?? await (this.glueController.getApplicationInstances(appName));
|
|
8839
8855
|
const isValidInstanceOfTheApp = app
|
|
8840
|
-
?
|
|
8856
|
+
? appInstances.find((inst) => inst.id === instanceId)
|
|
8841
8857
|
: serverInstances.find((inst) => inst.instance === instanceId);
|
|
8842
8858
|
if (!isValidInstanceOfTheApp) {
|
|
8843
8859
|
throw new Error(ResolveError.TargetInstanceUnavailable);
|
|
@@ -8906,15 +8922,20 @@
|
|
|
8906
8922
|
const { name, handlers } = glueIntent;
|
|
8907
8923
|
const apps = await Promise.all(handlers.map(async (handler) => {
|
|
8908
8924
|
const appName = handler.applicationName;
|
|
8909
|
-
const app = await this.glueController.getApplication(appName);
|
|
8910
|
-
const icons =
|
|
8911
|
-
|
|
8925
|
+
const app = await this.glueController.getApplication({ name: appName, includeDefinition: true });
|
|
8926
|
+
const icons = [app?.icon, ...(app?.userProperties?.icons ?? []), ...(app?.customProperties?.icons ?? [])]
|
|
8927
|
+
.filter((icon) => !!icon)
|
|
8928
|
+
.map((icon) => ({ src: icon }));
|
|
8929
|
+
const images = [...(app?.userProperties?.images ?? []), ...(app?.customProperties?.images ?? [])]
|
|
8930
|
+
.filter((image) => !!image)
|
|
8931
|
+
.map((image) => ({ src: image }));
|
|
8932
|
+
const tooltip = app?.title || app?.userProperties?.tooltip || `${appName} (${handler.type})`;
|
|
8912
8933
|
return {
|
|
8913
8934
|
appId: appName,
|
|
8914
8935
|
instanceId: handler.instanceId,
|
|
8915
8936
|
name: appName,
|
|
8916
8937
|
title: handler.applicationTitle || handler.instanceTitle || appName,
|
|
8917
|
-
tooltip
|
|
8938
|
+
tooltip,
|
|
8918
8939
|
description: handler.applicationDescription,
|
|
8919
8940
|
icons,
|
|
8920
8941
|
images,
|
|
@@ -9036,7 +9057,7 @@
|
|
|
9036
9057
|
await this.glueController.gluePromise;
|
|
9037
9058
|
this.logger?.log(`[${commandId}] - open() invoked with target ${JSON.stringify(target)} ${context ? `and contextType ${context.type}` : ""}`);
|
|
9038
9059
|
const name = typeof target === "object" ? target.appId : target;
|
|
9039
|
-
const app = await this.glueController.getApplication(name);
|
|
9060
|
+
const app = await this.glueController.getApplication({ name });
|
|
9040
9061
|
if (!app) {
|
|
9041
9062
|
throw new Error(OpenError.AppNotFound);
|
|
9042
9063
|
}
|
|
@@ -9059,12 +9080,12 @@
|
|
|
9059
9080
|
await this.glueController.gluePromise;
|
|
9060
9081
|
this.logger?.info(`[${commandId}] - findInstances() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
|
|
9061
9082
|
const { appId } = appIdentifier;
|
|
9062
|
-
const app = await this.glueController.getApplication(appId);
|
|
9083
|
+
const app = await this.glueController.getApplication({ name: appId, includeInstances: true, includeDefinition: true });
|
|
9063
9084
|
if (!app) {
|
|
9064
9085
|
throw new Error(ResolveError.NoAppsFound);
|
|
9065
9086
|
}
|
|
9066
|
-
const
|
|
9067
|
-
const fdc3Instances =
|
|
9087
|
+
const appInstances = app.instances ?? await this.glueController.getApplicationInstances(appId);
|
|
9088
|
+
const fdc3Instances = appInstances.map(glueInst => this.parseGlueInstToAppIdentifier(glueInst));
|
|
9068
9089
|
this.logger?.info(`[${commandId}] - ids of opened instances for appIdentifier ${JSON.stringify(appIdentifier)}: ${JSON.stringify(fdc3Instances.map(inst => inst.instanceId))}`);
|
|
9069
9090
|
return fdc3Instances;
|
|
9070
9091
|
}
|
|
@@ -9072,7 +9093,7 @@
|
|
|
9072
9093
|
await this.glueController.gluePromise;
|
|
9073
9094
|
this.logger?.info(`[${commandId}] - getAppMetadata() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
|
|
9074
9095
|
const { appId, instanceId } = appIdentifier;
|
|
9075
|
-
const app = await this.glueController.getApplication(appId);
|
|
9096
|
+
const app = await this.glueController.getApplication({ name: appId, includeDefinition: true, includeInstances: true });
|
|
9076
9097
|
if (!app) {
|
|
9077
9098
|
throw new Error(OpenError.AppNotFound);
|
|
9078
9099
|
}
|
|
@@ -9106,7 +9127,7 @@
|
|
|
9106
9127
|
async getCurrentAppMetadata() {
|
|
9107
9128
|
const myInstance = this.glueController.interopInstance();
|
|
9108
9129
|
const myInstanceApplicationName = myInstance.application ?? myInstance.applicationName;
|
|
9109
|
-
const myApp = await this.glueController.getApplication(myInstanceApplicationName);
|
|
9130
|
+
const myApp = await this.glueController.getApplication({ name: myInstanceApplicationName, includeDefinition: true });
|
|
9110
9131
|
if (myApp) {
|
|
9111
9132
|
return { appId: myApp.name, instanceId: myInstance.instance };
|
|
9112
9133
|
}
|
|
@@ -9120,40 +9141,43 @@
|
|
|
9120
9141
|
};
|
|
9121
9142
|
}
|
|
9122
9143
|
async parseGlueAppToAppMetadata(app, instance) {
|
|
9123
|
-
const
|
|
9144
|
+
const inBrowserNamespace = this.glueController.isRunningInBrowser();
|
|
9145
|
+
const appMetadata = inBrowserNamespace
|
|
9146
|
+
? await this.getBaseGlueAppToAppMetadataInBrowser(app)
|
|
9147
|
+
: await this.getBaseGlueAppToAppMetadataInDesktop(app);
|
|
9124
9148
|
if (!instance) {
|
|
9125
9149
|
return appMetadata;
|
|
9126
9150
|
}
|
|
9127
|
-
|
|
9151
|
+
const instanceData = {
|
|
9152
|
+
instanceId: instance.id,
|
|
9153
|
+
instanceMetadata: this.isApplicationInstance(instance) ? instance.interopInstance : instance.agm
|
|
9154
|
+
};
|
|
9155
|
+
return { ...appMetadata, ...instanceData };
|
|
9128
9156
|
}
|
|
9129
|
-
async
|
|
9130
|
-
const
|
|
9131
|
-
const
|
|
9132
|
-
? app.userProperties
|
|
9133
|
-
: await app.getConfiguration();
|
|
9134
|
-
const icon = inBrowserNamespace
|
|
9135
|
-
? app.icon
|
|
9136
|
-
: (await app.getConfiguration()).icon;
|
|
9137
|
-
const desktopScreenshots = appConfiguration.customProperties?.screenshots ?? appConfiguration.userProperties?.screenshots;
|
|
9138
|
-
const screenshots = inBrowserNamespace
|
|
9139
|
-
? appConfiguration.screenshots
|
|
9140
|
-
: desktopScreenshots;
|
|
9157
|
+
async getBaseGlueAppToAppMetadataInDesktop(app) {
|
|
9158
|
+
const appConfiguration = await this.glueController.getIoCDAppConfiguration(app);
|
|
9159
|
+
const screenshots = appConfiguration.customProperties?.screenshots ?? appConfiguration.userProperties?.screenshots;
|
|
9141
9160
|
return {
|
|
9142
|
-
appId:
|
|
9143
|
-
name:
|
|
9144
|
-
version:
|
|
9161
|
+
appId: appConfiguration.name,
|
|
9162
|
+
name: appConfiguration.name,
|
|
9163
|
+
version: appConfiguration.version,
|
|
9145
9164
|
description: appConfiguration.description,
|
|
9146
|
-
title:
|
|
9147
|
-
icons: icon ? [{ src: icon }] : [],
|
|
9165
|
+
title: appConfiguration.title,
|
|
9166
|
+
icons: appConfiguration.icon ? [{ src: appConfiguration.icon }] : [],
|
|
9148
9167
|
tooltip: appConfiguration.tooltip,
|
|
9149
9168
|
screenshots
|
|
9150
9169
|
};
|
|
9151
9170
|
}
|
|
9152
|
-
|
|
9171
|
+
async getBaseGlueAppToAppMetadataInBrowser(app) {
|
|
9153
9172
|
return {
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9173
|
+
appId: app.name,
|
|
9174
|
+
name: app.name,
|
|
9175
|
+
version: app.version,
|
|
9176
|
+
description: app.userProperties.description,
|
|
9177
|
+
title: app.title,
|
|
9178
|
+
icons: app.icon ? [{ src: app.icon }] : [],
|
|
9179
|
+
tooltip: app.userProperties.tooltip,
|
|
9180
|
+
screenshots: app.userProperties.screenshots
|
|
9157
9181
|
};
|
|
9158
9182
|
}
|
|
9159
9183
|
isApplicationInstance(instance) {
|
|
@@ -9162,7 +9186,7 @@
|
|
|
9162
9186
|
async openAppWithContext(app, context) {
|
|
9163
9187
|
const guid = nanoid();
|
|
9164
9188
|
const startContext = this.buildStartContext(context, guid);
|
|
9165
|
-
const wrappedPromise = this.createContextListenerWrappedPromise(app);
|
|
9189
|
+
const wrappedPromise = this.createContextListenerWrappedPromise(app.name);
|
|
9166
9190
|
this.appsStateStore.addOpenAppPromise(guid, wrappedPromise);
|
|
9167
9191
|
try {
|
|
9168
9192
|
const glueInst = await this.glueController.startApplication({
|
|
@@ -9196,15 +9220,16 @@
|
|
|
9196
9220
|
}
|
|
9197
9221
|
};
|
|
9198
9222
|
}
|
|
9199
|
-
createContextListenerWrappedPromise(
|
|
9223
|
+
createContextListenerWrappedPromise(appName) {
|
|
9200
9224
|
let resolve = () => { };
|
|
9201
9225
|
let reject = () => { };
|
|
9226
|
+
const timeoutMessage = `Timeout of ${this.defaultContextListenerInvokedPromiseTimeout}ms hit waiting for application with appId: ${appName} to register context listener`;
|
|
9202
9227
|
const promise = promisePlus(() => {
|
|
9203
9228
|
return new Promise((res, rej) => {
|
|
9204
9229
|
resolve = res;
|
|
9205
9230
|
reject = rej;
|
|
9206
9231
|
});
|
|
9207
|
-
}, this.defaultContextListenerInvokedPromiseTimeout,
|
|
9232
|
+
}, this.defaultContextListenerInvokedPromiseTimeout, timeoutMessage);
|
|
9208
9233
|
return { promise, resolve, reject };
|
|
9209
9234
|
}
|
|
9210
9235
|
}
|
|
@@ -10541,7 +10566,7 @@
|
|
|
10541
10566
|
return ioc.fdc3;
|
|
10542
10567
|
};
|
|
10543
10568
|
|
|
10544
|
-
var version = "2.7.
|
|
10569
|
+
var version = "2.7.2";
|
|
10545
10570
|
|
|
10546
10571
|
const globalScope = typeof process !== "undefined" ? process : window;
|
|
10547
10572
|
globalScope.fdc3Info = {
|
package/dist/fdc3.es.js
CHANGED
|
@@ -6303,12 +6303,12 @@ class GlueController {
|
|
|
6303
6303
|
interopInstance() {
|
|
6304
6304
|
return this.glue.interop.instance;
|
|
6305
6305
|
}
|
|
6306
|
-
async getApplication(
|
|
6306
|
+
async getApplication(options) {
|
|
6307
6307
|
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6308
6308
|
if (!isAppsAPIAvailable) {
|
|
6309
|
-
return this.glue.appManager.application(name);
|
|
6309
|
+
return this.glue.appManager.application(options.name);
|
|
6310
6310
|
}
|
|
6311
|
-
const app = await this.glue.apps.registry.get(
|
|
6311
|
+
const app = await this.glue.apps.registry.get(options);
|
|
6312
6312
|
return app ?? undefined;
|
|
6313
6313
|
}
|
|
6314
6314
|
async getApplicationInstances(appName) {
|
|
@@ -6327,6 +6327,21 @@ class GlueController {
|
|
|
6327
6327
|
const appInstance = await this.glue.apps.instances.get({ id });
|
|
6328
6328
|
return appInstance ?? undefined;
|
|
6329
6329
|
}
|
|
6330
|
+
async getIoCDAppConfiguration(app) {
|
|
6331
|
+
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6332
|
+
if (!isAppsAPIAvailable) {
|
|
6333
|
+
return app.getConfiguration();
|
|
6334
|
+
}
|
|
6335
|
+
const definition = app.definition;
|
|
6336
|
+
if (definition) {
|
|
6337
|
+
return definition;
|
|
6338
|
+
}
|
|
6339
|
+
const appWithDefinition = await this.glue.apps.registry.get({ name: app.name, includeDefinition: true });
|
|
6340
|
+
if (!appWithDefinition?.definition) {
|
|
6341
|
+
throw new Error(`Application definition for app '${app.name}' could not be found`);
|
|
6342
|
+
}
|
|
6343
|
+
return appWithDefinition.definition;
|
|
6344
|
+
}
|
|
6330
6345
|
async startApplication({ app, context, waitForInstanceReady }) {
|
|
6331
6346
|
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6332
6347
|
if (!isAppsAPIAvailable) {
|
|
@@ -6337,7 +6352,7 @@ class GlueController {
|
|
|
6337
6352
|
if (!waitForInstanceReady) {
|
|
6338
6353
|
return glueInstance;
|
|
6339
6354
|
}
|
|
6340
|
-
await this.glue.apps
|
|
6355
|
+
await this.glue.apps.instances.waitForReady({ id: glueInstance.id });
|
|
6341
6356
|
return glueInstance;
|
|
6342
6357
|
}
|
|
6343
6358
|
async findIntents(intentFilter) {
|
|
@@ -8653,7 +8668,7 @@ class IntentsController {
|
|
|
8653
8668
|
if (!context && !resultType) {
|
|
8654
8669
|
return this.convertGlue42IntentToFDC3Intent(searchedGlueIntent);
|
|
8655
8670
|
}
|
|
8656
|
-
const contextType =
|
|
8671
|
+
const contextType = context?.type === fdc3NothingContextType ? undefined : context?.type;
|
|
8657
8672
|
const filteredIntent = this.getGlueIntentWithFilteredHandlers(searchedGlueIntent, { contextType, resultType });
|
|
8658
8673
|
if (!filteredIntent.handlers.length) {
|
|
8659
8674
|
throw new Error(ResolveError.NoAppsFound);
|
|
@@ -8805,7 +8820,7 @@ class IntentsController {
|
|
|
8805
8820
|
const appName = typeof target === "string" ? target : target.appId;
|
|
8806
8821
|
const instanceId = typeof target === "string" ? undefined : target.instanceId;
|
|
8807
8822
|
this.logger?.info(`[${commandId}] - Checking if application with name ${appName} exists`);
|
|
8808
|
-
const app = await this.glueController.getApplication(appName);
|
|
8823
|
+
const app = await this.glueController.getApplication({ name: appName, includeDefinition: true, includeInstances: true });
|
|
8809
8824
|
const serverInstances = this.serverInstanceAsIntentHandler(intent.name);
|
|
8810
8825
|
if (!app && (typeof target === "string" || !target.instanceId || !serverInstances.length)) {
|
|
8811
8826
|
throw new Error(ResolveError.TargetAppUnavailable);
|
|
@@ -8819,8 +8834,9 @@ class IntentsController {
|
|
|
8819
8834
|
this.logger?.log(`[${commandId}] - returning all handlers for intent ${intent.name} and target: ${JSON.stringify(target)}`);
|
|
8820
8835
|
return { name: intent.name, handlers: validHandlersByApplicationName };
|
|
8821
8836
|
}
|
|
8837
|
+
const appInstances = app?.instances ?? await (this.glueController.getApplicationInstances(appName));
|
|
8822
8838
|
const isValidInstanceOfTheApp = app
|
|
8823
|
-
?
|
|
8839
|
+
? appInstances.find((inst) => inst.id === instanceId)
|
|
8824
8840
|
: serverInstances.find((inst) => inst.instance === instanceId);
|
|
8825
8841
|
if (!isValidInstanceOfTheApp) {
|
|
8826
8842
|
throw new Error(ResolveError.TargetInstanceUnavailable);
|
|
@@ -8889,15 +8905,20 @@ class IntentsController {
|
|
|
8889
8905
|
const { name, handlers } = glueIntent;
|
|
8890
8906
|
const apps = await Promise.all(handlers.map(async (handler) => {
|
|
8891
8907
|
const appName = handler.applicationName;
|
|
8892
|
-
const app = await this.glueController.getApplication(appName);
|
|
8893
|
-
const icons =
|
|
8894
|
-
|
|
8908
|
+
const app = await this.glueController.getApplication({ name: appName, includeDefinition: true });
|
|
8909
|
+
const icons = [app?.icon, ...(app?.userProperties?.icons ?? []), ...(app?.customProperties?.icons ?? [])]
|
|
8910
|
+
.filter((icon) => !!icon)
|
|
8911
|
+
.map((icon) => ({ src: icon }));
|
|
8912
|
+
const images = [...(app?.userProperties?.images ?? []), ...(app?.customProperties?.images ?? [])]
|
|
8913
|
+
.filter((image) => !!image)
|
|
8914
|
+
.map((image) => ({ src: image }));
|
|
8915
|
+
const tooltip = app?.title || app?.userProperties?.tooltip || `${appName} (${handler.type})`;
|
|
8895
8916
|
return {
|
|
8896
8917
|
appId: appName,
|
|
8897
8918
|
instanceId: handler.instanceId,
|
|
8898
8919
|
name: appName,
|
|
8899
8920
|
title: handler.applicationTitle || handler.instanceTitle || appName,
|
|
8900
|
-
tooltip
|
|
8921
|
+
tooltip,
|
|
8901
8922
|
description: handler.applicationDescription,
|
|
8902
8923
|
icons,
|
|
8903
8924
|
images,
|
|
@@ -9019,7 +9040,7 @@ class ApplicationsController {
|
|
|
9019
9040
|
await this.glueController.gluePromise;
|
|
9020
9041
|
this.logger?.log(`[${commandId}] - open() invoked with target ${JSON.stringify(target)} ${context ? `and contextType ${context.type}` : ""}`);
|
|
9021
9042
|
const name = typeof target === "object" ? target.appId : target;
|
|
9022
|
-
const app = await this.glueController.getApplication(name);
|
|
9043
|
+
const app = await this.glueController.getApplication({ name });
|
|
9023
9044
|
if (!app) {
|
|
9024
9045
|
throw new Error(OpenError.AppNotFound);
|
|
9025
9046
|
}
|
|
@@ -9042,12 +9063,12 @@ class ApplicationsController {
|
|
|
9042
9063
|
await this.glueController.gluePromise;
|
|
9043
9064
|
this.logger?.info(`[${commandId}] - findInstances() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
|
|
9044
9065
|
const { appId } = appIdentifier;
|
|
9045
|
-
const app = await this.glueController.getApplication(appId);
|
|
9066
|
+
const app = await this.glueController.getApplication({ name: appId, includeInstances: true, includeDefinition: true });
|
|
9046
9067
|
if (!app) {
|
|
9047
9068
|
throw new Error(ResolveError.NoAppsFound);
|
|
9048
9069
|
}
|
|
9049
|
-
const
|
|
9050
|
-
const fdc3Instances =
|
|
9070
|
+
const appInstances = app.instances ?? await this.glueController.getApplicationInstances(appId);
|
|
9071
|
+
const fdc3Instances = appInstances.map(glueInst => this.parseGlueInstToAppIdentifier(glueInst));
|
|
9051
9072
|
this.logger?.info(`[${commandId}] - ids of opened instances for appIdentifier ${JSON.stringify(appIdentifier)}: ${JSON.stringify(fdc3Instances.map(inst => inst.instanceId))}`);
|
|
9052
9073
|
return fdc3Instances;
|
|
9053
9074
|
}
|
|
@@ -9055,7 +9076,7 @@ class ApplicationsController {
|
|
|
9055
9076
|
await this.glueController.gluePromise;
|
|
9056
9077
|
this.logger?.info(`[${commandId}] - getAppMetadata() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
|
|
9057
9078
|
const { appId, instanceId } = appIdentifier;
|
|
9058
|
-
const app = await this.glueController.getApplication(appId);
|
|
9079
|
+
const app = await this.glueController.getApplication({ name: appId, includeDefinition: true, includeInstances: true });
|
|
9059
9080
|
if (!app) {
|
|
9060
9081
|
throw new Error(OpenError.AppNotFound);
|
|
9061
9082
|
}
|
|
@@ -9089,7 +9110,7 @@ class ApplicationsController {
|
|
|
9089
9110
|
async getCurrentAppMetadata() {
|
|
9090
9111
|
const myInstance = this.glueController.interopInstance();
|
|
9091
9112
|
const myInstanceApplicationName = myInstance.application ?? myInstance.applicationName;
|
|
9092
|
-
const myApp = await this.glueController.getApplication(myInstanceApplicationName);
|
|
9113
|
+
const myApp = await this.glueController.getApplication({ name: myInstanceApplicationName, includeDefinition: true });
|
|
9093
9114
|
if (myApp) {
|
|
9094
9115
|
return { appId: myApp.name, instanceId: myInstance.instance };
|
|
9095
9116
|
}
|
|
@@ -9103,40 +9124,43 @@ class ApplicationsController {
|
|
|
9103
9124
|
};
|
|
9104
9125
|
}
|
|
9105
9126
|
async parseGlueAppToAppMetadata(app, instance) {
|
|
9106
|
-
const
|
|
9127
|
+
const inBrowserNamespace = this.glueController.isRunningInBrowser();
|
|
9128
|
+
const appMetadata = inBrowserNamespace
|
|
9129
|
+
? await this.getBaseGlueAppToAppMetadataInBrowser(app)
|
|
9130
|
+
: await this.getBaseGlueAppToAppMetadataInDesktop(app);
|
|
9107
9131
|
if (!instance) {
|
|
9108
9132
|
return appMetadata;
|
|
9109
9133
|
}
|
|
9110
|
-
|
|
9134
|
+
const instanceData = {
|
|
9135
|
+
instanceId: instance.id,
|
|
9136
|
+
instanceMetadata: this.isApplicationInstance(instance) ? instance.interopInstance : instance.agm
|
|
9137
|
+
};
|
|
9138
|
+
return { ...appMetadata, ...instanceData };
|
|
9111
9139
|
}
|
|
9112
|
-
async
|
|
9113
|
-
const
|
|
9114
|
-
const
|
|
9115
|
-
? app.userProperties
|
|
9116
|
-
: await app.getConfiguration();
|
|
9117
|
-
const icon = inBrowserNamespace
|
|
9118
|
-
? app.icon
|
|
9119
|
-
: (await app.getConfiguration()).icon;
|
|
9120
|
-
const desktopScreenshots = appConfiguration.customProperties?.screenshots ?? appConfiguration.userProperties?.screenshots;
|
|
9121
|
-
const screenshots = inBrowserNamespace
|
|
9122
|
-
? appConfiguration.screenshots
|
|
9123
|
-
: desktopScreenshots;
|
|
9140
|
+
async getBaseGlueAppToAppMetadataInDesktop(app) {
|
|
9141
|
+
const appConfiguration = await this.glueController.getIoCDAppConfiguration(app);
|
|
9142
|
+
const screenshots = appConfiguration.customProperties?.screenshots ?? appConfiguration.userProperties?.screenshots;
|
|
9124
9143
|
return {
|
|
9125
|
-
appId:
|
|
9126
|
-
name:
|
|
9127
|
-
version:
|
|
9144
|
+
appId: appConfiguration.name,
|
|
9145
|
+
name: appConfiguration.name,
|
|
9146
|
+
version: appConfiguration.version,
|
|
9128
9147
|
description: appConfiguration.description,
|
|
9129
|
-
title:
|
|
9130
|
-
icons: icon ? [{ src: icon }] : [],
|
|
9148
|
+
title: appConfiguration.title,
|
|
9149
|
+
icons: appConfiguration.icon ? [{ src: appConfiguration.icon }] : [],
|
|
9131
9150
|
tooltip: appConfiguration.tooltip,
|
|
9132
9151
|
screenshots
|
|
9133
9152
|
};
|
|
9134
9153
|
}
|
|
9135
|
-
|
|
9154
|
+
async getBaseGlueAppToAppMetadataInBrowser(app) {
|
|
9136
9155
|
return {
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9156
|
+
appId: app.name,
|
|
9157
|
+
name: app.name,
|
|
9158
|
+
version: app.version,
|
|
9159
|
+
description: app.userProperties.description,
|
|
9160
|
+
title: app.title,
|
|
9161
|
+
icons: app.icon ? [{ src: app.icon }] : [],
|
|
9162
|
+
tooltip: app.userProperties.tooltip,
|
|
9163
|
+
screenshots: app.userProperties.screenshots
|
|
9140
9164
|
};
|
|
9141
9165
|
}
|
|
9142
9166
|
isApplicationInstance(instance) {
|
|
@@ -9145,7 +9169,7 @@ class ApplicationsController {
|
|
|
9145
9169
|
async openAppWithContext(app, context) {
|
|
9146
9170
|
const guid = nanoid();
|
|
9147
9171
|
const startContext = this.buildStartContext(context, guid);
|
|
9148
|
-
const wrappedPromise = this.createContextListenerWrappedPromise(app);
|
|
9172
|
+
const wrappedPromise = this.createContextListenerWrappedPromise(app.name);
|
|
9149
9173
|
this.appsStateStore.addOpenAppPromise(guid, wrappedPromise);
|
|
9150
9174
|
try {
|
|
9151
9175
|
const glueInst = await this.glueController.startApplication({
|
|
@@ -9179,15 +9203,16 @@ class ApplicationsController {
|
|
|
9179
9203
|
}
|
|
9180
9204
|
};
|
|
9181
9205
|
}
|
|
9182
|
-
createContextListenerWrappedPromise(
|
|
9206
|
+
createContextListenerWrappedPromise(appName) {
|
|
9183
9207
|
let resolve = () => { };
|
|
9184
9208
|
let reject = () => { };
|
|
9209
|
+
const timeoutMessage = `Timeout of ${this.defaultContextListenerInvokedPromiseTimeout}ms hit waiting for application with appId: ${appName} to register context listener`;
|
|
9185
9210
|
const promise = promisePlus(() => {
|
|
9186
9211
|
return new Promise((res, rej) => {
|
|
9187
9212
|
resolve = res;
|
|
9188
9213
|
reject = rej;
|
|
9189
9214
|
});
|
|
9190
|
-
}, this.defaultContextListenerInvokedPromiseTimeout,
|
|
9215
|
+
}, this.defaultContextListenerInvokedPromiseTimeout, timeoutMessage);
|
|
9191
9216
|
return { promise, resolve, reject };
|
|
9192
9217
|
}
|
|
9193
9218
|
}
|
|
@@ -10524,7 +10549,7 @@ const fdc3Factory = () => {
|
|
|
10524
10549
|
return ioc.fdc3;
|
|
10525
10550
|
};
|
|
10526
10551
|
|
|
10527
|
-
var version = "2.7.
|
|
10552
|
+
var version = "2.7.2";
|
|
10528
10553
|
|
|
10529
10554
|
const globalScope = typeof process !== "undefined" ? process : window;
|
|
10530
10555
|
globalScope.fdc3Info = {
|
package/dist/fdc3.umd.js
CHANGED
|
@@ -6309,12 +6309,12 @@
|
|
|
6309
6309
|
interopInstance() {
|
|
6310
6310
|
return this.glue.interop.instance;
|
|
6311
6311
|
}
|
|
6312
|
-
async getApplication(
|
|
6312
|
+
async getApplication(options) {
|
|
6313
6313
|
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6314
6314
|
if (!isAppsAPIAvailable) {
|
|
6315
|
-
return this.glue.appManager.application(name);
|
|
6315
|
+
return this.glue.appManager.application(options.name);
|
|
6316
6316
|
}
|
|
6317
|
-
const app = await this.glue.apps.registry.get(
|
|
6317
|
+
const app = await this.glue.apps.registry.get(options);
|
|
6318
6318
|
return app ?? undefined;
|
|
6319
6319
|
}
|
|
6320
6320
|
async getApplicationInstances(appName) {
|
|
@@ -6333,6 +6333,21 @@
|
|
|
6333
6333
|
const appInstance = await this.glue.apps.instances.get({ id });
|
|
6334
6334
|
return appInstance ?? undefined;
|
|
6335
6335
|
}
|
|
6336
|
+
async getIoCDAppConfiguration(app) {
|
|
6337
|
+
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6338
|
+
if (!isAppsAPIAvailable) {
|
|
6339
|
+
return app.getConfiguration();
|
|
6340
|
+
}
|
|
6341
|
+
const definition = app.definition;
|
|
6342
|
+
if (definition) {
|
|
6343
|
+
return definition;
|
|
6344
|
+
}
|
|
6345
|
+
const appWithDefinition = await this.glue.apps.registry.get({ name: app.name, includeDefinition: true });
|
|
6346
|
+
if (!appWithDefinition?.definition) {
|
|
6347
|
+
throw new Error(`Application definition for app '${app.name}' could not be found`);
|
|
6348
|
+
}
|
|
6349
|
+
return appWithDefinition.definition;
|
|
6350
|
+
}
|
|
6336
6351
|
async startApplication({ app, context, waitForInstanceReady }) {
|
|
6337
6352
|
const isAppsAPIAvailable = this.isAppsAPIAvailable();
|
|
6338
6353
|
if (!isAppsAPIAvailable) {
|
|
@@ -6343,7 +6358,7 @@
|
|
|
6343
6358
|
if (!waitForInstanceReady) {
|
|
6344
6359
|
return glueInstance;
|
|
6345
6360
|
}
|
|
6346
|
-
await this.glue.apps
|
|
6361
|
+
await this.glue.apps.instances.waitForReady({ id: glueInstance.id });
|
|
6347
6362
|
return glueInstance;
|
|
6348
6363
|
}
|
|
6349
6364
|
async findIntents(intentFilter) {
|
|
@@ -8659,7 +8674,7 @@
|
|
|
8659
8674
|
if (!context && !resultType) {
|
|
8660
8675
|
return this.convertGlue42IntentToFDC3Intent(searchedGlueIntent);
|
|
8661
8676
|
}
|
|
8662
|
-
const contextType =
|
|
8677
|
+
const contextType = context?.type === fdc3NothingContextType ? undefined : context?.type;
|
|
8663
8678
|
const filteredIntent = this.getGlueIntentWithFilteredHandlers(searchedGlueIntent, { contextType, resultType });
|
|
8664
8679
|
if (!filteredIntent.handlers.length) {
|
|
8665
8680
|
throw new Error(ResolveError.NoAppsFound);
|
|
@@ -8811,7 +8826,7 @@
|
|
|
8811
8826
|
const appName = typeof target === "string" ? target : target.appId;
|
|
8812
8827
|
const instanceId = typeof target === "string" ? undefined : target.instanceId;
|
|
8813
8828
|
this.logger?.info(`[${commandId}] - Checking if application with name ${appName} exists`);
|
|
8814
|
-
const app = await this.glueController.getApplication(appName);
|
|
8829
|
+
const app = await this.glueController.getApplication({ name: appName, includeDefinition: true, includeInstances: true });
|
|
8815
8830
|
const serverInstances = this.serverInstanceAsIntentHandler(intent.name);
|
|
8816
8831
|
if (!app && (typeof target === "string" || !target.instanceId || !serverInstances.length)) {
|
|
8817
8832
|
throw new Error(ResolveError.TargetAppUnavailable);
|
|
@@ -8825,8 +8840,9 @@
|
|
|
8825
8840
|
this.logger?.log(`[${commandId}] - returning all handlers for intent ${intent.name} and target: ${JSON.stringify(target)}`);
|
|
8826
8841
|
return { name: intent.name, handlers: validHandlersByApplicationName };
|
|
8827
8842
|
}
|
|
8843
|
+
const appInstances = app?.instances ?? await (this.glueController.getApplicationInstances(appName));
|
|
8828
8844
|
const isValidInstanceOfTheApp = app
|
|
8829
|
-
?
|
|
8845
|
+
? appInstances.find((inst) => inst.id === instanceId)
|
|
8830
8846
|
: serverInstances.find((inst) => inst.instance === instanceId);
|
|
8831
8847
|
if (!isValidInstanceOfTheApp) {
|
|
8832
8848
|
throw new Error(ResolveError.TargetInstanceUnavailable);
|
|
@@ -8895,15 +8911,20 @@
|
|
|
8895
8911
|
const { name, handlers } = glueIntent;
|
|
8896
8912
|
const apps = await Promise.all(handlers.map(async (handler) => {
|
|
8897
8913
|
const appName = handler.applicationName;
|
|
8898
|
-
const app = await this.glueController.getApplication(appName);
|
|
8899
|
-
const icons =
|
|
8900
|
-
|
|
8914
|
+
const app = await this.glueController.getApplication({ name: appName, includeDefinition: true });
|
|
8915
|
+
const icons = [app?.icon, ...(app?.userProperties?.icons ?? []), ...(app?.customProperties?.icons ?? [])]
|
|
8916
|
+
.filter((icon) => !!icon)
|
|
8917
|
+
.map((icon) => ({ src: icon }));
|
|
8918
|
+
const images = [...(app?.userProperties?.images ?? []), ...(app?.customProperties?.images ?? [])]
|
|
8919
|
+
.filter((image) => !!image)
|
|
8920
|
+
.map((image) => ({ src: image }));
|
|
8921
|
+
const tooltip = app?.title || app?.userProperties?.tooltip || `${appName} (${handler.type})`;
|
|
8901
8922
|
return {
|
|
8902
8923
|
appId: appName,
|
|
8903
8924
|
instanceId: handler.instanceId,
|
|
8904
8925
|
name: appName,
|
|
8905
8926
|
title: handler.applicationTitle || handler.instanceTitle || appName,
|
|
8906
|
-
tooltip
|
|
8927
|
+
tooltip,
|
|
8907
8928
|
description: handler.applicationDescription,
|
|
8908
8929
|
icons,
|
|
8909
8930
|
images,
|
|
@@ -9025,7 +9046,7 @@
|
|
|
9025
9046
|
await this.glueController.gluePromise;
|
|
9026
9047
|
this.logger?.log(`[${commandId}] - open() invoked with target ${JSON.stringify(target)} ${context ? `and contextType ${context.type}` : ""}`);
|
|
9027
9048
|
const name = typeof target === "object" ? target.appId : target;
|
|
9028
|
-
const app = await this.glueController.getApplication(name);
|
|
9049
|
+
const app = await this.glueController.getApplication({ name });
|
|
9029
9050
|
if (!app) {
|
|
9030
9051
|
throw new Error(OpenError.AppNotFound);
|
|
9031
9052
|
}
|
|
@@ -9048,12 +9069,12 @@
|
|
|
9048
9069
|
await this.glueController.gluePromise;
|
|
9049
9070
|
this.logger?.info(`[${commandId}] - findInstances() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
|
|
9050
9071
|
const { appId } = appIdentifier;
|
|
9051
|
-
const app = await this.glueController.getApplication(appId);
|
|
9072
|
+
const app = await this.glueController.getApplication({ name: appId, includeInstances: true, includeDefinition: true });
|
|
9052
9073
|
if (!app) {
|
|
9053
9074
|
throw new Error(ResolveError.NoAppsFound);
|
|
9054
9075
|
}
|
|
9055
|
-
const
|
|
9056
|
-
const fdc3Instances =
|
|
9076
|
+
const appInstances = app.instances ?? await this.glueController.getApplicationInstances(appId);
|
|
9077
|
+
const fdc3Instances = appInstances.map(glueInst => this.parseGlueInstToAppIdentifier(glueInst));
|
|
9057
9078
|
this.logger?.info(`[${commandId}] - ids of opened instances for appIdentifier ${JSON.stringify(appIdentifier)}: ${JSON.stringify(fdc3Instances.map(inst => inst.instanceId))}`);
|
|
9058
9079
|
return fdc3Instances;
|
|
9059
9080
|
}
|
|
@@ -9061,7 +9082,7 @@
|
|
|
9061
9082
|
await this.glueController.gluePromise;
|
|
9062
9083
|
this.logger?.info(`[${commandId}] - getAppMetadata() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
|
|
9063
9084
|
const { appId, instanceId } = appIdentifier;
|
|
9064
|
-
const app = await this.glueController.getApplication(appId);
|
|
9085
|
+
const app = await this.glueController.getApplication({ name: appId, includeDefinition: true, includeInstances: true });
|
|
9065
9086
|
if (!app) {
|
|
9066
9087
|
throw new Error(OpenError.AppNotFound);
|
|
9067
9088
|
}
|
|
@@ -9095,7 +9116,7 @@
|
|
|
9095
9116
|
async getCurrentAppMetadata() {
|
|
9096
9117
|
const myInstance = this.glueController.interopInstance();
|
|
9097
9118
|
const myInstanceApplicationName = myInstance.application ?? myInstance.applicationName;
|
|
9098
|
-
const myApp = await this.glueController.getApplication(myInstanceApplicationName);
|
|
9119
|
+
const myApp = await this.glueController.getApplication({ name: myInstanceApplicationName, includeDefinition: true });
|
|
9099
9120
|
if (myApp) {
|
|
9100
9121
|
return { appId: myApp.name, instanceId: myInstance.instance };
|
|
9101
9122
|
}
|
|
@@ -9109,40 +9130,43 @@
|
|
|
9109
9130
|
};
|
|
9110
9131
|
}
|
|
9111
9132
|
async parseGlueAppToAppMetadata(app, instance) {
|
|
9112
|
-
const
|
|
9133
|
+
const inBrowserNamespace = this.glueController.isRunningInBrowser();
|
|
9134
|
+
const appMetadata = inBrowserNamespace
|
|
9135
|
+
? await this.getBaseGlueAppToAppMetadataInBrowser(app)
|
|
9136
|
+
: await this.getBaseGlueAppToAppMetadataInDesktop(app);
|
|
9113
9137
|
if (!instance) {
|
|
9114
9138
|
return appMetadata;
|
|
9115
9139
|
}
|
|
9116
|
-
|
|
9140
|
+
const instanceData = {
|
|
9141
|
+
instanceId: instance.id,
|
|
9142
|
+
instanceMetadata: this.isApplicationInstance(instance) ? instance.interopInstance : instance.agm
|
|
9143
|
+
};
|
|
9144
|
+
return { ...appMetadata, ...instanceData };
|
|
9117
9145
|
}
|
|
9118
|
-
async
|
|
9119
|
-
const
|
|
9120
|
-
const
|
|
9121
|
-
? app.userProperties
|
|
9122
|
-
: await app.getConfiguration();
|
|
9123
|
-
const icon = inBrowserNamespace
|
|
9124
|
-
? app.icon
|
|
9125
|
-
: (await app.getConfiguration()).icon;
|
|
9126
|
-
const desktopScreenshots = appConfiguration.customProperties?.screenshots ?? appConfiguration.userProperties?.screenshots;
|
|
9127
|
-
const screenshots = inBrowserNamespace
|
|
9128
|
-
? appConfiguration.screenshots
|
|
9129
|
-
: desktopScreenshots;
|
|
9146
|
+
async getBaseGlueAppToAppMetadataInDesktop(app) {
|
|
9147
|
+
const appConfiguration = await this.glueController.getIoCDAppConfiguration(app);
|
|
9148
|
+
const screenshots = appConfiguration.customProperties?.screenshots ?? appConfiguration.userProperties?.screenshots;
|
|
9130
9149
|
return {
|
|
9131
|
-
appId:
|
|
9132
|
-
name:
|
|
9133
|
-
version:
|
|
9150
|
+
appId: appConfiguration.name,
|
|
9151
|
+
name: appConfiguration.name,
|
|
9152
|
+
version: appConfiguration.version,
|
|
9134
9153
|
description: appConfiguration.description,
|
|
9135
|
-
title:
|
|
9136
|
-
icons: icon ? [{ src: icon }] : [],
|
|
9154
|
+
title: appConfiguration.title,
|
|
9155
|
+
icons: appConfiguration.icon ? [{ src: appConfiguration.icon }] : [],
|
|
9137
9156
|
tooltip: appConfiguration.tooltip,
|
|
9138
9157
|
screenshots
|
|
9139
9158
|
};
|
|
9140
9159
|
}
|
|
9141
|
-
|
|
9160
|
+
async getBaseGlueAppToAppMetadataInBrowser(app) {
|
|
9142
9161
|
return {
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9162
|
+
appId: app.name,
|
|
9163
|
+
name: app.name,
|
|
9164
|
+
version: app.version,
|
|
9165
|
+
description: app.userProperties.description,
|
|
9166
|
+
title: app.title,
|
|
9167
|
+
icons: app.icon ? [{ src: app.icon }] : [],
|
|
9168
|
+
tooltip: app.userProperties.tooltip,
|
|
9169
|
+
screenshots: app.userProperties.screenshots
|
|
9146
9170
|
};
|
|
9147
9171
|
}
|
|
9148
9172
|
isApplicationInstance(instance) {
|
|
@@ -9151,7 +9175,7 @@
|
|
|
9151
9175
|
async openAppWithContext(app, context) {
|
|
9152
9176
|
const guid = nanoid();
|
|
9153
9177
|
const startContext = this.buildStartContext(context, guid);
|
|
9154
|
-
const wrappedPromise = this.createContextListenerWrappedPromise(app);
|
|
9178
|
+
const wrappedPromise = this.createContextListenerWrappedPromise(app.name);
|
|
9155
9179
|
this.appsStateStore.addOpenAppPromise(guid, wrappedPromise);
|
|
9156
9180
|
try {
|
|
9157
9181
|
const glueInst = await this.glueController.startApplication({
|
|
@@ -9185,15 +9209,16 @@
|
|
|
9185
9209
|
}
|
|
9186
9210
|
};
|
|
9187
9211
|
}
|
|
9188
|
-
createContextListenerWrappedPromise(
|
|
9212
|
+
createContextListenerWrappedPromise(appName) {
|
|
9189
9213
|
let resolve = () => { };
|
|
9190
9214
|
let reject = () => { };
|
|
9215
|
+
const timeoutMessage = `Timeout of ${this.defaultContextListenerInvokedPromiseTimeout}ms hit waiting for application with appId: ${appName} to register context listener`;
|
|
9191
9216
|
const promise = promisePlus(() => {
|
|
9192
9217
|
return new Promise((res, rej) => {
|
|
9193
9218
|
resolve = res;
|
|
9194
9219
|
reject = rej;
|
|
9195
9220
|
});
|
|
9196
|
-
}, this.defaultContextListenerInvokedPromiseTimeout,
|
|
9221
|
+
}, this.defaultContextListenerInvokedPromiseTimeout, timeoutMessage);
|
|
9197
9222
|
return { promise, resolve, reject };
|
|
9198
9223
|
}
|
|
9199
9224
|
}
|
|
@@ -10530,7 +10555,7 @@
|
|
|
10530
10555
|
return ioc.fdc3;
|
|
10531
10556
|
};
|
|
10532
10557
|
|
|
10533
|
-
var version = "2.7.
|
|
10558
|
+
var version = "2.7.2";
|
|
10534
10559
|
|
|
10535
10560
|
const globalScope = typeof process !== "undefined" ? process : window;
|
|
10536
10561
|
globalScope.fdc3Info = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interopio/fdc3",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "IO Connect implementation of the FDC3 standard",
|
|
5
5
|
"main": "dist/fdc3.umd.js",
|
|
6
6
|
"module": "dist/fdc3.es.js",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"@interopio:registry": "https://registry.npmjs.org",
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "ac23c0e3cafb7d405165736cd40db6053a64d1ed"
|
|
44
44
|
}
|