From 6b967c9743182b593a751fb1e8995866bb4efb0e Mon Sep 17 00:00:00 2001 From: Naman Kumar Date: Fri, 26 Jul 2024 11:06:24 +0200 Subject: [PATCH] Add query selector config --- lib/protocol/src/openctx-protocol.schema.json | 27 +++++++++++++++++++ lib/protocol/src/openctx-protocol.schema.ts | 9 +++++++ 2 files changed, 36 insertions(+) diff --git a/lib/protocol/src/openctx-protocol.schema.json b/lib/protocol/src/openctx-protocol.schema.json index cf9240b0..6dc0fbd2 100644 --- a/lib/protocol/src/openctx-protocol.schema.json +++ b/lib/protocol/src/openctx-protocol.schema.json @@ -104,6 +104,18 @@ } } }, + "QuerySelector": { + "description": "List of regex patterns matching the query for which the provider can return context items.", + "type": "object", + "additionalProperties": false, + "required": ["pattern"], + "properties": { + "pattern": { + "description": "The regex pattern matching the query for which the provider can return context items", + "type": "string" + } + } + }, "MetaParams": { "type": "object", "additionalProperties": false, @@ -147,6 +159,21 @@ "description": "The name of the provider.", "type": "string" }, + "items": { + "description": "Configuration for providing context items.", + "type": "object", + "additionalProperties": false, + "properties": { + "querySelectors": { + "description": "The list of regex patterns for matching with a query for which the provider can return context items", + "type": "array", + "items": { + "$ref": "#/definitions/QuerySelector" + }, + "tsType": "QuerySelector[]" + } + } + }, "mentions": { "description": "Configuration for the mentions feature.", "type": "object", diff --git a/lib/protocol/src/openctx-protocol.schema.ts b/lib/protocol/src/openctx-protocol.schema.ts index 36c0dace..5d480850 100644 --- a/lib/protocol/src/openctx-protocol.schema.ts +++ b/lib/protocol/src/openctx-protocol.schema.ts @@ -48,6 +48,15 @@ export interface MetaResult { * The name of the provider. */ name: string + /** + * Configuration for providing context items. + */ + items?: { + /** + * The list of regex patterns for matching with a query for which the provider can return context items + */ + querySelectors?: QuerySelector[] + } /** * Configuration for the mentions feature. */