
Parsifly Docs
IDoc
IDoc Represents a reference to a single Document (e.g., 'project' or 'page-123').
parsifly-extension-base / index / IDoc
Interface: IDoc<T>
Defined in: lib/data-providers/index.ts:59
IDoc Represents a reference to a single Document (e.g., 'project' or 'page-123').
Type Parameters
T
T
The type of the document data.
Methods
collection()
collection<
U>(path):ICollection<U>
Defined in: lib/data-providers/index.ts:111
Gets a reference to a sub-collection nested under this Document.
Type Parameters
U
U = any
Parameters
path
string
The name of the sub-collection (e.g., 'pages').
Returns
ICollection<U>
An ICollection reference.
Example
const pagesCollection = provider.doc('project').collection<IPage>('pages');
delete()
delete():
Promise<void>
Defined in: lib/data-providers/index.ts:93
Deletes the Document.
Returns
Promise<void>
A Promise that resolves when the operation is complete.
Example
await provider.doc<IPage>('pages').doc('p1').delete();
field()
field<
K>(key):IField<T[K]>
Defined in: lib/data-providers/index.ts:102
Gets a reference to a specific field within this Document.
Type Parameters
K
K extends string | number | symbol
Parameters
key
The key of the field.
K | string & object
Returns
IField<T[K]>
An IField reference.
Example
const nameField = provider.doc('project').field('name');
set()
set(
data):Promise<void>
Defined in: lib/data-providers/index.ts:75
Overwrites the Document with new data.
Parameters
data
T
The new data to set.
Returns
Promise<void>
A Promise that resolves when the operation is complete.
Example
await provider.doc<IProject>('project').set({ id: 'proj', name: 'New Project' });
update()
update(
data):Promise<void>
Defined in: lib/data-providers/index.ts:85
Updates specific fields of the Document without overwriting the entire document. Note: Implementation maps to 'set' in this model.
Parameters
data
Partial<T>
The partial data to update.
Returns
Promise<void>
A Promise that resolves when the operation is complete.
Example
await provider.doc<IPage>('pages').doc('p1').update({ name: 'Updated Page Name' });
value()
value():
Promise<T>
Defined in: lib/data-providers/index.ts:66
Retrieves the current data of the Document.
Returns
Promise<T>
A Promise that resolves with the Document data.
Example
const project = await provider.doc<IProject>('project').value();