Clean up search-common/search-backend-node APIs, indicating beta.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2022-03-01 14:21:23 +01:00
parent 37b9ff3b19
commit 0547246b84
14 changed files with 120 additions and 70 deletions
+10 -30
View File
@@ -11,33 +11,25 @@ import { Readable } from 'stream';
import { Transform } from 'stream';
import { Writable } from 'stream';
// Warning: (ae-missing-release-tag) "DocumentCollatorFactory" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
// @beta
export interface DocumentCollatorFactory {
getCollator(): Promise<Readable>;
readonly type: string;
readonly visibilityPermission?: Permission;
}
// Warning: (ae-missing-release-tag) "DocumentDecoratorFactory" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
// @beta
export interface DocumentDecoratorFactory {
getDecorator(): Promise<Transform>;
readonly types?: string[];
}
// Warning: (ae-missing-release-tag) "DocumentTypeInfo" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
// @beta
export type DocumentTypeInfo = {
visibilityPermission?: Permission;
};
// Warning: (ae-missing-release-tag) "IndexableDocument" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
// @beta
export interface IndexableDocument {
authorization?: {
resourceRef: string;
@@ -47,21 +39,15 @@ export interface IndexableDocument {
title: string;
}
// Warning: (ae-missing-release-tag) "QueryRequestOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @beta
export type QueryRequestOptions = {
token?: string;
};
// Warning: (ae-missing-release-tag) "QueryTranslator" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
// @beta
export type QueryTranslator = (query: SearchQuery) => unknown;
// Warning: (ae-missing-release-tag) "SearchEngine" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
// @beta
export interface SearchEngine {
getIndexer(type: string): Promise<Writable>;
query(
@@ -71,9 +57,7 @@ export interface SearchEngine {
setTranslator(translator: QueryTranslator): void;
}
// Warning: (ae-missing-release-tag) "SearchQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @beta (undocumented)
export interface SearchQuery {
// (undocumented)
filters?: JsonObject;
@@ -85,9 +69,7 @@ export interface SearchQuery {
types?: string[];
}
// Warning: (ae-missing-release-tag) "SearchResult" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @beta (undocumented)
export interface SearchResult {
// (undocumented)
document: IndexableDocument;
@@ -95,9 +77,7 @@ export interface SearchResult {
type: string;
}
// Warning: (ae-missing-release-tag) "SearchResultSet" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @beta (undocumented)
export interface SearchResultSet {
// (undocumented)
nextPageCursor?: string;
+19
View File
@@ -18,6 +18,9 @@ import { Permission } from '@backstage/plugin-permission-common';
import { JsonObject } from '@backstage/types';
import { Readable, Transform, Writable } from 'stream';
/**
* @beta
*/
export interface SearchQuery {
term: string;
filters?: JsonObject;
@@ -25,11 +28,17 @@ export interface SearchQuery {
pageCursor?: string;
}
/**
* @beta
*/
export interface SearchResult {
type: string;
document: IndexableDocument;
}
/**
* @beta
*/
export interface SearchResultSet {
results: SearchResult[];
nextPageCursor?: string;
@@ -39,6 +48,7 @@ export interface SearchResultSet {
/**
* Base properties that all indexed documents must include, as well as some
* common properties that documents are encouraged to use where appropriate.
* @beta
*/
export interface IndexableDocument {
/**
@@ -73,6 +83,7 @@ export interface IndexableDocument {
* Information about a specific document type. Intended to be used in the
* {@link @backstage/search-backend-node#IndexBuilder} to collect information
* about the types stored in the index.
* @beta
*/
export type DocumentTypeInfo = {
/**
@@ -84,6 +95,7 @@ export type DocumentTypeInfo = {
/**
* Factory class for instantiating collators.
* @beta
*/
export interface DocumentCollatorFactory {
/**
@@ -106,6 +118,7 @@ export interface DocumentCollatorFactory {
/**
* Factory class for instantiating decorators.
* @beta
*/
export interface DocumentDecoratorFactory {
/**
@@ -124,9 +137,14 @@ export interface DocumentDecoratorFactory {
/**
* A type of function responsible for translating an abstract search query into
* a concrete query relevant to a particular search engine.
* @beta
*/
export type QueryTranslator = (query: SearchQuery) => unknown;
/**
* Options when querying a search engine.
* @beta
*/
export type QueryRequestOptions = {
token?: string;
};
@@ -135,6 +153,7 @@ export type QueryRequestOptions = {
* Interface that must be implemented by specific search engines, responsible
* for performing indexing and querying and translating abstract queries into
* concrete, search engine-specific queries.
* @beta
*/
export interface SearchEngine {
/**