DataSourceDelegate
@firecms/core / DataSourceDelegate
Interface: DataSourceDelegate
Section titled “Interface: DataSourceDelegate”Defined in: types/datasource.ts:252
Properties
Section titled “Properties”cmsToDelegateModel()
Section titled “cmsToDelegateModel()”cmsToDelegateModel: (
data) =>any
Defined in: types/datasource.ts:396
Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”any
currentTime()?
Section titled “currentTime()?”
optionalcurrentTime: () =>any
Defined in: types/datasource.ts:392
Get the object to generate the current time in the datasource
Returns
Section titled “Returns”any
delegateToCMSModel()
Section titled “delegateToCMSModel()”delegateToCMSModel: (
data) =>any
Defined in: types/datasource.ts:394
Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”any
initialised?
Section titled “initialised?”
optionalinitialised:boolean
Defined in: types/datasource.ts:262
If the data source has been initialised
initTextSearch()?
Section titled “initTextSearch()?”
optionalinitTextSearch: (props) =>Promise<boolean>
Defined in: types/datasource.ts:400
Parameters
Section titled “Parameters”collection
Section titled “collection”context
Section titled “context”databaseId?
Section titled “databaseId?”string
parentCollectionIds?
Section titled “parentCollectionIds?”string[]
string
Returns
Section titled “Returns”Promise<boolean>
key:
string
Defined in: types/datasource.ts:257
Key that identifies this data source delegate
setDateToMidnight()
Section titled “setDateToMidnight()”setDateToMidnight: (
input?) =>any
Defined in: types/datasource.ts:398
Parameters
Section titled “Parameters”input?
Section titled “input?”any
Returns
Section titled “Returns”any
Methods
Section titled “Methods”checkUniqueField()
Section titled “checkUniqueField()”checkUniqueField(
path,name,value,entityId?,collection?):Promise<boolean>
Defined in: types/datasource.ts:369
Check if the given property is unique in the given collection
Parameters
Section titled “Parameters”string
Collection path
string
of the property
any
entityId?
Section titled “entityId?”string
collection?
Section titled “collection?”EntityCollection<any, any>
Returns
Section titled “Returns”Promise<boolean>
true if there are no other fields besides the given entity
countEntities()?
Section titled “countEntities()?”
optionalcountEntities<M>(props):Promise<number>
Defined in: types/datasource.ts:379
Count the number of entities in a collection
Type Parameters
Section titled “Type Parameters”M extends Record<string, any> = any
Parameters
Section titled “Parameters”FetchCollectionDelegateProps<M>
Returns
Section titled “Returns”Promise<number>
deleteEntity()
Section titled “deleteEntity()”deleteEntity<
M>(entity):Promise<void>
Defined in: types/datasource.ts:358
Delete an entity
Type Parameters
Section titled “Type Parameters”M extends Record<string, any> = any
Parameters
Section titled “Parameters”entity
Section titled “entity”Returns
Section titled “Returns”Promise<void>
was the whole deletion flow successful
fetchCollection()
Section titled “fetchCollection()”fetchCollection<
M>(path):Promise<Entity<M>[]>
Defined in: types/datasource.ts:276
Fetch data from a collection
Type Parameters
Section titled “Type Parameters”M extends Record<string, any> = any
Parameters
Section titled “Parameters”FetchCollectionDelegateProps<M>
Returns
Section titled “Returns”Promise<Entity<M>[]>
Function to cancel subscription
useCollectionFetch if you need this functionality implemented as a hook
fetchEntity()
Section titled “fetchEntity()”fetchEntity<
M>(path):Promise<Entity<M> |undefined>
Defined in: types/datasource.ts:318
Retrieve an entity given a path and a collection
Type Parameters
Section titled “Type Parameters”M extends Record<string, any> = any
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<Entity<M> | undefined>
generateEntityId()
Section titled “generateEntityId()”generateEntityId(
path,collection?):string
Defined in: types/datasource.ts:374
Generate an id for a new entity
Parameters
Section titled “Parameters”string
collection?
Section titled “collection?”EntityCollection<any, any>
Returns
Section titled “Returns”string
isFilterCombinationValid()?
Section titled “isFilterCombinationValid()?”
optionalisFilterCombinationValid(props):boolean
Defined in: types/datasource.ts:385
Check if the given filter combination is valid
Parameters
Section titled “Parameters”Omit<FilterCombinationValidProps, "collection"> & object
Returns
Section titled “Returns”boolean
listenCollection()?
Section titled “listenCollection()?”
optionallistenCollection<M>(path): () =>void
Defined in: types/datasource.ts:301
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
Section titled “Type Parameters”M extends Record<string, any> = any
Parameters
Section titled “Parameters”ListenCollectionDelegateProps<M>
Returns
Section titled “Returns”Function to cancel subscription
():
void
Returns
Section titled “Returns”void
useCollectionFetch if you need this functionality implemented as a hook
listenEntity()?
Section titled “listenEntity()?”
optionallistenEntity<M>(path): () =>void
Defined in: types/datasource.ts:332
Get realtime updates on one entity.
Type Parameters
Section titled “Type Parameters”M extends Record<string, any> = any
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Function to cancel subscription
():
void
Returns
Section titled “Returns”void
saveEntity()
Section titled “saveEntity()”saveEntity<
M>(path):Promise<Entity<M>>
Defined in: types/datasource.ts:346
Save entity to the specified path
Type Parameters
Section titled “Type Parameters”M extends Record<string, any> = any
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<Entity<M>>