@backstage/plugin-search-backend-module-pg 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @backstage/plugin-search-backend-module-pg
2
2
 
3
+ ## 0.2.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix for the previous release with missing type declarations.
8
+ - Updated dependencies
9
+ - @backstage/backend-common@0.10.9
10
+ - @backstage/search-common@0.2.4
11
+ - @backstage/plugin-search-backend-node@0.4.7
12
+
3
13
  ## 0.2.7
4
14
 
5
15
  ### Patch Changes
@@ -0,0 +1,59 @@
1
+ import { IndexableDocument, SearchQuery, SearchResultSet } from '@backstage/search-common';
2
+ import { Knex } from 'knex';
3
+ import { PluginDatabaseManager } from '@backstage/backend-common';
4
+ import { SearchEngine } from '@backstage/plugin-search-backend-node';
5
+
6
+ interface PgSearchQuery {
7
+ fields?: Record<string, string | string[]>;
8
+ types?: string[];
9
+ pgTerm?: string;
10
+ offset: number;
11
+ limit: number;
12
+ }
13
+ interface DatabaseStore {
14
+ transaction<T>(fn: (tx: Knex.Transaction) => Promise<T>): Promise<T>;
15
+ prepareInsert(tx: Knex.Transaction): Promise<void>;
16
+ insertDocuments(tx: Knex.Transaction, type: string, documents: IndexableDocument[]): Promise<void>;
17
+ completeInsert(tx: Knex.Transaction, type: string): Promise<void>;
18
+ query(tx: Knex.Transaction, pgQuery: PgSearchQuery): Promise<DocumentResultRow[]>;
19
+ }
20
+ interface RawDocumentRow {
21
+ document: IndexableDocument;
22
+ type: string;
23
+ hash: unknown;
24
+ }
25
+ interface DocumentResultRow {
26
+ document: IndexableDocument;
27
+ type: string;
28
+ }
29
+
30
+ declare class DatabaseDocumentStore implements DatabaseStore {
31
+ private readonly db;
32
+ static create(knex: Knex): Promise<DatabaseDocumentStore>;
33
+ static supported(knex: Knex): Promise<boolean>;
34
+ constructor(db: Knex);
35
+ transaction<T>(fn: (tx: Knex.Transaction) => Promise<T>): Promise<T>;
36
+ prepareInsert(tx: Knex.Transaction): Promise<void>;
37
+ completeInsert(tx: Knex.Transaction, type: string): Promise<void>;
38
+ insertDocuments(tx: Knex.Transaction, type: string, documents: IndexableDocument[]): Promise<void>;
39
+ query(tx: Knex.Transaction, { types, pgTerm, fields, offset, limit }: PgSearchQuery): Promise<DocumentResultRow[]>;
40
+ }
41
+
42
+ declare type ConcretePgSearchQuery = {
43
+ pgQuery: PgSearchQuery;
44
+ pageSize: number;
45
+ };
46
+ declare class PgSearchEngine implements SearchEngine {
47
+ private readonly databaseStore;
48
+ constructor(databaseStore: DatabaseStore);
49
+ static from(options: {
50
+ database: PluginDatabaseManager;
51
+ }): Promise<PgSearchEngine>;
52
+ static supported(database: PluginDatabaseManager): Promise<boolean>;
53
+ translator(query: SearchQuery): ConcretePgSearchQuery;
54
+ setTranslator(translator: (query: SearchQuery) => ConcretePgSearchQuery): void;
55
+ index(type: string, documents: IndexableDocument[]): Promise<void>;
56
+ query(query: SearchQuery): Promise<SearchResultSet>;
57
+ }
58
+
59
+ export { ConcretePgSearchQuery, DatabaseDocumentStore, DatabaseStore, PgSearchEngine, PgSearchQuery, RawDocumentRow };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-backend-module-pg",
3
3
  "description": "A module for the search backend that implements search using PostgreSQL",
4
- "version": "0.2.7",
4
+ "version": "0.2.8",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -23,9 +23,9 @@
23
23
  "clean": "backstage-cli package clean"
24
24
  },
25
25
  "dependencies": {
26
- "@backstage/backend-common": "^0.10.8",
27
- "@backstage/plugin-search-backend-node": "^0.4.6",
28
- "@backstage/search-common": "^0.2.3",
26
+ "@backstage/backend-common": "^0.10.9",
27
+ "@backstage/plugin-search-backend-node": "^0.4.7",
28
+ "@backstage/search-common": "^0.2.4",
29
29
  "knex": "^1.0.2",
30
30
  "lodash": "^4.17.21"
31
31
  },
@@ -37,5 +37,5 @@
37
37
  "dist",
38
38
  "migrations"
39
39
  ],
40
- "gitHead": "4805c3d13ce9bfc369e53c271b1b95e722b3b4dc"
40
+ "gitHead": "e244b348c473700e7d5e5fbcef38bd9f9fd1d0ba"
41
41
  }