@backstage/plugin-search-backend 1.5.8-next.2 → 1.5.9
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 +21 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +6 -5
- package/dist/alpha.cjs.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @backstage/plugin-search-backend
|
|
2
2
|
|
|
3
|
+
## 1.5.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f4ba235: Split backend search plugin startup into "init" and "start" stages to ensure necessary initialization has happened before startup
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-search-backend-node@1.2.23
|
|
10
|
+
|
|
11
|
+
## 1.5.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- c6cb568: Add lifecycle monitoring for the search index registry
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/repo-tools@0.9.0
|
|
18
|
+
- @backstage/backend-common@0.22.0
|
|
19
|
+
- @backstage/backend-plugin-api@0.6.18
|
|
20
|
+
- @backstage/plugin-search-backend-node@1.2.22
|
|
21
|
+
- @backstage/backend-openapi-utils@0.1.11
|
|
22
|
+
- @backstage/plugin-permission-node@0.7.29
|
|
23
|
+
|
|
3
24
|
## 1.5.8-next.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.cjs.js
CHANGED
|
@@ -97,12 +97,13 @@ var alpha = backendPluginApi.createBackendPlugin({
|
|
|
97
97
|
}
|
|
98
98
|
const collators = searchIndexRegistry.getCollators();
|
|
99
99
|
const decorators = searchIndexRegistry.getDecorators();
|
|
100
|
+
searchIndexService.init({
|
|
101
|
+
searchEngine,
|
|
102
|
+
collators,
|
|
103
|
+
decorators
|
|
104
|
+
});
|
|
100
105
|
lifecycle.addStartupHook(async () => {
|
|
101
|
-
await searchIndexService.start(
|
|
102
|
-
searchEngine,
|
|
103
|
-
collators,
|
|
104
|
-
decorators
|
|
105
|
-
});
|
|
106
|
+
await searchIndexService.start();
|
|
106
107
|
});
|
|
107
108
|
lifecycle.addShutdownHook(async () => {
|
|
108
109
|
await searchIndexService.stop();
|
package/dist/alpha.cjs.js.map
CHANGED
|
@@ -1 +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 */\n\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport {\n LunrSearchEngine,\n RegisterCollatorParameters,\n RegisterDecoratorParameters,\n SearchEngine,\n} from '@backstage/plugin-search-backend-node';\nimport {\n SearchEngineRegistryExtensionPoint,\n searchEngineRegistryExtensionPoint,\n searchIndexRegistryExtensionPoint,\n SearchIndexRegistryExtensionPoint,\n searchIndexServiceRef,\n} from '@backstage/plugin-search-backend-node/alpha';\n\nimport { createRouter } from './service/router';\n\nclass SearchIndexRegistry implements SearchIndexRegistryExtensionPoint {\n private collators: RegisterCollatorParameters[] = [];\n private decorators: RegisterDecoratorParameters[] = [];\n\n public addCollator(options: RegisterCollatorParameters): void {\n this.collators.push(options);\n }\n\n public addDecorator(options: RegisterDecoratorParameters): void {\n this.decorators.push(options);\n }\n\n public getCollators(): RegisterCollatorParameters[] {\n return this.collators;\n }\n\n public getDecorators(): RegisterDecoratorParameters[] {\n return this.decorators;\n }\n}\n\nclass SearchEngineRegistry implements SearchEngineRegistryExtensionPoint {\n private searchEngine: SearchEngine | null = null;\n\n public setSearchEngine(searchEngine: SearchEngine): void {\n if (this.searchEngine) {\n throw new Error('Multiple Search engines is not supported at this time');\n }\n this.searchEngine = searchEngine;\n }\n\n public getSearchEngine(): SearchEngine | null {\n return this.searchEngine;\n }\n}\n\n/**\n * The Search plugin is responsible for starting search indexing processes and return search results.\n * @alpha\n */\nexport default createBackendPlugin({\n pluginId: 'search',\n register(env) {\n const searchIndexRegistry = new SearchIndexRegistry();\n env.registerExtensionPoint(\n searchIndexRegistryExtensionPoint,\n searchIndexRegistry,\n );\n\n const searchEngineRegistry = new SearchEngineRegistry();\n env.registerExtensionPoint(\n searchEngineRegistryExtensionPoint,\n searchEngineRegistry,\n );\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n discovery: coreServices.discovery,\n permissions: coreServices.permissions,\n auth: coreServices.auth,\n http: coreServices.httpRouter,\n httpAuth: coreServices.httpAuth,\n lifecycle: coreServices.rootLifecycle,\n searchIndexService: searchIndexServiceRef,\n },\n async init({\n config,\n logger,\n discovery,\n permissions,\n auth,\n http,\n httpAuth,\n lifecycle,\n searchIndexService,\n }) {\n let searchEngine = searchEngineRegistry.getSearchEngine();\n if (!searchEngine) {\n searchEngine = new LunrSearchEngine({\n logger,\n });\n }\n\n const collators = searchIndexRegistry.getCollators();\n const decorators = searchIndexRegistry.getDecorators();\n\n lifecycle.addStartupHook(async () => {\n await searchIndexService.start(
|
|
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 */\n\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport {\n LunrSearchEngine,\n RegisterCollatorParameters,\n RegisterDecoratorParameters,\n SearchEngine,\n} from '@backstage/plugin-search-backend-node';\nimport {\n SearchEngineRegistryExtensionPoint,\n searchEngineRegistryExtensionPoint,\n searchIndexRegistryExtensionPoint,\n SearchIndexRegistryExtensionPoint,\n searchIndexServiceRef,\n} from '@backstage/plugin-search-backend-node/alpha';\n\nimport { createRouter } from './service/router';\n\nclass SearchIndexRegistry implements SearchIndexRegistryExtensionPoint {\n private collators: RegisterCollatorParameters[] = [];\n private decorators: RegisterDecoratorParameters[] = [];\n\n public addCollator(options: RegisterCollatorParameters): void {\n this.collators.push(options);\n }\n\n public addDecorator(options: RegisterDecoratorParameters): void {\n this.decorators.push(options);\n }\n\n public getCollators(): RegisterCollatorParameters[] {\n return this.collators;\n }\n\n public getDecorators(): RegisterDecoratorParameters[] {\n return this.decorators;\n }\n}\n\nclass SearchEngineRegistry implements SearchEngineRegistryExtensionPoint {\n private searchEngine: SearchEngine | null = null;\n\n public setSearchEngine(searchEngine: SearchEngine): void {\n if (this.searchEngine) {\n throw new Error('Multiple Search engines is not supported at this time');\n }\n this.searchEngine = searchEngine;\n }\n\n public getSearchEngine(): SearchEngine | null {\n return this.searchEngine;\n }\n}\n\n/**\n * The Search plugin is responsible for starting search indexing processes and return search results.\n * @alpha\n */\nexport default createBackendPlugin({\n pluginId: 'search',\n register(env) {\n const searchIndexRegistry = new SearchIndexRegistry();\n env.registerExtensionPoint(\n searchIndexRegistryExtensionPoint,\n searchIndexRegistry,\n );\n\n const searchEngineRegistry = new SearchEngineRegistry();\n env.registerExtensionPoint(\n searchEngineRegistryExtensionPoint,\n searchEngineRegistry,\n );\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n discovery: coreServices.discovery,\n permissions: coreServices.permissions,\n auth: coreServices.auth,\n http: coreServices.httpRouter,\n httpAuth: coreServices.httpAuth,\n lifecycle: coreServices.rootLifecycle,\n searchIndexService: searchIndexServiceRef,\n },\n async init({\n config,\n logger,\n discovery,\n permissions,\n auth,\n http,\n httpAuth,\n lifecycle,\n searchIndexService,\n }) {\n let searchEngine = searchEngineRegistry.getSearchEngine();\n if (!searchEngine) {\n searchEngine = new LunrSearchEngine({\n logger,\n });\n }\n\n const collators = searchIndexRegistry.getCollators();\n const decorators = searchIndexRegistry.getDecorators();\n searchIndexService.init({\n searchEngine: searchEngine!,\n collators,\n decorators,\n });\n\n lifecycle.addStartupHook(async () => {\n await searchIndexService.start();\n });\n\n lifecycle.addShutdownHook(async () => {\n await searchIndexService.stop();\n });\n\n const router = await createRouter({\n config,\n discovery,\n permissions,\n auth,\n httpAuth,\n logger,\n engine: searchEngine,\n types: searchIndexService.getDocumentTypes(),\n });\n\n http.use(router);\n },\n });\n },\n});\n"],"names":["createBackendPlugin","searchIndexRegistryExtensionPoint","searchEngineRegistryExtensionPoint","coreServices","searchIndexServiceRef","LunrSearchEngine","router","createRouter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,mBAAiE,CAAA;AAAA,EAAvE,WAAA,GAAA;AACE,IAAA,aAAA,CAAA,IAAA,EAAQ,aAA0C,EAAC,CAAA,CAAA;AACnD,IAAA,aAAA,CAAA,IAAA,EAAQ,cAA4C,EAAC,CAAA,CAAA;AAAA,GAAA;AAAA,EAE9C,YAAY,OAA2C,EAAA;AAC5D,IAAK,IAAA,CAAA,SAAA,CAAU,KAAK,OAAO,CAAA,CAAA;AAAA,GAC7B;AAAA,EAEO,aAAa,OAA4C,EAAA;AAC9D,IAAK,IAAA,CAAA,UAAA,CAAW,KAAK,OAAO,CAAA,CAAA;AAAA,GAC9B;AAAA,EAEO,YAA6C,GAAA;AAClD,IAAA,OAAO,IAAK,CAAA,SAAA,CAAA;AAAA,GACd;AAAA,EAEO,aAA+C,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;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-search-backend",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.9",
|
|
4
4
|
"description": "The Backstage backend plugin that provides your backstage app with search",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin"
|
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
"test": "backstage-cli package test"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@backstage/backend-common": "^0.22.0
|
|
51
|
-
"@backstage/backend-openapi-utils": "^0.1.11
|
|
52
|
-
"@backstage/backend-plugin-api": "^0.6.18
|
|
50
|
+
"@backstage/backend-common": "^0.22.0",
|
|
51
|
+
"@backstage/backend-openapi-utils": "^0.1.11",
|
|
52
|
+
"@backstage/backend-plugin-api": "^0.6.18",
|
|
53
53
|
"@backstage/config": "^1.2.0",
|
|
54
54
|
"@backstage/errors": "^1.2.4",
|
|
55
55
|
"@backstage/plugin-permission-common": "^0.7.13",
|
|
56
|
-
"@backstage/plugin-permission-node": "^0.7.29
|
|
57
|
-
"@backstage/plugin-search-backend-node": "^1.2.
|
|
56
|
+
"@backstage/plugin-permission-node": "^0.7.29",
|
|
57
|
+
"@backstage/plugin-search-backend-node": "^1.2.23",
|
|
58
58
|
"@backstage/plugin-search-common": "^1.2.11",
|
|
59
|
-
"@backstage/repo-tools": "^0.9.0
|
|
59
|
+
"@backstage/repo-tools": "^0.9.0",
|
|
60
60
|
"@backstage/types": "^1.1.1",
|
|
61
61
|
"@types/express": "^4.17.6",
|
|
62
62
|
"dataloader": "^2.0.0",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"zod": "^3.22.4"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@backstage/backend-test-utils": "^0.3.8
|
|
72
|
-
"@backstage/cli": "^0.26.5
|
|
71
|
+
"@backstage/backend-test-utils": "^0.3.8",
|
|
72
|
+
"@backstage/cli": "^0.26.5",
|
|
73
73
|
"@types/supertest": "^2.0.8",
|
|
74
74
|
"supertest": "^6.1.3"
|
|
75
75
|
},
|