Skip to main content
Version: 3.0.0-beta

Interface: DataSourceDelegate

Properties​

cmsToDelegateModel()​

cmsToDelegateModel: (data) => any

Parameters​

• data: any

Returns​

any

Defined in​

packages/firecms_core/src/types/datasource.ts:395


currentTime()?​

optional currentTime: () => any

Get the object to generate the current time in the datasource

Returns​

any

Defined in​

packages/firecms_core/src/types/datasource.ts:391


delegateToCMSModel()​

delegateToCMSModel: (data) => any

Parameters​

• data: any

Returns​

any

Defined in​

packages/firecms_core/src/types/datasource.ts:393


initTextSearch()?​

optional initTextSearch: (props) => Promise<boolean>

Parameters​

• props

• props.collection: EntityCollection<any, any>

• props.context: FireCMSContext

• props.databaseId?: string

• props.parentCollectionIds?: string[]

• props.path: string

Returns​

Promise<boolean>

Defined in​

packages/firecms_core/src/types/datasource.ts:399


initialised?​

optional initialised: boolean

If the data source has been initialised

Defined in​

packages/firecms_core/src/types/datasource.ts:261


key​

key: string

Key that identifies this data source delegate

Defined in​

packages/firecms_core/src/types/datasource.ts:256


setDateToMidnight()​

setDateToMidnight: (input?) => any

Parameters​

• input?: any

Returns​

any

Defined in​

packages/firecms_core/src/types/datasource.ts:397

Methods​

checkUniqueField()​

checkUniqueField(path, name, value, entityId?, collection?): Promise<boolean>

Check if the given property is unique in the given collection

Parameters​

• path: string

Collection path

• name: string

of the property

• value: any

• entityId?: string

• collection?: EntityCollection<any, any>

Returns​

Promise<boolean>

true if there are no other fields besides the given entity

Defined in​

packages/firecms_core/src/types/datasource.ts:368


countEntities()?​

optional countEntities<M>(props): Promise<number>

Count the number of entities in a collection

Type Parameters​

• M extends Record<string, any> = any

Parameters​

• props: FetchCollectionDelegateProps<M>

Returns​

Promise<number>

Defined in​

packages/firecms_core/src/types/datasource.ts:378


deleteEntity()​

deleteEntity<M>(entity): Promise<void>

Delete an entity

Type Parameters​

• M extends Record<string, any> = any

Parameters​

• entity: DeleteEntityProps<M>

Returns​

Promise<void>

was the whole deletion flow successful

Defined in​

packages/firecms_core/src/types/datasource.ts:357


fetchCollection()​

fetchCollection<M>(__namedParameters): Promise<Entity<M>[]>

Fetch data from a collection

Type Parameters​

• M extends Record<string, any> = any

Parameters​

• __namedParameters: FetchCollectionDelegateProps<M>

Returns​

Promise<Entity<M>[]>

Function to cancel subscription

See​

useCollectionFetch if you need this functionality implemented as a hook

Defined in​

packages/firecms_core/src/types/datasource.ts:275


fetchEntity()​

fetchEntity<M>(__namedParameters): Promise<Entity<M>>

Retrieve an entity given a path and a collection

Type Parameters​

• M extends Record<string, any> = any

Parameters​

• __namedParameters: FetchEntityProps<M>

Returns​

Promise<Entity<M>>

Defined in​

packages/firecms_core/src/types/datasource.ts:317


generateEntityId()​

generateEntityId(path, collection?): string

Generate an id for a new entity

Parameters​

• path: string

• collection?: EntityCollection<any, any>

Returns​

string

Defined in​

packages/firecms_core/src/types/datasource.ts:373


isFilterCombinationValid()?​

optional isFilterCombinationValid(props): boolean

Check if the given filter combination is valid

Parameters​

• props: Omit<FilterCombinationValidProps, "collection"> & object

Returns​

boolean

Defined in​

packages/firecms_core/src/types/datasource.ts:384


listenCollection()?​

optional listenCollection<M>(__namedParameters): () => void

Listen to a collection in a given path. If you don't implement this method fetchCollection will be used instead, with no real time updates.

Type Parameters​

• M extends Record<string, any> = any

Parameters​

• __namedParameters: ListenCollectionDelegateProps<M>

Returns​

Function

Function to cancel subscription

Returns​

void

See​

useCollectionFetch if you need this functionality implemented as a hook

Defined in​

packages/firecms_core/src/types/datasource.ts:300


listenEntity()?​

optional listenEntity<M>(__namedParameters): () => void

Get realtime updates on one entity.

Type Parameters​

• M extends Record<string, any> = any

Parameters​

• __namedParameters: ListenEntityProps<M>

Returns​

Function

Function to cancel subscription

Returns​

void

Defined in​

packages/firecms_core/src/types/datasource.ts:331


saveEntity()​

saveEntity<M>(__namedParameters): Promise<Entity<M>>

Save entity to the specified path

Type Parameters​

• M extends Record<string, any> = any

Parameters​

• __namedParameters: SaveEntityDelegateProps<M>

Returns​

Promise<Entity<M>>

Defined in​

packages/firecms_core/src/types/datasource.ts:345

Sign up to our newsletter to get the latest news and updates. No spam!