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

[SERVICE-875] Create @types module for runtime-based FDC3 #1

Open
wants to merge 11 commits into
base: fdc3
Choose a base branch
from
53 changes: 53 additions & 0 deletions types/openfin-fdc3/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Type definitions for openfin-fdc3-global 0.2
pjbroadbent marked this conversation as resolved.
Show resolved Hide resolved
// Project: https://github.com/HadoukenIO/fdc3-service#readme
// Definitions by: bryangaleOF <https://github.com/bryangaleOF>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

// Minimum TypeScript Version: 3.0

/*
* Overview
* When running within the OpenFin Runtime, and the `fdc3Api` flag in your manifest is set, your web applications will
* have access to the "fdc3" namespace without the need to include additional source files. You can treat the "fdc3"
* namespace as you would the "window", "navigator" or "document" objects. This is an alternative to using the
* "openfin-fdc3" NPM package.
*/
pjbroadbent marked this conversation as resolved.
Show resolved Hide resolved
declare namespace fdc3 {
type AppChannel = import('./internal/main').AppChannel;
type AppDirIntent = import('./internal/main').AppDirIntent;
type AppId = import('./internal/main').AppId;
type AppImage = import('./internal/main').AppImage;
type AppIntent = import('./internal/main').AppIntent;
type AppName = import('./internal/main').AppName;
type Application = import('./internal/main').Application;
type ApplicationError = import('./internal/main').ApplicationError;
type Channel = import('./internal/main').Channel;
type ChannelBase = import('./internal/main').ChannelBase;
type ChannelChangedEvent = import('./internal/main').ChannelChangedEvent;
type ChannelContextListener = import('./internal/main').ChannelContextListener;
type ChannelError = import('./internal/main').ChannelError;
type ChannelId = import('./internal/main').ChannelId;
type ChannelWindowAddedEvent = import('./internal/main').ChannelWindowAddedEvent;
type ChannelWindowRemovedEvent = import('./internal/main').ChannelWindowRemovedEvent;
type ConnectionError = import('./internal/main').ConnectionError;
type ContactContext = import('./internal/main').ContactContext;
type Context = import('./internal/main').Context;
type ContextListener = import('./internal/main').ContextListener;
type DefaultChannel = import('./internal/main').DefaultChannel;
type DisplayMetadata = import('./internal/main').DisplayMetadata;
type FDC3Error = import('./internal/main').FDC3Error;
type Icon = import('./internal/main').Icon;
type InstrumentContext = import('./internal/main').InstrumentContext;
type IntentListener = import('./internal/main').IntentListener;
type IntentMetadata = import('./internal/main').IntentMetadata;
type IntentResolution = import('./internal/main').IntentResolution;
type Intents = import('./internal/main').Intents;
type Listener = import('./internal/main').Listener;
type NameValuePair = import('./internal/main').NameValuePair;
type OrganizationContext = import('./internal/main').OrganizationContext;
type ResolveError = import('./internal/main').ResolveError;
type SendContextError = import('./internal/main').SendContextError;
type SystemChannel = import('./internal/main').SystemChannel;
}

declare const fdc3: typeof import('./internal/main');
116 changes: 116 additions & 0 deletions types/openfin-fdc3/internal/context.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/**
* TypeScript definitions for context objects.
*
* These structures are defined by the Contexts FDC3 working group. This contains the Context interface for you to create your own
* contexts, as well as a set of standard contexts agreed by the FDC3 working group.
*/
/**
* General-purpose context type, as defined by [FDC3](https://fdc3.finos.org/docs/1.0/context-intro).
* A context object is a well-understood datum that is streamable between FDC3 participants. As a result
* it has a field describing what type it is, and data indicating its identity. Use this as a base
* to derive your own with any custom properties or metadata.
*/
export interface Context {
/**
* The type of the context that uniquely identifies it, e.g. "fdc3.instrument".
* This is used to refer to the accepted context(s) when declaring intents. See [[AppDirIntent]].
*/
type: string;
/**
* The name of the context data (optional). This is a text string that describes the data being sent.
* Implementors of context may choose to make the name mandatory.
*/
name?: string;
/**
* An optional map of any equivalent identifiers for the context type, e.g. ISIN, CUSIP, etc. for an instrument.
*/
id?: {
[key: string]: string | undefined;
};
}
/**
* Built-in context to define a contact.
*/
export interface ContactContext extends Context {
/**
* The context type is always 'fdc3.contact'.
*/
type: 'fdc3.contact';
/**
* Free text name of the contact.
*/
name: string;
/**
* The contact data. Can contain some or all of:
* * `email`: Email address
* * `twitter`: Twitter handle
* * `phone`: Phone number
*/
id: {
[key: string]: string;
} & {
email?: string;
twitter?: string;
phone?: string;
};
}
/**
* Built-in context to define a financial instrument.
*/
export interface InstrumentContext extends Context {
/**
* The context type is always 'fdc3.instrument'.
*/
type: 'fdc3.instrument';
/**
* Optional free text name of the instrument.
*/
name?: string;
/**
* The instrument data. Can contain some or all of:
* * `ticker`: a ticker
* * `ISIN`: [ISIN](https://www.isin.org/isin/)
* * `CUSIP`: [CUSIP](https://www.cusip.com/cusip/index.htm)
* * `SEDOL`: [SEDOL](https://www.londonstockexchange.com/products-and-services/reference-data/sedol-master-file/sedol-master-file.htm)
* * `RIC`: [Reuters Instrument Code (RIC)](https://en.wikipedia.org/wiki/Reuters_Instrument_Code)
* * `BBG`: [Bloomberg Ticker](https://www.bloomberg.com/professional/product/market-data/)
* * `PERMID`: [PERMID](https://permid.org/)
* * `FIGI`: [FIGI](https://www.openfigi.com/about/figi)
*/
id: {
[key: string]: string;
} & {
ticker?: string;
ISIN?: string;
CUSIP?: string;
SEDOL?: string;
RIC?: string;
BBG?: string;
PERMID?: string;
FIGI?: string;
};
}
/**
* Built-in context to define an organization.
*/
export interface OrganizationContext extends Context {
/**
* The context type is always fdc3.organization.
*/
type: 'fdc3.organization';
/**
* Optional free text name of the organization.
*/
name?: string;
/**
* The organization data. Can contain either or both
* * `LEI`: [LEI](https://www.gleif.org/en/about-lei/introducing-the-legal-entity-identifier-lei)
* * `PERMID`: [PERMID](https://permid.org/)
*/
id: {
[key: string]: string;
} & {
LEI?: string;
PERMID?: string;
};
}
Loading