Skip to content

Commit

Permalink
feat: 🎸 define .scan() CRUD method
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Apr 27, 2024
1 parent 577ee35 commit 921e05d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/crud/types.ts
Expand Up @@ -46,6 +46,14 @@ export interface CrudApi {
*/
drop: (collection: CrudCollection, silent?: boolean) => Promise<void>;

/**
* Iterates over all resources of a collection.
*
* @param collection Type of the resource, collection name.
* @returns Iterator of resources of the given type.
*/
scan: (collection: CrudCollection) => AsyncIterableIterator<CrudCollectionEntry>;

/**
* Fetches a list of resources of a collection, and sub-collections.
*
Expand Down Expand Up @@ -84,8 +92,3 @@ export interface CrudResourceInfo extends CrudCollectionEntry {
/** Timestamp when the resource was created. */
created?: number;
}

export interface CrudScanResult {
cursor: string | '';
list: CrudCollectionEntry[];
}

0 comments on commit 921e05d

Please sign in to comment.