Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat: query blocks

DarkSkye46da42facef
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<BlockSearchItem[]> {
+ 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