@backstage/plugin-search-backend-module-elasticsearch 0.0.9 → 0.0.10

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,14 @@
1
1
  # @backstage/plugin-search-backend-module-elasticsearch
2
2
 
3
+ ## 0.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix for the previous release with missing type declarations.
8
+ - Updated dependencies
9
+ - @backstage/config@0.1.15
10
+ - @backstage/search-common@0.2.4
11
+
3
12
  ## 0.0.9
4
13
 
5
14
  ### Patch Changes
@@ -0,0 +1,138 @@
1
+ /// <reference types="node" />
2
+ import { Config } from '@backstage/config';
3
+ import { SearchEngine, SearchQuery, IndexableDocument, SearchResultSet } from '@backstage/search-common';
4
+ import { Logger } from 'winston';
5
+ import { ConnectionOptions } from 'tls';
6
+
7
+ /**
8
+ * Options used to configure the `@elastic/elasticsearch` client and
9
+ * are what will be passed as an argument to the
10
+ * {@link ElasticSearchEngine.newClient} method
11
+ *
12
+ * They are drawn from the `ClientOptions` class of `@elastic/elasticsearch`,
13
+ * but are maintained separately so that this interface is not coupled to
14
+ */
15
+ interface ElasticSearchClientOptions {
16
+ provider?: 'aws' | 'elastic';
17
+ node?: string | string[] | ElasticSearchNodeOptions | ElasticSearchNodeOptions[];
18
+ nodes?: string | string[] | ElasticSearchNodeOptions | ElasticSearchNodeOptions[];
19
+ Transport?: ElasticSearchTransportConstructor;
20
+ Connection?: ElasticSearchConnectionConstructor;
21
+ maxRetries?: number;
22
+ requestTimeout?: number;
23
+ pingTimeout?: number;
24
+ sniffInterval?: number | boolean;
25
+ sniffOnStart?: boolean;
26
+ sniffEndpoint?: string;
27
+ sniffOnConnectionFault?: boolean;
28
+ resurrectStrategy?: 'ping' | 'optimistic' | 'none';
29
+ suggestCompression?: boolean;
30
+ compression?: 'gzip';
31
+ ssl?: ConnectionOptions;
32
+ agent?: ElasticSearchAgentOptions | ((opts?: any) => unknown) | false;
33
+ nodeFilter?: (connection: any) => boolean;
34
+ nodeSelector?: ((connections: any[]) => any) | string;
35
+ headers?: Record<string, any>;
36
+ opaqueIdPrefix?: string;
37
+ name?: string | symbol;
38
+ auth?: ElasticSearchAuth;
39
+ proxy?: string | URL;
40
+ enableMetaHeader?: boolean;
41
+ cloud?: {
42
+ id: string;
43
+ username?: string;
44
+ password?: string;
45
+ };
46
+ disablePrototypePoisoningProtection?: boolean | 'proto' | 'constructor';
47
+ }
48
+ declare type ElasticSearchAuth = {
49
+ username: string;
50
+ password: string;
51
+ } | {
52
+ apiKey: string | {
53
+ id: string;
54
+ api_key: string;
55
+ };
56
+ };
57
+ interface ElasticSearchNodeOptions {
58
+ url: URL;
59
+ id?: string;
60
+ agent?: ElasticSearchAgentOptions;
61
+ ssl?: ConnectionOptions;
62
+ headers?: Record<string, any>;
63
+ roles?: {
64
+ master: boolean;
65
+ data: boolean;
66
+ ingest: boolean;
67
+ ml: boolean;
68
+ };
69
+ }
70
+ interface ElasticSearchAgentOptions {
71
+ keepAlive?: boolean;
72
+ keepAliveMsecs?: number;
73
+ maxSockets?: number;
74
+ maxFreeSockets?: number;
75
+ }
76
+ interface ElasticSearchConnectionConstructor {
77
+ new (opts?: any): any;
78
+ statuses: {
79
+ ALIVE: string;
80
+ DEAD: string;
81
+ };
82
+ roles: {
83
+ MASTER: string;
84
+ DATA: string;
85
+ INGEST: string;
86
+ ML: string;
87
+ };
88
+ }
89
+ interface ElasticSearchTransportConstructor {
90
+ new (opts?: any): any;
91
+ sniffReasons: {
92
+ SNIFF_ON_START: string;
93
+ SNIFF_INTERVAL: string;
94
+ SNIFF_ON_CONNECTION_FAULT: string;
95
+ DEFAULT: string;
96
+ };
97
+ }
98
+
99
+ declare type ConcreteElasticSearchQuery = {
100
+ documentTypes?: string[];
101
+ elasticSearchQuery: Object;
102
+ pageSize: number;
103
+ };
104
+ declare type ElasticSearchQueryTranslator = (query: SearchQuery) => ConcreteElasticSearchQuery;
105
+ declare type ElasticSearchOptions = {
106
+ logger: Logger;
107
+ config: Config;
108
+ aliasPostfix?: string;
109
+ indexPrefix?: string;
110
+ };
111
+ /**
112
+ * @public
113
+ */
114
+ declare class ElasticSearchSearchEngine implements SearchEngine {
115
+ private readonly elasticSearchClientOptions;
116
+ private readonly aliasPostfix;
117
+ private readonly indexPrefix;
118
+ private readonly logger;
119
+ private readonly elasticSearchClient;
120
+ constructor(elasticSearchClientOptions: ElasticSearchClientOptions, aliasPostfix: string, indexPrefix: string, logger: Logger);
121
+ static fromConfig({ logger, config, aliasPostfix, indexPrefix, }: ElasticSearchOptions): Promise<ElasticSearchSearchEngine>;
122
+ /**
123
+ * Create a custom search client from the derived elastic search
124
+ * configuration. This need not be the same client that the engine uses
125
+ * internally.
126
+ */
127
+ newClient<T>(create: (options: ElasticSearchClientOptions) => T): T;
128
+ protected translator(query: SearchQuery): ConcreteElasticSearchQuery;
129
+ setTranslator(translator: ElasticSearchQueryTranslator): void;
130
+ index(type: string, documents: IndexableDocument[]): Promise<void>;
131
+ query(query: SearchQuery): Promise<SearchResultSet>;
132
+ private readonly indexSeparator;
133
+ private constructIndexName;
134
+ private getTypeFromIndex;
135
+ private constructSearchAlias;
136
+ }
137
+
138
+ export { ElasticSearchClientOptions, ElasticSearchSearchEngine };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-backend-module-elasticsearch",
3
3
  "description": "A module for the search backend that implements search using ElasticSearch",
4
- "version": "0.0.9",
4
+ "version": "0.0.10",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@acuris/aws-es-connection": "^2.2.0",
27
- "@backstage/config": "^0.1.14",
28
- "@backstage/search-common": "^0.2.3",
27
+ "@backstage/config": "^0.1.15",
28
+ "@backstage/search-common": "^0.2.4",
29
29
  "@elastic/elasticsearch": "7.13.0",
30
30
  "aws-sdk": "^2.948.0",
31
31
  "elastic-builder": "^2.16.0",
@@ -33,7 +33,7 @@
33
33
  "winston": "^3.2.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@backstage/backend-common": "^0.10.8",
36
+ "@backstage/backend-common": "^0.10.9",
37
37
  "@backstage/cli": "^0.14.0",
38
38
  "@elastic/elasticsearch-mock": "^1.0.0"
39
39
  },
@@ -45,5 +45,5 @@
45
45
  "testEnvironment": "node"
46
46
  },
47
47
  "configSchema": "config.d.ts",
48
- "gitHead": "4805c3d13ce9bfc369e53c271b1b95e722b3b4dc"
48
+ "gitHead": "e244b348c473700e7d5e5fbcef38bd9f9fd1d0ba"
49
49
  }