From 6a001acf8c69b645e398631874cde8a2f053db6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 19 Aug 2022 12:31:26 +0200 Subject: [PATCH] plugin-search-backend-module-pg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../search-backend-module-pg/api-report.md | 26 +++++++------------ .../src/PgSearchEngine/PgSearchEngine.ts | 2 ++ .../PgSearchEngine/PgSearchEngineIndexer.ts | 2 ++ .../src/PgSearchEngine/index.ts | 1 + .../src/database/DatabaseDocumentStore.ts | 1 + .../src/database/index.ts | 8 +++++- .../src/database/types.ts | 4 +++ scripts/api-extractor.ts | 1 - 8 files changed, 27 insertions(+), 18 deletions(-) diff --git a/plugins/search-backend-module-pg/api-report.md b/plugins/search-backend-module-pg/api-report.md index 33d0f4318c..d35bac66aa 100644 --- a/plugins/search-backend-module-pg/api-report.md +++ b/plugins/search-backend-module-pg/api-report.md @@ -18,8 +18,6 @@ export type ConcretePgSearchQuery = { pageSize: number; }; -// Warning: (ae-missing-release-tag) "DatabaseDocumentStore" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export class DatabaseDocumentStore implements DatabaseStore { constructor(db: Knex); @@ -39,8 +37,6 @@ export class DatabaseDocumentStore implements DatabaseStore { ): Promise; // (undocumented) prepareInsert(tx: Knex.Transaction): Promise; - // Warning: (ae-forgotten-export) The symbol "DocumentResultRow" needs to be exported by the entry point index.d.ts - // // (undocumented) query( tx: Knex.Transaction, @@ -52,8 +48,6 @@ export class DatabaseDocumentStore implements DatabaseStore { transaction(fn: (tx: Knex.Transaction) => Promise): Promise; } -// Warning: (ae-missing-release-tag) "DatabaseStore" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface DatabaseStore { // (undocumented) @@ -77,8 +71,16 @@ export interface DatabaseStore { transaction(fn: (tx: Knex.Transaction) => Promise): Promise; } -// Warning: (ae-missing-release-tag) "PgSearchEngine" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// +// @public (undocumented) +export interface DocumentResultRow { + // (undocumented) + document: IndexableDocument; + // (undocumented) + highlight: IndexableDocument; + // (undocumented) + type: string; +} + // @public (undocumented) export class PgSearchEngine implements SearchEngine { // @deprecated @@ -108,8 +110,6 @@ export class PgSearchEngine implements SearchEngine { ): ConcretePgSearchQuery; } -// Warning: (ae-missing-release-tag) "PgSearchEngineIndexer" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export class PgSearchEngineIndexer extends BatchSearchEngineIndexer { constructor(options: PgSearchEngineIndexerOptions); @@ -121,8 +121,6 @@ export class PgSearchEngineIndexer extends BatchSearchEngineIndexer { initialize(): Promise; } -// Warning: (ae-missing-release-tag) "PgSearchEngineIndexerOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type PgSearchEngineIndexerOptions = { batchSize: number; @@ -148,8 +146,6 @@ export type PgSearchOptions = { database: PluginDatabaseManager; }; -// Warning: (ae-missing-release-tag) "PgSearchQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface PgSearchQuery { // (undocumented) @@ -177,8 +173,6 @@ export type PgSearchQueryTranslatorOptions = { highlightOptions: PgSearchHighlightOptions; }; -// Warning: (ae-missing-release-tag) "RawDocumentRow" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export interface RawDocumentRow { // (undocumented) diff --git a/plugins/search-backend-module-pg/src/PgSearchEngine/PgSearchEngine.ts b/plugins/search-backend-module-pg/src/PgSearchEngine/PgSearchEngine.ts index cd99a8c4b1..01fe0fff82 100644 --- a/plugins/search-backend-module-pg/src/PgSearchEngine/PgSearchEngine.ts +++ b/plugins/search-backend-module-pg/src/PgSearchEngine/PgSearchEngine.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { PluginDatabaseManager } from '@backstage/backend-common'; import { SearchEngine } from '@backstage/plugin-search-common'; import { @@ -79,6 +80,7 @@ export type PgSearchHighlightOptions = { postTag: string; }; +/** @public */ export class PgSearchEngine implements SearchEngine { private readonly highlightOptions: PgSearchHighlightOptions; diff --git a/plugins/search-backend-module-pg/src/PgSearchEngine/PgSearchEngineIndexer.ts b/plugins/search-backend-module-pg/src/PgSearchEngine/PgSearchEngineIndexer.ts index fa27509a69..e3dbe82751 100644 --- a/plugins/search-backend-module-pg/src/PgSearchEngine/PgSearchEngineIndexer.ts +++ b/plugins/search-backend-module-pg/src/PgSearchEngine/PgSearchEngineIndexer.ts @@ -19,12 +19,14 @@ import { IndexableDocument } from '@backstage/plugin-search-common'; import { Knex } from 'knex'; import { DatabaseStore } from '../database'; +/** @public */ export type PgSearchEngineIndexerOptions = { batchSize: number; type: string; databaseStore: DatabaseStore; }; +/** @public */ export class PgSearchEngineIndexer extends BatchSearchEngineIndexer { private store: DatabaseStore; private type: string; diff --git a/plugins/search-backend-module-pg/src/PgSearchEngine/index.ts b/plugins/search-backend-module-pg/src/PgSearchEngine/index.ts index e9ea04e5c4..e62e709f26 100644 --- a/plugins/search-backend-module-pg/src/PgSearchEngine/index.ts +++ b/plugins/search-backend-module-pg/src/PgSearchEngine/index.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export { PgSearchEngine } from './PgSearchEngine'; export type { ConcretePgSearchQuery, diff --git a/plugins/search-backend-module-pg/src/database/DatabaseDocumentStore.ts b/plugins/search-backend-module-pg/src/database/DatabaseDocumentStore.ts index 4da3cca082..023992a335 100644 --- a/plugins/search-backend-module-pg/src/database/DatabaseDocumentStore.ts +++ b/plugins/search-backend-module-pg/src/database/DatabaseDocumentStore.ts @@ -32,6 +32,7 @@ const migrationsDir = resolvePackagePath( 'migrations', ); +/** @public */ export class DatabaseDocumentStore implements DatabaseStore { static async create( database: PluginDatabaseManager, diff --git a/plugins/search-backend-module-pg/src/database/index.ts b/plugins/search-backend-module-pg/src/database/index.ts index d2ca3ba3da..69441d56ec 100644 --- a/plugins/search-backend-module-pg/src/database/index.ts +++ b/plugins/search-backend-module-pg/src/database/index.ts @@ -13,5 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export { DatabaseDocumentStore } from './DatabaseDocumentStore'; -export type { DatabaseStore, PgSearchQuery, RawDocumentRow } from './types'; +export type { + DatabaseStore, + DocumentResultRow, + PgSearchQuery, + RawDocumentRow, +} from './types'; diff --git a/plugins/search-backend-module-pg/src/database/types.ts b/plugins/search-backend-module-pg/src/database/types.ts index 151be7d13f..f330651cef 100644 --- a/plugins/search-backend-module-pg/src/database/types.ts +++ b/plugins/search-backend-module-pg/src/database/types.ts @@ -17,6 +17,7 @@ import { IndexableDocument } from '@backstage/plugin-search-common'; import { Knex } from 'knex'; import { PgSearchHighlightOptions } from '../PgSearchEngine'; +/** @public */ export interface PgSearchQuery { fields?: Record; types?: string[]; @@ -26,6 +27,7 @@ export interface PgSearchQuery { options: PgSearchHighlightOptions; } +/** @public */ export interface DatabaseStore { transaction(fn: (tx: Knex.Transaction) => Promise): Promise; getTransaction(): Promise; @@ -42,12 +44,14 @@ export interface DatabaseStore { ): Promise; } +/** @public */ export interface RawDocumentRow { document: IndexableDocument; type: string; hash: unknown; } +/** @public */ export interface DocumentResultRow { document: IndexableDocument; type: string; diff --git a/scripts/api-extractor.ts b/scripts/api-extractor.ts index 4713d85487..fd1254b07d 100644 --- a/scripts/api-extractor.ts +++ b/scripts/api-extractor.ts @@ -230,7 +230,6 @@ const ALLOW_WARNINGS = [ 'plugins/newrelic', 'plugins/newrelic-dashboard', 'plugins/pagerduty', - 'plugins/search-backend-module-pg', ]; async function resolvePackagePath(