From e46da42facef00422a36899822fef8a8bf1704ec Mon Sep 17 00:00:00 2001 From: DarkSky Date: Thu, 4 Aug 2022 17:53:59 +0800 Subject: [PATCH] feat: query blocks --- libs/datasource/jwt/src/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libs/datasource/jwt/src/index.ts b/libs/datasource/jwt/src/index.ts index bd01d93dcb..343f1f79ad 100644 --- a/libs/datasource/jwt/src/index.ts +++ b/libs/datasource/jwt/src/index.ts @@ -305,6 +305,18 @@ export class BlockClient< return this._blockIndexer.query(query); } + public queryBlocks(query: QueryIndexMetadata): Promise { + const ids = this.query(query); + return Promise.all( + this._blockIndexer.getMetadata(ids).map(async page => ({ + content: this.get_decoded_content( + await this._adapter.getBlock(page.id) + ), + ...page, + })) + ); + } + /** * Get a fixed name, which has the same UUID in each workspace, and is automatically created when it does not exist * Generally used to store workspace-level global configuration