Zum Inhalt springen

DataSource

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

@firecms/core


@firecms/core / 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.

optional initTextSearch: (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.

EntityCollection

FireCMSContext

string[]

string

Promise<boolean>

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

string

Collection path

string

of the property

any

string

EntityCollection<any, any>

Promise<boolean>

true if there are no other fields besides the given entity


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

Defined in: types/datasource.ts:217

Count the number of entities in a collection

M extends Record<string, any> = any

FetchCollectionProps<M>

Promise<number>


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

Defined in: types/datasource.ts:185

Delete an entity

M extends Record<string, any> = any

DeleteEntityProps<M>

Promise<void>

was the whole deletion flow successful


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

Defined in: types/datasource.ts:90

Fetch data from a collection

M extends Record<string, any> = any

FetchCollectionProps<M>

Promise<Entity<M>[]>

Function to cancel subscription

useCollectionFetch if you need this functionality implemented as a hook


fetchEntity<M>(path): Promise<Entity<M> | undefined>

Defined in: types/datasource.ts:139

Retrieve an entity given a path and a collection

M extends Record<string, any> = any

FetchEntityProps<M>

Promise<Entity<M> | undefined>


generateEntityId(path, collection): string

Defined in: types/datasource.ts:212

Generate an id for a new entity

string

EntityCollection

string


optional isFilterCombinationValid(props): boolean

Defined in: types/datasource.ts:223

Check if the given filter combination is valid

FilterCombinationValidProps

boolean


optional listenCollection<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.

M extends Record<string, any> = any

ListenCollectionProps<M>

Function to cancel subscription

(): void

void

useCollectionFetch if you need this functionality implemented as a hook


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

Defined in: types/datasource.ts:156

Get realtime updates on one entity.

M extends Record<string, any> = any

ListenEntityProps<M>

Function to cancel subscription

(): void

void


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

Defined in: types/datasource.ts:171

Save entity to the specified path

M extends Record<string, any> = any

SaveEntityProps<M>

Promise<Entity<M>>