Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make window.fdc3 optional #1386

Merged
merged 5 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Changed

* `window.fdc3` is now an optional property and may or may not be defined. Applications should now use `getAgent()` as the recommended way of retrieving a reference to the FDC3 API. ([#1386](https://github.com/finos/FDC3/pull/1386))
* `Listener.unsubscribe()` was made async (the return type was changed from `void` to `Promise<void>`) for consistency with the rest of the API. ([#1305](https://github.com/finos/FDC3/pull/1305))
* Added reference materials and supported platforms information for FDC3 in .NET via the [finos/fdc3-dotnet](https://github.com/finos/fdc3-dotnet) project. ([#1108](https://github.com/finos/FDC3/pull/1108))
* The supported platforms page in the FDC3 documentation was moved into the API section as the information it provides all relates to FDC3 Desktop Agent API implementations. ([#1108](https://github.com/finos/FDC3/pull/1108))
Expand Down
1 change: 0 additions & 1 deletion src/api/DesktopAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { ImplementationMetadata } from './ImplementationMetadata';
import { PrivateChannel } from './PrivateChannel';
import { AppIdentifier } from './AppIdentifier';
import { AppMetadata } from './AppMetadata';
import { DesktopAgentDetails } from './GetAgent';
kriswest marked this conversation as resolved.
Show resolved Hide resolved
import { Intent } from '../intents/Intents';
import { ContextType } from '../context/ContextType';
import { EventHandler, FDC3EventTypes } from './Events';
Expand Down
97 changes: 47 additions & 50 deletions src/context/ContextTypes.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't make any changes to this file. I think it was an automated husky script that did this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry about this one, every PR is making the same changes, something got merged without generation being run. We'll make sure this is sorted out before the 2.2 release.

Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export interface Chart {
}

/**
* financial instrument that relates to the definition of this product
* A financial instrument that relates to the definition of this product
*
*
*
Expand Down Expand Up @@ -235,7 +235,7 @@ export interface InstrumentElement {
* interoperability between disparate data sources. This is especially useful when using an
* `id` field that is not globally unique.
*/
market?: SearchCriteriaMarket;
market?: OrganizationMarket;
/**
* An optional human-readable name for the instrument
*/
Expand Down Expand Up @@ -304,7 +304,7 @@ export interface PurpleInstrumentIdentifiers {
* interoperability between disparate data sources. This is especially useful when using an
* `id` field that is not globally unique.
*/
export interface SearchCriteriaMarket {
export interface OrganizationMarket {
/**
* https://www.bloomberg.com/
*/
Expand Down Expand Up @@ -663,7 +663,7 @@ export interface ChatRoomObject {
/**
* Identifier(s) for the chat - currently unstandardized
*/
id: { [key: string]: any };
id: { [key: string]: string };
/**
* Display name for the chat room
*/
Expand Down Expand Up @@ -702,7 +702,7 @@ export interface ChatRoom {
/**
* Identifier(s) for the chat - currently unstandardized
*/
id: { [key: string]: any };
id: { [key: string]: string };
/**
* Display name for the chat room
*/
Expand Down Expand Up @@ -734,34 +734,31 @@ export interface ChatSearchCriteria {
*
* Empty search criteria can be supported to allow resetting of filters.
*/
criteria: SearchCriteria[];
criteria: Array<OrganizationObject | string>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would the string entail in this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psmulovics Any search string. Easiest to understand from the example here: https://fdc3.finos.org/docs/next/context/ref/ChatSearchCriteria#example

This could be described in the comment of course.

Not actually relevant to this PR, a previous PR missed regenerating these types so these changes are showing up on them all.

type: "fdc3.chat.searchCriteria";
id?: { [key: string]: any };
name?: string;
[property: string]: any;
}

/**
* An individual criteria against which to match chat messages, based on an FDC3 context or
* free-text string.
*
* financial instrument that relates to the definition of this product
* A financial instrument that relates to the definition of this product
*
*
*
* A financial instrument from any asset class.
*
* The contact that initiated the interaction
*
* A person contact that can be engaged with through email, calling, messaging, CMS, etc.
*
* An entity that can be used when referencing private companies and other organizations
* where a specific instrument is not available or desired e.g. CRM and News workflows.
*
* It is valid to include extra properties and metadata as part of the organization payload,
* but the minimum requirement is for at least one specified identifier to be provided.
*
* The contact that initiated the interaction
*
* A person contact that can be engaged with through email, calling, messaging, CMS, etc.
*/
export interface SearchCriteria {
export interface OrganizationObject {
/**
* Any combination of instrument identifiers can be used together to resolve ambiguity, or
* for a better match. Not all applications will use the same instrument identifiers, which
Expand All @@ -777,26 +774,26 @@ export interface SearchCriteria {
* fields, define a property that makes it clear what the value represents. Doing so will
* make interpretation easier for the developers of target applications.
*
* Identifiers that relate to the Contact represented by this context
*
* Identifiers for the organization, at least one must be provided.
*
* Identifiers that relate to the Contact represented by this context
*/
id: Identifiers;
/**
* The `market` map can be used to further specify the instrument and help achieve
* interoperability between disparate data sources. This is especially useful when using an
* `id` field that is not globally unique.
*/
market?: SearchCriteriaMarket;
market?: OrganizationMarket;
/**
* An optional human-readable name for the instrument
*
* An optional human-readable name for the contact
*
* An optional human-readable name of the organization
*
* An optional human-readable name for the contact
*/
name?: string;
type: SearchCriteriaType;
type: TentacledInteractionType;
[property: string]: any;
}

Expand All @@ -815,9 +812,9 @@ export interface SearchCriteria {
* fields, define a property that makes it clear what the value represents. Doing so will
* make interpretation easier for the developers of target applications.
*
* Identifiers that relate to the Contact represented by this context
*
* Identifiers for the organization, at least one must be provided.
*
* Identifiers that relate to the Contact represented by this context
*/
export interface Identifiers {
/**
Expand All @@ -831,9 +828,9 @@ export interface Identifiers {
/**
* https://www.factset.com/
*
* FactSet Permanent Identifier representing the contact
*
* FactSet Permanent Identifier representing the organization
*
* FactSet Permanent Identifier representing the contact
*/
FDS_ID?: string;
/**
Expand Down Expand Up @@ -862,17 +859,17 @@ export interface Identifiers {
* Unstandardized stock tickers
*/
ticker?: string;
/**
* The email address for the contact
*/
email?: string;
/**
* The Legal Entity Identifier (LEI) is a 20-character, alpha-numeric code based on the ISO
* 17442 standard developed by the International Organization for Standardization (ISO). It
* connects to key reference information that enables clear and unique identification of
* legal entities participating in financial transactions.
*/
LEI?: string;
/**
* The email address for the contact
*/
email?: string;
[property: string]: any;
}

Expand All @@ -882,7 +879,7 @@ export interface Identifiers {
* `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or
* `'Meeting'` although other string values are permitted.
*/
export type SearchCriteriaType = "fdc3.instrument" | "fdc3.contact" | "fdc3.organization";
export type TentacledInteractionType = "fdc3.instrument" | "fdc3.organization" | "fdc3.contact";

/**
* Free text to be used for a keyword search
Expand Down Expand Up @@ -1583,7 +1580,7 @@ export interface ProductObject {
*/
id: { [key: string]: string };
/**
* financial instrument that relates to the definition of this product
* A financial instrument that relates to the definition of this product
*/
instrument?: InstrumentElement;
/**
Expand Down Expand Up @@ -1860,7 +1857,7 @@ export interface Product {
*/
id: { [key: string]: string };
/**
* financial instrument that relates to the definition of this product
* A financial instrument that relates to the definition of this product
*/
instrument?: InstrumentElement;
/**
Expand Down Expand Up @@ -2510,9 +2507,9 @@ const typeMap: any = {
], "any"),
"InstrumentElement": o([
{ json: "id", js: "id", typ: r("PurpleInstrumentIdentifiers") },
{ json: "market", js: "market", typ: u(undefined, r("SearchCriteriaMarket")) },
{ json: "market", js: "market", typ: u(undefined, r("OrganizationMarket")) },
{ json: "name", js: "name", typ: u(undefined, "") },
{ json: "type", js: "type", typ: r("InstrumentType") },
{ json: "type", js: "type", typ: r("PurpleInteractionType") },
], "any"),
"PurpleInstrumentIdentifiers": o([
{ json: "BBG", js: "BBG", typ: u(undefined, "") },
Expand All @@ -2525,7 +2522,7 @@ const typeMap: any = {
{ json: "SEDOL", js: "SEDOL", typ: u(undefined, "") },
{ json: "ticker", js: "ticker", typ: u(undefined, "") },
], "any"),
"SearchCriteriaMarket": o([
"OrganizationMarket": o([
{ json: "BBG", js: "BBG", typ: u(undefined, "") },
{ json: "COUNTRY_ISOALPHA2", js: "COUNTRY_ISOALPHA2", typ: u(undefined, "") },
{ json: "MIC", js: "MIC", typ: u(undefined, "") },
Expand Down Expand Up @@ -2556,7 +2553,7 @@ const typeMap: any = {
"ContactElement": o([
{ json: "id", js: "id", typ: r("PurpleContactIdentifiers") },
{ json: "name", js: "name", typ: u(undefined, "") },
{ json: "type", js: "type", typ: r("ContactType") },
{ json: "type", js: "type", typ: r("FluffyInteractionType") },
], "any"),
"PurpleContactIdentifiers": o([
{ json: "email", js: "email", typ: u(undefined, "") },
Expand Down Expand Up @@ -2602,30 +2599,30 @@ const typeMap: any = {
{ json: "name", js: "name", typ: u(undefined, "") },
], "any"),
"ChatRoomObject": o([
{ json: "id", js: "id", typ: m("any") },
{ json: "id", js: "id", typ: m("") },
{ json: "name", js: "name", typ: u(undefined, "") },
{ json: "providerName", js: "providerName", typ: "" },
{ json: "type", js: "type", typ: r("ChatRoomType") },
{ json: "url", js: "url", typ: u(undefined, "") },
], "any"),
"ChatRoom": o([
{ json: "id", js: "id", typ: m("any") },
{ json: "id", js: "id", typ: m("") },
{ json: "name", js: "name", typ: u(undefined, "") },
{ json: "providerName", js: "providerName", typ: "" },
{ json: "type", js: "type", typ: r("ChatRoomType") },
{ json: "url", js: "url", typ: u(undefined, "") },
], "any"),
"ChatSearchCriteria": o([
{ json: "criteria", js: "criteria", typ: a(r("SearchCriteria")) },
{ json: "criteria", js: "criteria", typ: a(u(r("OrganizationObject"), "")) },
{ json: "type", js: "type", typ: r("ChatSearchCriteriaType") },
{ json: "id", js: "id", typ: u(undefined, m("any")) },
{ json: "name", js: "name", typ: u(undefined, "") },
], "any"),
"SearchCriteria": o([
"OrganizationObject": o([
{ json: "id", js: "id", typ: r("Identifiers") },
{ json: "market", js: "market", typ: u(undefined, r("SearchCriteriaMarket")) },
{ json: "market", js: "market", typ: u(undefined, r("OrganizationMarket")) },
{ json: "name", js: "name", typ: u(undefined, "") },
{ json: "type", js: "type", typ: r("SearchCriteriaType") },
{ json: "type", js: "type", typ: r("TentacledInteractionType") },
], "any"),
"Identifiers": o([
{ json: "BBG", js: "BBG", typ: u(undefined, "") },
Expand All @@ -2637,13 +2634,13 @@ const typeMap: any = {
{ json: "RIC", js: "RIC", typ: u(undefined, "") },
{ json: "SEDOL", js: "SEDOL", typ: u(undefined, "") },
{ json: "ticker", js: "ticker", typ: u(undefined, "") },
{ json: "email", js: "email", typ: u(undefined, "") },
{ json: "LEI", js: "LEI", typ: u(undefined, "") },
{ json: "email", js: "email", typ: u(undefined, "") },
], "any"),
"Contact": o([
{ json: "id", js: "id", typ: r("FluffyContactIdentifiers") },
{ json: "name", js: "name", typ: u(undefined, "") },
{ json: "type", js: "type", typ: r("ContactType") },
{ json: "type", js: "type", typ: r("FluffyInteractionType") },
], "any"),
"FluffyContactIdentifiers": o([
{ json: "email", js: "email", typ: u(undefined, "") },
Expand Down Expand Up @@ -2701,7 +2698,7 @@ const typeMap: any = {
{ json: "id", js: "id", typ: r("FluffyInstrumentIdentifiers") },
{ json: "market", js: "market", typ: u(undefined, r("PurpleMarket")) },
{ json: "name", js: "name", typ: u(undefined, "") },
{ json: "type", js: "type", typ: r("InstrumentType") },
{ json: "type", js: "type", typ: r("PurpleInteractionType") },
], "any"),
"FluffyInstrumentIdentifiers": o([
{ json: "BBG", js: "BBG", typ: u(undefined, "") },
Expand Down Expand Up @@ -2805,7 +2802,7 @@ const typeMap: any = {
"Organization": o([
{ json: "id", js: "id", typ: r("OrganizationIdentifiers") },
{ json: "name", js: "name", typ: u(undefined, "") },
{ json: "type", js: "type", typ: r("OrganizationType") },
{ json: "type", js: "type", typ: r("StickyInteractionType") },
], "any"),
"OrganizationIdentifiers": o([
{ json: "FDS_ID", js: "FDS_ID", typ: u(undefined, "") },
Expand Down Expand Up @@ -2884,7 +2881,7 @@ const typeMap: any = {
"ActionType": [
"fdc3.action",
],
"InstrumentType": [
"PurpleInteractionType": [
"fdc3.instrument",
],
"TimeRangeType": [
Expand All @@ -2905,7 +2902,7 @@ const typeMap: any = {
"ChartType": [
"fdc3.chart",
],
"ContactType": [
"FluffyInteractionType": [
"fdc3.contact",
],
"ContactListType": [
Expand All @@ -2927,7 +2924,7 @@ const typeMap: any = {
"ChatMessageType": [
"fdc3.chat.message",
],
"SearchCriteriaType": [
"TentacledInteractionType": [
"fdc3.contact",
"fdc3.instrument",
"fdc3.organization",
Expand Down Expand Up @@ -2966,7 +2963,7 @@ const typeMap: any = {
"OrderListType": [
"fdc3.orderList",
],
"OrganizationType": [
"StickyInteractionType": [
"fdc3.organization",
],
"PositionType": [
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export * from './api/ContextMetadata';
export * from './api/DesktopAgent';
export * from './api/DisplayMetadata';
export * from './api/Errors';
export * from './api/GetAgent';
export * from './api/Icon';
export * from './api/Image';
export * from './api/ImplementationMetadata';
Expand All @@ -42,6 +43,6 @@ export { BrowserTypes };

declare global {
interface Window {
fdc3: DesktopAgent;
fdc3?: DesktopAgent;
}
}