Skip to content

Commit

Permalink
Added fdc3.getInfo improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
johnman committed Nov 29, 2024
1 parent 4909853 commit fe7963f
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 8 deletions.
1 change: 1 addition & 0 deletions how-to/workspace-platform-starter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Removed the old platformProvider.intentPicker setting. The setting has been exposed through platformProvider.interop.intentResolver for a number of releases and is now the only way of setting the intent resolver.
- Added support for self hosting the Workspace Browser UI (html, js, css) and related settings through the new workspaceAsar setting introduced in 20.1 and added documentation around [self hosting workspace components](./docs/how-to-self-host-workspace.md)
- Feature: Added new getInfoOptions setting to platformProvider.interop that lets you specify two things: includeAllAppMetadataInfo (will use the appId if valid to get the AppMetadata to return to the app) & includeAppInteropInfo (will return the app's interop config as a part of the instanceMetadata of the appMetadata property). Both options default to false. Configured includeAppInteropInfo to true in the [public/manifest.fin.json](./public/manifest.fin.json) as it can be useful for an app to be able to confirm what the platform believes the application supports.

## v20.0.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export interface PlatformInteropBrokerOptions extends ModuleList {
*/
contextOptions?: ContextOptions;

/**
* When fdc3.getInfo is used what settings should be taken into account?
*/
getInfoOptions?: GetInfoOptions;

/**
* If an unregistered app is included here then it indicates you wish to support selecting views/windows that are
* not linked to an app from an intent picker that supports instances. The intents and contexts in this app specify
Expand Down Expand Up @@ -169,6 +174,22 @@ export interface ContextOptions {
includeOriginator?: boolean;
}

/**
* Get Info Options.
*/
export interface GetInfoOptions {
/**
* Should the broker include the interop capabilities as specified in the app directory within the appMetadata so that the app can take into account what the platform has specified should be supported (and whether there is a misconfiguration where the platform's app definition doesn't reflect the capabilities of the app).
* Default is false as this is not part of the fdc3 standard. It is placed within appMetadata.instanceMetadata.interop rather than appending it to the root of appMetadata as it is not part of the fdc3 standard.
*/
includeAppInteropInfo?: boolean;

/**
* Should the broker include the full app meta data or just appId and instanceId (and interopInfo if enabled). Default is false.
*/
includeAllAppMetadataInfo?: boolean;
}

/**
* Intent resolver options.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import type {
ProcessedContext,
PlatformInteropOverrideOptions,
PlatformInteropBrokerHelpers,
ContextOptions
ContextOptions,
GetInfoOptions
} from "workspace-platform-starter/shapes/interopbroker-shapes";
import type { Logger } from "workspace-platform-starter/shapes/logger-shapes";
import {
Expand Down Expand Up @@ -101,6 +102,8 @@ export async function getConstructorOverride(

private readonly _contextOptions?: ContextOptions;

private readonly _getInfoOptions?: GetInfoOptions;

/**
* Create a new instance of InteropBroker.
*/
Expand All @@ -120,6 +123,7 @@ export async function getConstructorOverride(
this._openOptions = options?.openOptions;
this._unregisteredApp = options?.unregisteredApp;
this._contextOptions = options?.contextOptions;
this._getInfoOptions = options?.getInfoOptions;

if (!isEmpty(this._unregisteredApp)) {
this._unregisteredApp.manifestType = MANIFEST_TYPES.UnregisteredApp.id;
Expand Down Expand Up @@ -855,14 +859,36 @@ export async function getConstructorOverride(
clientIdentity
)) as ImplementationMetadata;
const appId = await this._appIdHelper.lookupAppId(clientIdentity);
if (!isEmpty(appId)) {
const updatedResponse = {
...response,
appMetadata: { appId, instanceId: clientIdentity.endpointId }
};
return updatedResponse;
let appMetadata: AppMetadata | undefined;
const includeAllAppMetadataInfo = this._getInfoOptions?.includeAllAppMetadataInfo === true;
const includeAppInteropInfo = this._getInfoOptions?.includeAppInteropInfo === true;
if (!isEmpty(appId) && (includeAllAppMetadataInfo || includeAppInteropInfo)) {
const app = await getApp(appId);
appMetadata = { appId, instanceId: clientIdentity.endpointId };
if (!isEmpty(app)) {
if (includeAllAppMetadataInfo) {
appMetadata = {
...appMetadata,
...mapTo20AppMetaData(app)
};
}
if (includeAppInteropInfo && !isEmpty(app.interop)) {
appMetadata = {
...appMetadata,
instanceMetadata: { interop: app.interop }
};
}
}
}
return response;
const updatedResponse = {
...response,
optionalFeatures: {
...response.optionalFeatures,
OriginatingAppMetadata: true
},
appMetadata
};
return updatedResponse;
}
return super.fdc3HandleGetInfo(payload, clientIdentity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export interface PlatformInteropBrokerOptions extends ModuleList {
* Options for when fdc3.broadcast or fin.me.interop.setContext is called.
*/
contextOptions?: ContextOptions;
/**
* When fdc3.getInfo is used what settings should be taken into account?
*/
getInfoOptions?: GetInfoOptions;
/**
* If an unregistered app is included here then it indicates you wish to support selecting views/windows that are
* not linked to an app from an intent picker that supports instances. The intents and contexts in this app specify
Expand Down Expand Up @@ -152,6 +156,20 @@ export interface ContextOptions {
*/
includeOriginator?: boolean;
}
/**
* Get Info Options.
*/
export interface GetInfoOptions {
/**
* Should the broker include the interop capabilities as specified in the app directory within the appMetadata so that the app can take into account what the platform has specified should be supported (and whether there is a misconfiguration where the platform's app definition doesn't reflect the capabilities of the app).
* Default is false as this is not part of the fdc3 standard. It is placed within appMetadata.instanceMetadata.interop rather than appending it to the root of appMetadata as it is not part of the fdc3 standard.
*/
includeAppInteropInfo?: boolean;
/**
* Should the broker include the full app meta data or just appId and instanceId (and interopInfo if enabled). Default is false.
*/
includeAllAppMetadataInfo?: boolean;
}
/**
* Intent resolver options.
*/
Expand Down
4 changes: 4 additions & 0 deletions how-to/workspace-platform-starter/public/manifest.fin.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@
"intentOptions": {},
"openOptions": {},
"contextOptions": {},
"getInfoOptions": {
"includeAppInteropInfo": true,
"includeAllAppMetadataInfo": false
},
"unregisteredApp": {
"appId": "unregistered",
"title": "Other",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,21 @@
},
"type": "object"
},
"GetInfoOptions": {
"additionalProperties": false,
"description": "Get Info Options.",
"properties": {
"includeAllAppMetadataInfo": {
"description": "Should the broker include the full app meta data or just appId and instanceId (and interopInfo if enabled). Default is false.",
"type": "boolean"
},
"includeAppInteropInfo": {
"description": "Should the broker include the interop capabilities as specified in the app directory within the appMetadata so that the app can take into account what the platform has specified should be supported (and whether there is a misconfiguration where the platform's app definition doesn't reflect the capabilities of the app).\nDefault is false as this is not part of the fdc3 standard. It is placed within appMetadata.instanceMetadata.interop rather than appending it to the root of appMetadata as it is not part of the fdc3 standard.",
"type": "boolean"
}
},
"type": "object"
},
"GlobalContextMenuOptionType": {
"description": "Types of global context menu options, including pre-defined ones.\nUser-defined context menu items should use the value `Custom`",
"enum": [
Expand Down Expand Up @@ -4129,6 +4144,10 @@
"$ref": "#/definitions/ContextOptions",
"description": "Options for when fdc3.broadcast or fin.me.interop.setContext is called."
},
"getInfoOptions": {
"$ref": "#/definitions/GetInfoOptions",
"description": "When fdc3.getInfo is used what settings should be taken into account?"
},
"intentOptions": {
"$ref": "#/definitions/IntentOptions",
"description": "Options related to the way this platform supports intents"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1791,6 +1791,21 @@
"FileDownloadSettings": {
"$ref": "#/definitions/__type_68"
},
"GetInfoOptions": {
"additionalProperties": false,
"description": "Get Info Options.",
"properties": {
"includeAllAppMetadataInfo": {
"description": "Should the broker include the full app meta data or just appId and instanceId (and interopInfo if enabled). Default is false.",
"type": "boolean"
},
"includeAppInteropInfo": {
"description": "Should the broker include the interop capabilities as specified in the app directory within the appMetadata so that the app can take into account what the platform has specified should be supported (and whether there is a misconfiguration where the platform's app definition doesn't reflect the capabilities of the app).\nDefault is false as this is not part of the fdc3 standard. It is placed within appMetadata.instanceMetadata.interop rather than appending it to the root of appMetadata as it is not part of the fdc3 standard.",
"type": "boolean"
}
},
"type": "object"
},
"GlobalContextMenuOptionType": {
"description": "Types of global context menu options, including pre-defined ones.\nUser-defined context menu items should use the value `Custom`",
"enum": [
Expand Down Expand Up @@ -3889,6 +3904,10 @@
"$ref": "#/definitions/ContextOptions",
"description": "Options for when fdc3.broadcast or fin.me.interop.setContext is called."
},
"getInfoOptions": {
"$ref": "#/definitions/GetInfoOptions",
"description": "When fdc3.getInfo is used what settings should be taken into account?"
},
"intentOptions": {
"$ref": "#/definitions/IntentOptions",
"description": "Options related to the way this platform supports intents"
Expand Down

0 comments on commit fe7963f

Please sign in to comment.