Skip to content

Commit 720e35a

Browse files
authored
Merge branch 'master' into 717-recommended-channels
2 parents 58bfa45 + f7efe92 commit 720e35a

19 files changed

Lines changed: 1169 additions & 464 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1616
* Added a field to specify the Context type that intent can return to the AppD Application schema and extended the findIntent API calls to be able to use it for resolution. ([#499](https://github.com/finos/FDC3/pull/499))
1717
* Added the ability to return a Channel from an intent (via the `IntentResult` type), resolver support for intents that return Channels and the concept of PrivateChannels. ([#508](https://github.com/finos/FDC3/pull/508))
1818
* Added error `UserCancelled` to the `ResolveError` enumeration to be used when user closes the resolver UI or otherwise cancels resolution of a raised intent ([#522](https://github.com/finos/FDC3/pull/522))
19-
* Added error `IntentDeliveryFailed` to the `ResolveError` enumeration to be used when delivery of an intent and context to a targetted app or instance fails. ([#601](https://github.com/finos/FDC3/pull/601))
20-
* Added an `instanceId` (and optional `instanceMetadata`) field to `AppMetadata` allowing it to refer to specific app instances and thereby supporting targetting of intents to specific app instances. Also added a `findInstances()` function to the desktop agent and `TargetAppUnavailable` and `TargetInstanceUnavailable` Errors to the `ResolveError` enumeration. ([#509]((https://github.com/finos/FDC3/pull/509))
19+
* Added `IntentDeliveryFailed` to the `ResolveError` enumeration to be used when delivery of an intent and context to a targetted app or instance fails. ([#601](https://github.com/finos/FDC3/pull/601))
20+
* Added an `instanceId` (and optional `instanceMetadata`) field to `AppMetadata` allowing it to refer to specific app instances and thereby supporting targetting of intents to specific app instances. Also added a `findInstances()` function to the desktop agent and `TargetAppUnavailable` and `TargetInstanceUnavailable` Errors to the `ResolveError` enumeration. ([#509](https://github.com/finos/FDC3/pull/509))
2121
* Added a References and Bibliography section to the Standard's documentation to hold links to 'normative references' and other documentation that is useful for understanding the standard ([#530](https://github.com/finos/FDC3/pull/530))
2222
* Added a Trademarks page to website to acknowledge trademarks used within the Standard not owned by FINOS or the Linux Foundation ([#534](https://github.com/finos/FDC3/pull/534))
2323
* Added details of FDC3's existing versioning and deprecation policies to the FDC3 compliance page ([#539](https://github.com/finos/FDC3/pull/539))
2424
* Added a new experimental features policy, which exempts features designated as experimental from the versioning and deprecation policies, to the FDC3 compliance page ([#549](https://github.com/finos/FDC3/pull/549))
2525
* Added a recommended set of user channel definitions to the API docs and typescript sources ([#727](https://github.com/finos/FDC3/pull/726))
26+
* Added the optional exposure of originating app metadata to messages received via `addContextListener` and `addIntentListener` via the new `ContextMetadata` type. ([#725](https://github.com/finos/FDC3/pull/725))
2627
* Added the current app's `AppMetadata` to the `ImplementationMetadata` returned by `fdc3.getInfo()` allowing an app to retrieve its own metadata, according to the Desktop Agent ([#726](https://github.com/finos/FDC3/pull/726))
2728
* Added a context type representing a range of time (`fdc3.timerange`). ([#706](https://github.com/finos/FDC3/pull/706))
2829
* Added a context type representing a Currency (`fdc3.currency`). ([#708](https://github.com/finos/FDC3/pull/708))
@@ -42,6 +43,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4243
* Added `localizedVersions` field to AppD application records to support localized versions of descriptive fields in the app records and alternative launch details for localized versions of the applications themselves. ([#670](https://github.com/finos/FDC3/pull/670))
4344
* Added `type` and `details` elements to AppD application records to support vendor-agnostic launch details for both web and native apps ([#671](https://github.com/finos/FDC3/pull/671))
4445
* Added `categories` field and recommended categories list to AppD application records to enable category based browsing of AppDs ([#673](https://github.com/finos/FDC3/pull/673))
46+
* Added an `interop` field to AppD application records, replacing the `intents` field, to more fully describe an app's use of FDC3 and enable search for apps that 'interoperate' with a selected app ([#697](https://github.com/finos/FDC3/pull/697))
4547
* Added `AppIdentifier` type, which is a new parent of `AppMetadata` and clarifies required fields for API call parameters which now prefer `appId` and `instanceId` over `name` ([#722](https://github.com/finos/FDC3/pull/722))
4648

4749
### Changed
@@ -61,6 +63,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6163
* App Directory endpoint for searching applications was removed as searches over multiple app directories are better implemented by retrieving all the records and searching over the resulting combined dataset ([#696](https://github.com/finos/FDC3/pull/696))
6264
* Extended Intent Naming conventions and added hyperlinks for existing Intent spec definitions ([#701](https://github.com/finos/FDC3/pull/701))
6365
* Extended recommended field type conventions for contexts to include types for ids, times, dates, currency codes and country codes. The `fdc3.country` context type was updated to comply with the recommended field name for country codes (`COUNTRY_ISOALPHA2`). ([#704](https://github.com/finos/FDC3/pull/704))
66+
* The `intents` field of an AppD application records has been replaced with the `interop` field, to more fully describe an app's use of FDC3 and enable search for apps that 'interoperate' with a selected app ([#697](https://github.com/finos/FDC3/pull/697))
6467

6568
### Deprecated
6669

@@ -132,9 +135,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
132135
### Fixed
133136

134137
* `Intents` enum should contain `StartChat` not `StartChart` ([#364](https://github.com/finos/FDC3/pull/364))
135-
136-
### Fixed
137-
138138
* Return type of `getCurrentChannel()` should be `Promise<Channel | null>` ([#282](https://github.com/finos/FDC3/pull/282))
139139
* Missing `leaveCurrentChannel()` export ([#283](https://github.com/finos/FDC3/pull/283))
140140

docs/api/ref/Channel.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ interface Channel {
1919
type: "user" | "app" | "private";
2020
displayMetadata?: DisplayMetadata;
2121

22-
// methods
22+
// functions
2323
broadcast(context: Context): Promise<void>;
2424
getCurrentContext(contextType?: string): Promise<Context|null>;
2525
addContextListener(contextType: string | null, handler: ContextHandler): Promise<Listener>;
26+
27+
//deprecated functions
2628
/**
2729
* @deprecated Use `addContextListener(null, handler)` instead of `addContextListener(handler)`
2830
*/
@@ -68,8 +70,7 @@ DisplayMetadata can be used to provide display hints for User Channels intended
6870

6971
* [`DisplayMetadata`](Metadata#displaymetadata)
7072

71-
## Methods
72-
73+
## Functions
7374

7475
### `addContextListener`
7576

@@ -81,15 +82,7 @@ Adds a listener for incoming contexts of the specified _context type_ whenever a
8182

8283
If, when this function is called, the channel already contains context that would be passed to the listener it is NOT called or passed this context automatically (this behavior differs from that of the [`fdc3.addContextListener`](DesktopAgent#addcontextlistener) function). Apps wishing to access to the current context of the channel should instead call the [`getCurrentContext(contextType)`](#getcurrentcontext) function.
8384

84-
85-
```ts
86-
/**
87-
* @deprecated Use `addContextListener(null, handler)` instead of `addContextListener(handler)`
88-
*/
89-
public addContextListener(handler: ContextHandler): Promise<Listener>;
90-
```
91-
Adds a listener for incoming contexts whenever a broadcast happens on the channel.
92-
85+
Optional metadata about each context message received, including the app that originated the message, SHOULD be provided by the desktop agent implementation.
9386

9487
#### Examples
9588

@@ -210,3 +203,19 @@ try {
210203
* [`broadcast`](#broadcast)
211204
* [`addContextListener`](#addcontextlistener)
212205

206+
## Deprecated Functions
207+
208+
### `addContextListener` (deprecated)
209+
210+
```ts
211+
/**
212+
* @deprecated Use `addContextListener(null, handler)` instead of `addContextListener(handler)`
213+
*/
214+
public addContextListener(handler: ContextHandler): Promise<Listener>;
215+
```
216+
217+
Adds a listener for incoming contexts whenever a broadcast happens on the channel.
218+
219+
#### See also
220+
221+
* [`addContextListener`](#addcontextlistener)

docs/api/ref/DesktopAgent.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ Adds a listener for incoming context broadcasts from the Desktop Agent. If the c
6464

6565
Context broadcasts are only received from apps that are joined to the same User Channel as the listening application, hence, if the application is not currently joined to a User Channel no broadcasts will be received. If this function is called after the app has already joined a channel and the channel already contains context that would be passed to the context listener, then it will be called immediately with that context.
6666

67+
Optional metadata about each context message received, including the app that originated the message, SHOULD be provided by the desktop agent implementation.
68+
6769
#### Examples
6870

6971
```js
@@ -72,6 +74,12 @@ const listener = await fdc3.addContextListener(null, context => { ... });
7274

7375
// listener for a specific type
7476
const contactListener = await fdc3.addContextListener('fdc3.contact', contact => { ... });
77+
78+
// listener that logs metadata for the message a specific type
79+
const contactListener = await fdc3.addContextListener('fdc3.contact', (contact, metadata) => {
80+
console.log(`Received context message\nContext: ${contact}\nOriginating app: ${metadata?.sourceAppMetadata}`);
81+
//do something else with the context
82+
});
7583
```
7684
7785
#### See also
@@ -92,12 +100,20 @@ The Desktop Agent MUST reject the promise returned by the `getResult()` function
92100
93101
The [`PrivateChannel`](PrivateChannel) type is provided to support synchronisation of data transmitted over returned channels, by allowing both parties to listen for events denoting subscription and unsubscription from the returned channel. `PrivateChannels` are only retrievable via raising an intent.
94102
103+
Optional metadata about each intent & context message received, including the app that originated the message, SHOULD be provided by the desktop agent implementation.
104+
95105
#### Examples
96106
97107
```js
98108
//Handle a raised intent
99109
const listener = fdc3.addIntentListener('StartChat', context => {
100-
// start chat has been requested by another application
110+
// start chat has been requested by another application
111+
return;
112+
});
113+
114+
//Handle a raised intent and log the originating app metadata
115+
const listener = fdc3.addIntentListener('StartChat', (contact, metadata) => {
116+
console.log(`Received intent StartChat\nContext: ${contact}\nOriginating app: ${metadata?.sourceAppMetadata}`);
101117
return;
102118
});
103119
@@ -114,7 +130,7 @@ fdc3.addIntentListener("QuoteStream", async (context) => {
114130
const channel: PrivateChannel = await fdc3.createPrivateChannel();
115131
const symbol = context.id.symbol;
116132
117-
// Called when the remote side adds a context listener
133+
// Called when the remote side adds a context listener
118134
const addContextListener = channel.onAddContextListener((contextType) => {
119135
// broadcast price quotes as they come in from our quote feed
120136
feed.onQuote(symbol, (price) => {

docs/api/ref/Metadata.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,30 @@ Note that as `AppMetadata` instances are also `AppIdentifiers` they may be passe
8080
* [`DesktopAgent.findIntent`](DesktopAgent#findintent)
8181
* [`DesktopAgent.raiseIntent`](DesktopAgent#raiseintent)
8282

83+
## `ContextMetadata`
84+
85+
```ts
86+
interface ContextMetadata {
87+
/** Metadata identifying the app that sent the context and/or intent.
88+
* @experimental
89+
*/
90+
readonly sourceAppMetadata: AppMetadata;
91+
}
92+
```
93+
94+
Metadata relating to a context or intent & context received through the `addContextListener` and `addIntentListener` functions. Currently identifies that originated the context or intent message.
95+
96+
[`@experimental`](../../fdc3-compliance#experimental-features) Introduced in FDC3 2.0 and may be refined by further changes outside the normal FDC3 versioning policy.
97+
98+
#### See also
99+
100+
* [`AppMetadata`](#appmetadata)
101+
* [`ContextHandler`](Types#contexthandler)
102+
* [`IntentHandler`](Types#intenthandler)
103+
* [`addIntentListener`](DesktopAgent#addintentlistener)
104+
* [`addContextListener`](DesktopAgent#addcontextlistener)
105+
* [`Channel.addContextListener`](Channel#addcontextlistener)
106+
83107
## `DisplayMetadata`
84108

85109
```ts

docs/api/ref/Types.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,32 +59,38 @@ This means that it must at least have a `type` property that indicates what type
5959
## `ContextHandler`
6060

6161
```typescript
62-
type ContextHandler = (context: Context) => void;
62+
type ContextHandler = (context: Context, metadata?: ContextMetadata) => void;
6363
```
6464

65-
Describes a callback that handles a context event.
65+
Describes a callback that handles a context event. Optional metadata about the context message, including the app that originated the message, may be provided.
6666

6767
Used when attaching listeners for context broadcasts.
6868

69+
Optional metadata about the context message, including the app that originated the message, SHOULD be provided by the desktop agent implementation.
70+
6971
#### See also
7072

7173
* [`Context`](#context)
74+
* [`ContextMetadata`](Metadata#contextmetadata)
7275
* [`DesktopAgent.addContextListener`](DesktopAgent#addcontextlistener)
7376
* [`Channel.addContextListener`](Channel#addcontextlistener)
7477

7578
## `IntentHandler`
7679

7780
```typescript
78-
type IntentHandler = (context: Context) => Promise<IntentResult> | void;
81+
type IntentHandler = (context: Context, metadata?: ContextMetadata) => Promise<IntentResult> | void;
7982
```
8083

8184
Describes a callback that handles a context event and may return a promise of a Context or Channel object to be returned to the application that raised the intent.
8285

8386
Used when attaching listeners for raised intents.
8487

88+
Optional metadata about the intent & context message, including the app that originated the message, SHOULD be provided by the desktop agent implementation.
89+
8590
#### See also
8691

8792
* [`Context`](#context)
93+
* [`ContextMetadata`](Metadata#contextmetadata)
8894
* [`PrivateChannel`](PrivateChannel)
8995
* [`DesktopAgent.addIntentListener`](DesktopAgent#addintentlistener)
9096
* [`Channel.addContextListener`](Channel#addcontextlistener)

0 commit comments

Comments
 (0)