@openctx/protocol
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -5,3 +5,3 @@ import type { Annotation, Item } from '@openctx/schema'; | ||
*/ | ||
export type Protocol = RequestMessage | ResponseMessage | ResponseError | ProviderSettings | MetaParams | MetaResult | Mention | MentionsParams | MentionsResult | ItemsParams | ItemsResult | AnnotationsParams | AnnotationsResult; | ||
export type Protocol = RequestMessage | ResponseMessage | ResponseError | ProviderSettings | MetaParams | MetaResult | Mention | MentionSelector | AnnotationSelector | MentionsParams | MentionsResult | ItemsParams | ItemsResult | AnnotationsParams | AnnotationsResult; | ||
export type MetaParams = Record<string, never>; | ||
@@ -33,8 +33,2 @@ export type MentionsResult = Mention[]; | ||
/** | ||
* Selects the scope in which this provider should be called. | ||
* | ||
* At least 1 must be satisfied for the provider to be called. If empty, the provider is never called. If undefined, the provider is called on all resources. | ||
*/ | ||
selector?: Selector[]; | ||
/** | ||
* The name of the provider. | ||
@@ -44,27 +38,19 @@ */ | ||
/** | ||
* The features supported by the provider. | ||
* Configuration for the mentions feature. | ||
*/ | ||
features?: { | ||
mentions?: { | ||
/** | ||
* Whether the provider support mentions. | ||
* The list of regex patterns for triggering mentions for the provider when users directly types a matching text, for example a url, allowing the user to bypass choosing the provider manually. | ||
*/ | ||
mentions?: boolean; | ||
selectors?: MentionSelector[]; | ||
}; | ||
} | ||
/** | ||
* Defines a scope in which a provider is called. | ||
* | ||
* To satisfy a selector, all of the selector's conditions must be met. For example, if both `path` and `content` are specified, the resource must satisfy both conditions. | ||
*/ | ||
export interface Selector { | ||
/** | ||
* A glob that must match the resource's hostname and path. | ||
* | ||
* Use `** /` before the glob to match in any parent directory. Use `/**` after the glob to match any resources under a directory. Leading slashes are stripped from the path before being matched against the glob. | ||
* Configuration for the annotations feature. | ||
*/ | ||
path?: string; | ||
/** | ||
* A literal string that must be present in the resource's content. | ||
*/ | ||
contentContains?: string; | ||
annotations?: { | ||
/** | ||
* A list of patterns matching the mention text for which the provider can return mentions | ||
*/ | ||
selectors?: AnnotationSelector[]; | ||
}; | ||
} | ||
@@ -91,2 +77,28 @@ /** | ||
} | ||
/** | ||
* List of regex patterns matching the mention text for which the provider can return mentions. | ||
*/ | ||
export interface MentionSelector { | ||
/** | ||
* The regex pattern matching the mention text for which the provider can return mentions | ||
*/ | ||
pattern: string; | ||
} | ||
/** | ||
* Defines a scope in which a provider is called. | ||
* | ||
* To satisfy a selector, all of the selector's conditions must be met. For example, if both `path` and `content` are specified, the resource must satisfy both conditions. | ||
*/ | ||
export interface AnnotationSelector { | ||
/** | ||
* A glob that must match the resource's hostname and path. | ||
* | ||
* Use `** /` before the glob to match in any parent directory. Use `/**` after the glob to match any resources under a directory. Leading slashes are stripped from the path before being matched against the glob. | ||
*/ | ||
path?: string; | ||
/** | ||
* A literal string that must be present in the resource's content. | ||
*/ | ||
contentContains?: string; | ||
} | ||
export interface MentionsParams { | ||
@@ -93,0 +105,0 @@ /** |
{ | ||
"name": "@openctx/protocol", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "OpenCtx client/provider protocol", | ||
@@ -20,3 +20,3 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@openctx/schema": "0.0.10" | ||
"@openctx/schema": "0.0.11" | ||
}, | ||
@@ -23,0 +23,0 @@ "devDependencies": { |
@@ -30,2 +30,8 @@ { | ||
{ | ||
"$ref": "#/definitions/MentionSelector" | ||
}, | ||
{ | ||
"$ref": "#/definitions/AnnotationSelector" | ||
}, | ||
{ | ||
"$ref": "#/definitions/MentionsParams" | ||
@@ -109,2 +115,29 @@ }, | ||
}, | ||
"MentionSelector": { | ||
"description": "List of regex patterns matching the mention text for which the provider can return mentions.", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": ["pattern"], | ||
"properties": { | ||
"pattern": { | ||
"description": "The regex pattern matching the mention text for which the provider can return mentions", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"AnnotationSelector": { | ||
"description": "Defines a scope in which a provider is called.\n\nTo satisfy a selector, all of the selector's conditions must be met. For example, if both `path` and `content` are specified, the resource must satisfy both conditions.", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"path": { | ||
"description": "A glob that must match the resource's hostname and path.\n\nUse `**/` before the glob to match in any parent directory. Use `/**` after the glob to match any resources under a directory. Leading slashes are stripped from the path before being matched against the glob.", | ||
"type": "string" | ||
}, | ||
"contentContains": { | ||
"description": "A literal string that must be present in the resource's content.", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"MetaResult": { | ||
@@ -115,22 +148,2 @@ "type": "object", | ||
"properties": { | ||
"selector": { | ||
"description": "Selects the scope in which this provider should be called.\n\nAt least 1 must be satisfied for the provider to be called. If empty, the provider is never called. If undefined, the provider is called on all resources.", | ||
"type": "array", | ||
"items": { | ||
"title": "Selector", | ||
"description": "Defines a scope in which a provider is called.\n\nTo satisfy a selector, all of the selector's conditions must be met. For example, if both `path` and `content` are specified, the resource must satisfy both conditions.", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"path": { | ||
"description": "A glob that must match the resource's hostname and path.\n\nUse `**/` before the glob to match in any parent directory. Use `/**` after the glob to match any resources under a directory. Leading slashes are stripped from the path before being matched against the glob.", | ||
"type": "string" | ||
}, | ||
"contentContains": { | ||
"description": "A literal string that must be present in the resource's content.", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"name": { | ||
@@ -140,12 +153,31 @@ "description": "The name of the provider.", | ||
}, | ||
"features": { | ||
"description": "The features supported by the provider.", | ||
"mentions": { | ||
"description": "Configuration for the mentions feature.", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"mentions": { | ||
"description": "Whether the provider support mentions.", | ||
"type": "boolean" | ||
"selectors": { | ||
"description": "The list of regex patterns for triggering mentions for the provider when users directly types a matching text, for example a url, allowing the user to bypass choosing the provider manually.", | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/MentionSelector" | ||
}, | ||
"tsType": "MentionSelector[]" | ||
} | ||
} | ||
}, | ||
"annotations": { | ||
"description": "Configuration for the annotations feature.", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"selectors": { | ||
"description": "A list of patterns matching the mention text for which the provider can return mentions", | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/AnnotationSelector" | ||
}, | ||
"tsType": "AnnotationSelector[]" | ||
} | ||
} | ||
} | ||
@@ -152,0 +184,0 @@ } |
@@ -13,2 +13,4 @@ import type { Annotation, Item } from '@openctx/schema' | ||
| Mention | ||
| MentionSelector | ||
| AnnotationSelector | ||
| MentionsParams | ||
@@ -47,8 +49,2 @@ | MentionsResult | ||
/** | ||
* Selects the scope in which this provider should be called. | ||
* | ||
* At least 1 must be satisfied for the provider to be called. If empty, the provider is never called. If undefined, the provider is called on all resources. | ||
*/ | ||
selector?: Selector[] | ||
/** | ||
* The name of the provider. | ||
@@ -58,27 +54,19 @@ */ | ||
/** | ||
* The features supported by the provider. | ||
* Configuration for the mentions feature. | ||
*/ | ||
features?: { | ||
mentions?: { | ||
/** | ||
* Whether the provider support mentions. | ||
* The list of regex patterns for triggering mentions for the provider when users directly types a matching text, for example a url, allowing the user to bypass choosing the provider manually. | ||
*/ | ||
mentions?: boolean | ||
selectors?: MentionSelector[] | ||
} | ||
} | ||
/** | ||
* Defines a scope in which a provider is called. | ||
* | ||
* To satisfy a selector, all of the selector's conditions must be met. For example, if both `path` and `content` are specified, the resource must satisfy both conditions. | ||
*/ | ||
export interface Selector { | ||
/** | ||
* A glob that must match the resource's hostname and path. | ||
* | ||
* Use `** /` before the glob to match in any parent directory. Use `/**` after the glob to match any resources under a directory. Leading slashes are stripped from the path before being matched against the glob. | ||
* Configuration for the annotations feature. | ||
*/ | ||
path?: string | ||
/** | ||
* A literal string that must be present in the resource's content. | ||
*/ | ||
contentContains?: string | ||
annotations?: { | ||
/** | ||
* A list of patterns matching the mention text for which the provider can return mentions | ||
*/ | ||
selectors?: AnnotationSelector[] | ||
} | ||
} | ||
@@ -105,2 +93,28 @@ /** | ||
} | ||
/** | ||
* List of regex patterns matching the mention text for which the provider can return mentions. | ||
*/ | ||
export interface MentionSelector { | ||
/** | ||
* The regex pattern matching the mention text for which the provider can return mentions | ||
*/ | ||
pattern: string | ||
} | ||
/** | ||
* Defines a scope in which a provider is called. | ||
* | ||
* To satisfy a selector, all of the selector's conditions must be met. For example, if both `path` and `content` are specified, the resource must satisfy both conditions. | ||
*/ | ||
export interface AnnotationSelector { | ||
/** | ||
* A glob that must match the resource's hostname and path. | ||
* | ||
* Use `** /` before the glob to match in any parent directory. Use `/**` after the glob to match any resources under a directory. Leading slashes are stripped from the path before being matched against the glob. | ||
*/ | ||
path?: string | ||
/** | ||
* A literal string that must be present in the resource's content. | ||
*/ | ||
contentContains?: string | ||
} | ||
export interface MentionsParams { | ||
@@ -107,0 +121,0 @@ /** |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
30150
542
0
+ Added@openctx/schema@0.0.11(transitive)
- Removed@openctx/schema@0.0.10(transitive)
Updated@openctx/schema@0.0.11