@backstage/plugin-search-backend-module-elasticsearch 1.1.5-next.0 → 1.2.0-next.2

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,31 @@
1
1
  # @backstage/plugin-search-backend-module-elasticsearch
2
2
 
3
+ ## 1.2.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/backend-common@0.18.4-next.2
9
+ - @backstage/backend-plugin-api@0.5.1-next.2
10
+ - @backstage/config@1.0.7
11
+ - @backstage/plugin-search-backend-node@1.2.0-next.2
12
+ - @backstage/plugin-search-common@1.2.3-next.0
13
+
14
+ ## 1.2.0-next.1
15
+
16
+ ### Minor Changes
17
+
18
+ - 1469daa409e: Search backend modules migrated to the new backend system. For documentation on how to migrate, check out the [how to migrate to the new backend system guide](https://backstage.io/docs/features/search/how-to-guides/#how-to-migrate-your-backend-installation-to-use-search-together-with-the-new-backend-system).
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+ - @backstage/plugin-search-backend-node@1.2.0-next.1
24
+ - @backstage/backend-common@0.18.4-next.1
25
+ - @backstage/backend-plugin-api@0.5.1-next.1
26
+ - @backstage/config@1.0.7
27
+ - @backstage/plugin-search-common@1.2.3-next.0
28
+
3
29
  ## 1.1.5-next.0
4
30
 
5
31
  ### Patch Changes
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@backstage/plugin-search-backend-module-elasticsearch",
3
+ "version": "1.2.0-next.2",
4
+ "main": "../dist/alpha.cjs.js",
5
+ "types": "../dist/alpha.d.ts"
6
+ }
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var backendPluginApi = require('@backstage/backend-plugin-api');
6
+ var backendCommon = require('@backstage/backend-common');
7
+ var alpha = require('@backstage/plugin-search-backend-node/alpha');
8
+ var pluginSearchBackendModuleElasticsearch = require('@backstage/plugin-search-backend-module-elasticsearch');
9
+
10
+ const searchModuleElasticsearchEngine = backendPluginApi.createBackendModule(
11
+ (options) => ({
12
+ moduleId: "elasticsearchEngine",
13
+ pluginId: "search",
14
+ register(env) {
15
+ env.registerInit({
16
+ deps: {
17
+ searchEngineRegistry: alpha.searchEngineRegistryExtensionPoint,
18
+ logger: backendPluginApi.coreServices.logger,
19
+ config: backendPluginApi.coreServices.config
20
+ },
21
+ async init({ searchEngineRegistry, logger, config }) {
22
+ const searchEngine = await pluginSearchBackendModuleElasticsearch.ElasticSearchSearchEngine.fromConfig({
23
+ logger: backendCommon.loggerToWinstonLogger(logger),
24
+ config
25
+ });
26
+ if (options == null ? void 0 : options.translator) {
27
+ searchEngine.setTranslator(options.translator);
28
+ }
29
+ if (options == null ? void 0 : options.indexTemplate) {
30
+ searchEngine.setIndexTemplate(options.indexTemplate);
31
+ }
32
+ searchEngineRegistry.setSearchEngine(searchEngine);
33
+ }
34
+ });
35
+ }
36
+ })
37
+ );
38
+
39
+ exports.searchModuleElasticsearchEngine = searchModuleElasticsearchEngine;
40
+ //# sourceMappingURL=alpha.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alpha.cjs.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { loggerToWinstonLogger } from '@backstage/backend-common';\nimport { searchEngineRegistryExtensionPoint } from '@backstage/plugin-search-backend-node/alpha';\n\nimport {\n ElasticSearchCustomIndexTemplate,\n ElasticSearchQueryTranslator,\n ElasticSearchSearchEngine,\n} from '@backstage/plugin-search-backend-module-elasticsearch';\n\n/**\n * @alpha\n * Options for {@link searchModuleElasticsearchEngine}.\n */\nexport type SearchModuleElasticsearchEngineOptions = {\n translator?: ElasticSearchQueryTranslator;\n indexTemplate?: ElasticSearchCustomIndexTemplate;\n};\n\n/**\n * @alpha\n * Search backend module for the Elasticsearch engine.\n */\nexport const searchModuleElasticsearchEngine = createBackendModule(\n (options?: SearchModuleElasticsearchEngineOptions) => ({\n moduleId: 'elasticsearchEngine',\n pluginId: 'search',\n register(env) {\n env.registerInit({\n deps: {\n searchEngineRegistry: searchEngineRegistryExtensionPoint,\n logger: coreServices.logger,\n config: coreServices.config,\n },\n async init({ searchEngineRegistry, logger, config }) {\n const searchEngine = await ElasticSearchSearchEngine.fromConfig({\n logger: loggerToWinstonLogger(logger),\n config: config,\n });\n\n // set custom translator if available\n if (options?.translator) {\n searchEngine.setTranslator(options.translator);\n }\n\n // set custom index template if available\n if (options?.indexTemplate) {\n searchEngine.setIndexTemplate(options.indexTemplate);\n }\n\n searchEngineRegistry.setSearchEngine(searchEngine);\n },\n });\n },\n }),\n);\n"],"names":["createBackendModule","searchEngineRegistryExtensionPoint","coreServices","ElasticSearchSearchEngine","loggerToWinstonLogger"],"mappings":";;;;;;;;;AAyCO,MAAM,+BAAkC,GAAAA,oCAAA;AAAA,EAC7C,CAAC,OAAsD,MAAA;AAAA,IACrD,QAAU,EAAA,qBAAA;AAAA,IACV,QAAU,EAAA,QAAA;AAAA,IACV,SAAS,GAAK,EAAA;AACZ,MAAA,GAAA,CAAI,YAAa,CAAA;AAAA,QACf,IAAM,EAAA;AAAA,UACJ,oBAAsB,EAAAC,wCAAA;AAAA,UACtB,QAAQC,6BAAa,CAAA,MAAA;AAAA,UACrB,QAAQA,6BAAa,CAAA,MAAA;AAAA,SACvB;AAAA,QACA,MAAM,IAAK,CAAA,EAAE,oBAAsB,EAAA,MAAA,EAAQ,QAAU,EAAA;AACnD,UAAM,MAAA,YAAA,GAAe,MAAMC,gEAAA,CAA0B,UAAW,CAAA;AAAA,YAC9D,MAAA,EAAQC,oCAAsB,MAAM,CAAA;AAAA,YACpC,MAAA;AAAA,WACD,CAAA,CAAA;AAGD,UAAA,IAAI,mCAAS,UAAY,EAAA;AACvB,YAAa,YAAA,CAAA,aAAA,CAAc,QAAQ,UAAU,CAAA,CAAA;AAAA,WAC/C;AAGA,UAAA,IAAI,mCAAS,aAAe,EAAA;AAC1B,YAAa,YAAA,CAAA,gBAAA,CAAiB,QAAQ,aAAa,CAAA,CAAA;AAAA,WACrD;AAEA,UAAA,oBAAA,CAAqB,gBAAgB,YAAY,CAAA,CAAA;AAAA,SACnD;AAAA,OACD,CAAA,CAAA;AAAA,KACH;AAAA,GACF,CAAA;AACF;;;;"}
@@ -0,0 +1,18 @@
1
+ import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
2
+ import { ElasticSearchQueryTranslator, ElasticSearchCustomIndexTemplate } from '@backstage/plugin-search-backend-module-elasticsearch';
3
+
4
+ /**
5
+ * @alpha
6
+ * Options for {@link searchModuleElasticsearchEngine}.
7
+ */
8
+ type SearchModuleElasticsearchEngineOptions = {
9
+ translator?: ElasticSearchQueryTranslator;
10
+ indexTemplate?: ElasticSearchCustomIndexTemplate;
11
+ };
12
+ /**
13
+ * @alpha
14
+ * Search backend module for the Elasticsearch engine.
15
+ */
16
+ declare const searchModuleElasticsearchEngine: (options?: SearchModuleElasticsearchEngineOptions | undefined) => _backstage_backend_plugin_api.BackendFeature;
17
+
18
+ export { SearchModuleElasticsearchEngineOptions, searchModuleElasticsearchEngine };
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ declare const isOpenSearchCompatible: (opts: ElasticSearchClientOptions) => opts
27
27
  *
