@backstage/plugin-search-backend-node 1.2.22-next.1 → 1.2.23
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 +16 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +11 -7
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/alpha.d.ts +8 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @backstage/plugin-search-backend-node
|
|
2
2
|
|
|
3
|
+
## 1.2.23
|
|
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
|
+
|
|
9
|
+
## 1.2.22
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- c6cb568: Add lifecycle monitoring for the search index registry
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @backstage/backend-common@0.22.0
|
|
16
|
+
- @backstage/backend-plugin-api@0.6.18
|
|
17
|
+
- @backstage/backend-tasks@0.5.23
|
|
18
|
+
|
|
3
19
|
## 1.2.22-next.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.cjs.js
CHANGED
|
@@ -19,25 +19,29 @@ class DefaultSearchIndexService {
|
|
|
19
19
|
static fromConfig(options) {
|
|
20
20
|
return new DefaultSearchIndexService(options);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
var _a;
|
|
22
|
+
init(options) {
|
|
24
23
|
this.indexBuilder = new pluginSearchBackendNode.IndexBuilder({
|
|
25
24
|
logger: this.logger,
|
|
26
25
|
searchEngine: options.searchEngine
|
|
27
26
|
});
|
|
28
27
|
options.collators.forEach(
|
|
29
28
|
(collator) => {
|
|
30
|
-
var
|
|
31
|
-
return (
|
|
29
|
+
var _a;
|
|
30
|
+
return (_a = this.indexBuilder) == null ? void 0 : _a.addCollator(collator);
|
|
32
31
|
}
|
|
33
32
|
);
|
|
34
33
|
options.decorators.forEach(
|
|
35
34
|
(decorator) => {
|
|
36
|
-
var
|
|
37
|
-
return (
|
|
35
|
+
var _a;
|
|
36
|
+
return (_a = this.indexBuilder) == null ? void 0 : _a.addDecorator(decorator);
|
|
38
37
|
}
|
|
39
38
|
);
|
|
40
|
-
|
|
39
|
+
}
|
|
40
|
+
async start() {
|
|
41
|
+
if (!this.indexBuilder) {
|
|
42
|
+
throw new Error("IndexBuilder is not initialized, call init first");
|
|
43
|
+
}
|
|
44
|
+
const { scheduler } = await this.indexBuilder.build();
|
|
41
45
|
this.scheduler = scheduler;
|
|
42
46
|
this.scheduler.start();
|
|
43
47
|
}
|
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 createExtensionPoint,\n createServiceFactory,\n createServiceRef,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport { DocumentTypeInfo } from '@backstage/plugin-search-common';\nimport {\n IndexBuilder,\n RegisterCollatorParameters,\n RegisterDecoratorParameters,\n Scheduler,\n SearchEngine,\n} from '@backstage/plugin-search-backend-node';\n\n/**\n * @alpha\n * Options for
|
|
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 createExtensionPoint,\n createServiceFactory,\n createServiceRef,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport { DocumentTypeInfo } from '@backstage/plugin-search-common';\nimport {\n IndexBuilder,\n RegisterCollatorParameters,\n RegisterDecoratorParameters,\n Scheduler,\n SearchEngine,\n} from '@backstage/plugin-search-backend-node';\n\n/**\n * @alpha\n * Options for the init method on {@link SearchIndexService}.\n */\nexport type SearchIndexServiceInitOptions = {\n searchEngine: SearchEngine;\n collators: RegisterCollatorParameters[];\n decorators: RegisterDecoratorParameters[];\n};\n\n/**\n * @alpha\n * Interface for implementation of index service.\n */\nexport interface SearchIndexService {\n /**\n * Initializes state in preparation for starting the search index service\n */\n init(options: SearchIndexServiceInitOptions): void;\n\n /**\n * Starts indexing process\n */\n start(): Promise<void>;\n\n /**\n * Stops indexing process\n */\n stop(): Promise<void>;\n\n /**\n * Returns an index types list.\n */\n getDocumentTypes(): Record<string, DocumentTypeInfo>;\n}\n\n/**\n * @alpha\n * Interface for search index registry extension point.\n */\nexport interface SearchIndexRegistryExtensionPoint {\n addCollator(options: RegisterCollatorParameters): void;\n addDecorator(options: RegisterDecoratorParameters): void;\n}\n\n/**\n * @alpha\n * Interface for search engine registry extension point.\n */\nexport interface SearchEngineRegistryExtensionPoint {\n setSearchEngine(searchEngine: SearchEngine): void;\n}\n\ntype DefaultSearchIndexServiceOptions = {\n logger: LoggerService;\n};\n\n/**\n * @alpha\n * Responsible for register the indexing task and start the schedule.\n */\nclass DefaultSearchIndexService implements SearchIndexService {\n private readonly logger: LoggerService;\n private indexBuilder: IndexBuilder | null = null;\n private scheduler: Scheduler | null = null;\n\n private constructor(options: DefaultSearchIndexServiceOptions) {\n this.logger = options.logger;\n }\n\n static fromConfig(options: DefaultSearchIndexServiceOptions) {\n return new DefaultSearchIndexService(options);\n }\n\n init(options: SearchIndexServiceInitOptions): void {\n this.indexBuilder = new IndexBuilder({\n logger: this.logger,\n searchEngine: options.searchEngine,\n });\n\n options.collators.forEach(collator =>\n this.indexBuilder?.addCollator(collator),\n );\n\n options.decorators.forEach(decorator =>\n this.indexBuilder?.addDecorator(decorator),\n );\n }\n\n async start(): Promise<void> {\n if (!this.indexBuilder) {\n throw new Error('IndexBuilder is not initialized, call init first');\n }\n const { scheduler } = await this.indexBuilder.build();\n this.scheduler = scheduler;\n this.scheduler!.start();\n }\n\n async stop(): Promise<void> {\n if (this.scheduler) {\n this.scheduler.stop();\n this.scheduler = null;\n }\n }\n\n getDocumentTypes(): Record<string, DocumentTypeInfo> {\n return this.indexBuilder?.getDocumentTypes() ?? {};\n }\n}\n\n/**\n * @alpha\n * Service that builds a search index.\n */\nexport const searchIndexServiceRef = createServiceRef<SearchIndexService>({\n id: 'search.index.service',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n logger: coreServices.logger,\n },\n factory({ logger }) {\n return DefaultSearchIndexService.fromConfig({\n logger,\n });\n },\n }),\n});\n\n/**\n * @alpha\n * Extension point for register a search engine.\n */\nexport const searchEngineRegistryExtensionPoint =\n createExtensionPoint<SearchEngineRegistryExtensionPoint>({\n id: 'search.engine.registry',\n });\n\n/**\n * @alpha\n * Extension point for registering collators and decorators\n */\nexport const searchIndexRegistryExtensionPoint =\n createExtensionPoint<SearchIndexRegistryExtensionPoint>({\n id: 'search.index.registry',\n });\n"],"names":["IndexBuilder","createServiceRef","createServiceFactory","coreServices","createExtensionPoint"],"mappings":";;;;;;;;;;;AA6FA,MAAM,yBAAwD,CAAA;AAAA,EAKpD,YAAY,OAA2C,EAAA;AAJ/D,IAAiB,aAAA,CAAA,IAA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
* @alpha
|
|
7
|
-
* Options for
|
|
7
|
+
* Options for the init method on {@link SearchIndexService}.
|
|
8
8
|
*/
|
|
9
|
-
type
|
|
9
|
+
type SearchIndexServiceInitOptions = {
|
|
10
10
|
searchEngine: SearchEngine;
|
|
11
11
|
collators: RegisterCollatorParameters[];
|
|
12
12
|
decorators: RegisterDecoratorParameters[];
|
|
@@ -16,10 +16,14 @@ type SearchIndexServiceStartOptions = {
|
|
|
16
16
|
* Interface for implementation of index service.
|
|
17
17
|
*/
|
|
18
18
|
interface SearchIndexService {
|
|
19
|
+
/**
|
|
20
|
+
* Initializes state in preparation for starting the search index service
|
|
21
|
+
*/
|
|
22
|
+
init(options: SearchIndexServiceInitOptions): void;
|
|
19
23
|
/**
|
|
20
24
|
* Starts indexing process
|
|
21
25
|
*/
|
|
22
|
-
start(
|
|
26
|
+
start(): Promise<void>;
|
|
23
27
|
/**
|
|
24
28
|
* Stops indexing process
|
|
25
29
|
*/
|
|
@@ -60,4 +64,4 @@ declare const searchEngineRegistryExtensionPoint: _backstage_backend_plugin_api.
|
|
|
60
64
|
*/
|
|
61
65
|
declare const searchIndexRegistryExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<SearchIndexRegistryExtensionPoint>;
|
|
62
66
|
|
|
63
|
-
export { type SearchEngineRegistryExtensionPoint, type SearchIndexRegistryExtensionPoint, type SearchIndexService, type
|
|
67
|
+
export { type SearchEngineRegistryExtensionPoint, type SearchIndexRegistryExtensionPoint, type SearchIndexService, type SearchIndexServiceInitOptions, searchEngineRegistryExtensionPoint, searchIndexRegistryExtensionPoint, searchIndexServiceRef };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-search-backend-node",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.23",
|
|
4
4
|
"description": "A library for Backstage backend plugins that want to interact with the search backend plugin",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"test": "backstage-cli package test"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@backstage/backend-common": "^0.22.0
|
|
48
|
-
"@backstage/backend-plugin-api": "^0.6.18
|
|
49
|
-
"@backstage/backend-tasks": "^0.5.23
|
|
47
|
+
"@backstage/backend-common": "^0.22.0",
|
|
48
|
+
"@backstage/backend-plugin-api": "^0.6.18",
|
|
49
|
+
"@backstage/backend-tasks": "^0.5.23",
|
|
50
50
|
"@backstage/config": "^1.2.0",
|
|
51
51
|
"@backstage/errors": "^1.2.4",
|
|
52
52
|
"@backstage/plugin-permission-common": "^0.7.13",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"uuid": "^9.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@backstage/backend-common": "^0.22.0
|
|
62
|
-
"@backstage/cli": "^0.26.5
|
|
61
|
+
"@backstage/backend-common": "^0.22.0",
|
|
62
|
+
"@backstage/cli": "^0.26.5",
|
|
63
63
|
"@types/ndjson": "^2.0.1"
|
|
64
64
|
}
|
|
65
65
|
}
|