MyGit

v1.1.0

finos/FDC3

版本发布时间: 2021-04-14 22:32:45

finos/FDC3最新发布版本:v2.1(2023-09-14 22:09:37)

The first official release of the @finos/fdc3 npm package, corresponding with the FDC3 Standard v1.1.

Release highlights

API Typings

This release includes TypeScript typings for the FDC3 [DesktopAgent] interface and related types, as well as the window.fdc3 global object, e.g:

import { DesktopAgent, Channel } from '@finos/fdc3'

let channel: Channel;

async function fdc3Action() {
  channel = await window.fdc3.getOrCreateChannel('red');

  // use channel
}

ES6 Imports

The npm package also exposes the FDC3 API operations as ES6 functions that can be imported directly into your code, e.g.:

import { raiseIntent } from '@finos/fdc3'

const instrument = {
  type: 'fdc3.instrument',
  id: {
    ticker: 'AAPL'
  }
};

await raiseIntent('ViewAnalysis', instrument);

These functions will reject or throw appropriately if window.fdc3 is not defined when they are called.

Context Types

The package also includes generated TypeScript types for all standardised FDC3 Context Types, e.g.:

import { Contact } from '@finos/fdc3'

const contact: Contact = {
  type: 'fdc3.contact',
  id: {
    email: 'joe.bloggs@mail.com
  },
  name: 'Joe Bloggs'
};

Also included is a Convert helper object for generating for converting from raw JSON to the relevant type, e.g.:

import { Convert } from '@finos/fdc3'

const json = '{ "type": "fdc3.contact", "id": { "email": "joe.bloggs@mail.com" }, "name": "Joe Bloggs" }';

const contact = Convert.toContact(json);

The typings and conversion helper were generated with QuickType.

Enums for Intents and Context Types

The included Intents and ContextTypes enums provide named constants for the specific intents and context types that have been standardised as part of FDC3 1.1, so that strings don't have to be used:

import { ContextTypes, Intents, raiseIntent } from '@finos/fdc3'

const instrument = {
  type: ContextTypes.Instrument,
  id: {
    ticker: 'AAPL'
  }
}

await raiseIntent(Intents.ViewNews, instrument);

🚀 New Features

🐛 Bug Fix

See CHANGELOG.md for more details.

相关地址:原始地址 下载(tar) 下载(zip)

查看:2021-04-14发行的版本