Skip to main content

Interface: AnnotatedDataProvider<TAnnotatedDataSource, TData, TNormalizedAnnotatedDataSource>

Defined in: storage/base.ts:202

Base interface for data providers opening AnnotatedDataSources

In addition to a DataProvider, an annotated data provider receives the data of the table referenced by the data source, if any, when loading (see AnnotatedDataProviderLoadOptions).

Extends

  • DataProvider<TAnnotatedDataSource, TData, TNormalizedAnnotatedDataSource>

Extended by

Type Parameters

TAnnotatedDataSource

TAnnotatedDataSource extends AnnotatedDataSource

The data source type this data provider opens

TData

TData extends Data

The Data type produced by this data provider

TNormalizedAnnotatedDataSource

TNormalizedAnnotatedDataSource extends TAnnotatedDataSource = TAnnotatedDataSource

The data source type produced by DataProvider.normalize and accepted by AnnotatedDataProvider.load

Properties

name

readonly name: string

Defined in: storage/base.ts:134

The name of the data provider

Inherited from

DataProvider.name


schema

readonly schema: JsonSchema

Defined in: storage/base.ts:137

The JSON schema for the data source

Inherited from

DataProvider.schema


uischema

readonly uischema: UISchemaElement

Defined in: storage/base.ts:140

The JSON Forms UI schema for the data source

Inherited from

DataProvider.uischema

Methods

load()

load(normalizedDataSource, options?): Promise<TData>

Defined in: storage/base.ts:222

Opens a data source and returns the loaded data accessor

The data source has to have been normalized by DataProvider.normalize beforehand.

Parameters

normalizedDataSource

TNormalizedAnnotatedDataSource

The normalized data source to open

options?

AnnotatedDataProviderLoadOptions

See AnnotatedDataProviderLoadOptions

Returns

Promise<TData>

A promise that resolves to the loaded data accessor

Overrides

DataProvider.load


normalize()

normalize(dataSource, projectUrl): TNormalizedAnnotatedDataSource

Defined in: storage/base.ts:159

Returns the data source with all of this data provider's defaults applied and all of its relative URLs resolved

Data sources that normalize to the same value are considered equal, and their data is loaded only once and shared between all referencing objects. Normalization has to be idempotent: normalizing an already normalized data source must return the same value again.

Relative URLs are resolved against the URL the project was loaded from, and against the document base URL for projects without one.

Parameters

dataSource

TAnnotatedDataSource

The data source to normalize

projectUrl

string | null

The absolute URL of the project, or null for projects that were not loaded from a URL

Returns

TNormalizedAnnotatedDataSource

The normalized data source

Inherited from

DataProvider.normalize