28
28
  * @public
29
29
  */
30
- declare type ElasticSearchClientOptions = ElasticSearchElasticSearchClientOptions | OpenSearchElasticSearchClientOptions;
30
+ type ElasticSearchClientOptions = ElasticSearchElasticSearchClientOptions | OpenSearchElasticSearchClientOptions;
31
31
  /**
32
32
  * Options used to configure the `@opensearch-project/opensearch` client.
33
33
  *
@@ -95,14 +95,14 @@ interface BaseElasticSearchClientOptions {
95
95
  /**
96
96
  * @public
97
97
  */
98
- declare type OpenSearchAuth = {
98
+ type OpenSearchAuth = {
99
99
  username: string;
100
100
  password: string;
101
101
  };
102
102
  /**
103
103
  * @public
104
104
  */
105
- declare type ElasticSearchAuth = OpenSearchAuth | {
105
+ type ElasticSearchAuth = OpenSearchAuth | {
106
106
  apiKey: string | {
107
107
  id: string;
108
108
  api_key: string;
@@ -196,7 +196,7 @@ interface ElasticSearchTransportConstructor {
196
196
  * Elasticsearch specific index template
197
197
  * @public
198
198
  */
199
- declare type ElasticSearchCustomIndexTemplate = {
199
+ type ElasticSearchCustomIndexTemplate = {
200
200
  name: string;
201
201
  body: ElasticSearchCustomIndexTemplateBody;
202
202
  };
@@ -204,7 +204,7 @@ declare type ElasticSearchCustomIndexTemplate = {
204
204
  * Elasticsearch specific index template body
205
205
  * @public
206
206
  */
207
- declare type ElasticSearchCustomIndexTemplateBody = {
207
+ type ElasticSearchCustomIndexTemplateBody = {
208
208
  /**
209
209
  * Array of wildcard (*) expressions used to match the names of data streams and indices during creation.
210
210
  */
@@ -225,7 +225,7 @@ declare type ElasticSearchCustomIndexTemplateBody = {
225
225
  /**
226
226
  * @public
227
227
  */
228
- declare type ElasticSearchAliasAction = {
228
+ type ElasticSearchAliasAction = {
229
229
  remove: {
230
230
  index: any;
231
231
  alias: any;
@@ -249,7 +249,7 @@ declare type ElasticSearchAliasAction = {
249
249
  /**
250
250
  * @public
251
251
  */
252
- declare type ElasticSearchIndexAction = {
252
+ type ElasticSearchIndexAction = {
253
253
  index: {
254
254
  _index: string;
255
255
  [key: string]: any;
@@ -306,7 +306,7 @@ declare class ElasticSearchClientWrapper {
306
306
  * Options for instantiate ElasticSearchSearchEngineIndexer
307
307
  * @public
308
308
  */
309
- declare type ElasticSearchSearchEngineIndexerOptions = {
309
+ type ElasticSearchSearchEngineIndexerOptions = {
310
310
  type: string;
311
311
  indexPrefix: string;
312
312
  indexSeparator: string;
@@ -352,7 +352,7 @@ declare class ElasticSearchSearchEngineIndexer extends BatchSearchEngineIndexer
352
352
  * Search query that the elasticsearch engine understands.
353
353
  * @public
354
354
  */
355
- declare type ElasticSearchConcreteQuery = {
355
+ type ElasticSearchConcreteQuery = {
356
356
  documentTypes?: string[];
357
357
  elasticSearchQuery: Object;
358
358
  pageSize: number;
@@ -361,19 +361,19 @@ declare type ElasticSearchConcreteQuery = {
361
361
  * Options available for the Elasticsearch specific query translator.
362
362
  * @public
363
363
  */
364
- declare type ElasticSearchQueryTranslatorOptions = {
364
+ type ElasticSearchQueryTranslatorOptions = {
365
365
  highlightOptions?: ElasticSearchHighlightConfig;
366
366
  };
367
367
  /**
368
368
  * Elasticsearch specific query translator.
369
369
  * @public
370
370
  */
371
- declare type ElasticSearchQueryTranslator = (query: SearchQuery, options?: ElasticSearchQueryTranslatorOptions) => ElasticSearchConcreteQuery;
371
+ type ElasticSearchQueryTranslator = (query: SearchQuery, options?: ElasticSearchQueryTranslatorOptions) => ElasticSearchConcreteQuery;
372
372
  /**
373
373
  * Options for instantiate ElasticSearchSearchEngine
374
374
  * @public
375
375
  */
376
- declare type ElasticSearchOptions = {
376
+ type ElasticSearchOptions = {
377
377
  logger: Logger;
378
378
  config: Config;
379
379
  aliasPostfix?: string;
@@ -382,7 +382,7 @@ declare type ElasticSearchOptions = {
382
382
  /**
383
383
  * @public
384
384
  */
385
- declare type ElasticSearchHighlightOptions = {
385
+ type ElasticSearchHighlightOptions = {
386
386
  fragmentDelimiter?: string;
387
387
  fragmentSize?: number;
388
388
  numFragments?: number;
@@ -390,7 +390,7 @@ declare type ElasticSearchHighlightOptions = {
390
390
  /**
391
391
  * @public
392
392
  */
393
- declare type ElasticSearchHighlightConfig = {
393
+ type ElasticSearchHighlightConfig = {
394
394
  fragmentDelimiter: string;
395
395
  fragmentSize: number;
396
396
  numFragments: number;
package/package.json CHANGED
@@ -1,14 +1,25 @@
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": "1.1.5-next.0",
5
- "main": "dist/index.cjs.js",
6
- "types": "dist/index.d.ts",
4
+ "version": "1.2.0-next.2",
5
+ "main": "./dist/index.cjs.js",
6
+ "types": "./dist/index.d.ts",
7
7
  "license": "Apache-2.0",
8
8
  "publishConfig": {
9
- "access": "public",
10
- "main": "dist/index.cjs.js",
11
- "types": "dist/index.d.ts"
9
+ "access": "public"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "require": "./dist/index.cjs.js",
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.cjs.js"
16
+ },
17
+ "./alpha": {
18
+ "require": "./dist/alpha.cjs.js",
19
+ "types": "./dist/alpha.d.ts",
20
+ "default": "./dist/alpha.cjs.js"
21
+ },
22
+ "./package.json": "./package.json"
12
23
  },
13
24
  "backstage": {
14
25
  "role": "backend-plugin-module"
@@ -23,9 +34,11 @@
23
34
  "clean": "backstage-cli package clean"
24
35
  },
25
36
  "dependencies": {
37
+ "@backstage/backend-common": "^0.18.4-next.2",
38
+ "@backstage/backend-plugin-api": "^0.5.1-next.2",
26
39
  "@backstage/config": "^1.0.7",
27
- "@backstage/plugin-search-backend-node": "^1.1.5-next.0",
28
- "@backstage/plugin-search-common": "^1.2.2",
40
+ "@backstage/plugin-search-backend-node": "^1.2.0-next.2",
41
+ "@backstage/plugin-search-common": "^1.2.3-next.0",
29
42
  "@elastic/elasticsearch": "^7.13.0",
30
43
  "@opensearch-project/opensearch": "^2.0.0",
31
44
  "aws-os-connection": "^0.2.0",
@@ -36,14 +49,15 @@
36
49
  "winston": "^3.2.1"
37
50
  },
38
51
  "devDependencies": {
39
- "@backstage/backend-common": "^0.18.4-next.0",
40
- "@backstage/cli": "^0.22.6-next.0",
52
+ "@backstage/backend-common": "^0.18.4-next.2",
53
+ "@backstage/cli": "^0.22.6-next.2",
41
54
  "@elastic/elasticsearch-mock": "^1.0.0",
42
55
  "@short.io/opensearch-mock": "^0.3.1"
43
56
  },
44
57
  "files": [
45
58
  "dist",
46
- "config.d.ts"
59
+ "config.d.ts",
60
+ "alpha"
47
61
  ],
48
62
  "configSchema": "config.d.ts"
49
63
  }