From 921e05d26092f6dbf5a4a302c4ac251944d5d008 Mon Sep 17 00:00:00 2001 From: streamich Date: Sat, 27 Apr 2024 12:21:59 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20define=20.scan()=20CRUD?= =?UTF-8?q?=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/crud/types.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/crud/types.ts b/src/crud/types.ts index 13a100c8..1f39554c 100644 --- a/src/crud/types.ts +++ b/src/crud/types.ts @@ -46,6 +46,14 @@ export interface CrudApi { */ drop: (collection: CrudCollection, silent?: boolean) => Promise; + /** + * 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; + /** * Fetches a list of resources of a collection, and sub-collections. * @@ -84,8 +92,3 @@ export interface CrudResourceInfo extends CrudCollectionEntry { /** Timestamp when the resource was created. */ created?: number; } - -export interface CrudScanResult { - cursor: string | ''; - list: CrudCollectionEntry[]; -}