DataSource
Esta página aún no está disponible en tu idioma.
@firecms/core / DataSource
Interface: DataSource
Section titled “Interface: DataSource”Defined in: types/datasource.ts:75
Component in charge of communicating with the data source. Usually you won’t need to implement this interface, but a DataSourceDelegate instead.
Properties
Section titled “Properties”initTextSearch()?
Section titled “initTextSearch()?”
optionalinitTextSearch: (props) =>Promise<boolean>
Defined in: types/datasource.ts:230
Called when the user clicks on the search bar in a collection view. Useful for initializing a text search index.
Parameters
Section titled “Parameters”collection
Section titled “collection”context
Section titled “context”parentCollectionIds?
Section titled “parentCollectionIds?”string[]
string
Returns
Section titled “Returns”Promise<boolean>
Methods
Section titled “Methods”checkUniqueField()
Section titled “checkUniqueField()”checkUniqueField(
path,name,value,entityId?,collection?):Promise<boolean>
Defined in: types/datasource.ts:201
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:217
Count the number of entities in a collection
Type Parameters
Section titled “Type Parameters”M extends Record<string, any> = any
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<number>
deleteEntity()
Section titled “deleteEntity()”deleteEntity<
M>(entity):Promise<void>
Defined in: types/datasource.ts:185
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:90
Fetch data from 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>[]>
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:139
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:212
Generate an id for a new entity
Parameters
Section titled “Parameters”string
collection
Section titled “collection”Returns
Section titled “Returns”string
isFilterCombinationValid()?
Section titled “isFilterCombinationValid()?”
optionalisFilterCombinationValid(props):boolean
Defined in: types/datasource.ts:223
Check if the given filter combination is valid
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
listenCollection()?
Section titled “listenCollection()?”
optionallistenCollection<M>(path): () =>void
Defined in: types/datasource.ts:118
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”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:156
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:171
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>>