diff --git a/how-to/workspace-platform-starter/CHANGELOG.md b/how-to/workspace-platform-starter/CHANGELOG.md index 2521acb8b..765e6488c 100644 --- a/how-to/workspace-platform-starter/CHANGELOG.md +++ b/how-to/workspace-platform-starter/CHANGELOG.md @@ -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 diff --git a/how-to/workspace-platform-starter/client/src/framework/shapes/interopbroker-shapes.ts b/how-to/workspace-platform-starter/client/src/framework/shapes/interopbroker-shapes.ts index 69d032d3f..2b97f2023 100644 --- a/how-to/workspace-platform-starter/client/src/framework/shapes/interopbroker-shapes.ts +++ b/how-to/workspace-platform-starter/client/src/framework/shapes/interopbroker-shapes.ts @@ -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 @@ -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. */ diff --git a/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/broker/wps-interop-override.ts b/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/broker/wps-interop-override.ts index 76578d927..a8aedae83 100644 --- a/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/broker/wps-interop-override.ts +++ b/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/broker/wps-interop-override.ts @@ -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 { @@ -101,6 +102,8 @@ export async function getConstructorOverride( private readonly _contextOptions?: ContextOptions; + private readonly _getInfoOptions?: GetInfoOptions; + /** * Create a new instance of InteropBroker. */ @@ -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; @@ -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); } diff --git a/how-to/workspace-platform-starter/client/types/module/shapes/interopbroker-shapes.d.ts b/how-to/workspace-platform-starter/client/types/module/shapes/interopbroker-shapes.d.ts index fbca334c5..5b888a2e0 100644 --- a/how-to/workspace-platform-starter/client/types/module/shapes/interopbroker-shapes.d.ts +++ b/how-to/workspace-platform-starter/client/types/module/shapes/interopbroker-shapes.d.ts @@ -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 @@ -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. */ diff --git a/how-to/workspace-platform-starter/public/manifest.fin.json b/how-to/workspace-platform-starter/public/manifest.fin.json index 1421fae0b..9ac380364 100644 --- a/how-to/workspace-platform-starter/public/manifest.fin.json +++ b/how-to/workspace-platform-starter/public/manifest.fin.json @@ -132,6 +132,10 @@ "intentOptions": {}, "openOptions": {}, "contextOptions": {}, + "getInfoOptions": { + "includeAppInteropInfo": true, + "includeAllAppMetadataInfo": false + }, "unregisteredApp": { "appId": "unregistered", "title": "Other", diff --git a/how-to/workspace-platform-starter/public/schemas/settings.schema.json b/how-to/workspace-platform-starter/public/schemas/settings.schema.json index 9c036fe9e..d7dad6d11 100644 --- a/how-to/workspace-platform-starter/public/schemas/settings.schema.json +++ b/how-to/workspace-platform-starter/public/schemas/settings.schema.json @@ -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": [ @@ -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" diff --git a/how-to/workspace-platform-starter/public/schemas/wps.manifest.schema.json b/how-to/workspace-platform-starter/public/schemas/wps.manifest.schema.json index 66071fe3f..0acc3789c 100644 --- a/how-to/workspace-platform-starter/public/schemas/wps.manifest.schema.json +++ b/how-to/workspace-platform-starter/public/schemas/wps.manifest.schema.json @@ -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": [ @@ -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"