@financial-times/biz-ops-utils v0.0.1-beta.7
@financial-times/biz-ops-utils
A small collection of utilities used by both the Biz Ops Admin application directly and by @financial-times/biz-ops-view.
They may be useful when constructing complex user interfaces from Biz Ops components.
Requirements
- node 14+
- npm 7+
Installation
npm i @financial-times/biz-ops-utils
API
markdownToHtml(string)
Converts a string of markdown to html using settings common to the whole Biz Ops ecosystem
constants
An object of useful constants:
{
// List of the base data types of our GraphQL implementations that contain temporal information
TEMPORAL_TYPES: ['Date', 'Time', 'DateTime'],
// List of the base data types of our GraphQL implementations that contain numeric information
NUMBER_TYPES: ['Int', 'Float'],
}
hasValue(value, propDef)
Used to determine if a property retrieved from the Biz Ops GraphQL API contains a value. It takes into account the type of data expected in the property.
Parameters
value
- the value to be testedpropDef
- the definition of the property being inspected, as defined in Biz Ops Schema
graphqlFragment()
Used to generate a fragment of GraphQL that can be used to construct a valid Biz Ops GraphQL query to retrieve data for a property.
Parameters
propName
- the name of the propertypropDef
- the definition of the property being queried, as defined in Biz Ops SchemauseRichRelationships
default:true
- whether or not to query for relationships using a structure that surfaces properties defined on the relationships as well as data about the record at the other end of the relationship
getComponentAssigner()
Deliberately left undocumented for now - the API is not really mature and usage is discouraged apart from in Biz Ops Admin and @financial-times/biz-ops-view, its only 2 consumers at present.
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago