Skip to main content
Version: 3.0.0-beta

Interface: DataSourceDelegate

Properties​

authenticated?​

optional authenticated: boolean

If the user is authenticated to use the data source

Defined in​

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


cmsToDelegateModel()​

cmsToDelegateModel: (data) => any

Parameters​

• data: any

Returns​

any

Defined in​

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


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:396


delegateToCMSModel()​

delegateToCMSModel: (data) => any

Parameters​

• data: any

Returns​

any

Defined in​

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


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:404


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:402

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:373


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:383


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:362


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:280


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:322


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:378


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:389


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:305


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:336


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:350

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