@backstage/plugin-search-backend-module-explore 0.2.9-next.0 → 0.3.0
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 +24 -0
- package/dist/collators/ToolDocumentCollatorFactory.cjs.js +1 -2
- package/dist/collators/ToolDocumentCollatorFactory.cjs.js.map +1 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -35
- package/dist/module.cjs.js +2 -2
- package/dist/module.cjs.js.map +1 -1
- package/package.json +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @backstage/plugin-search-backend-module-explore
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d5c4a9d: **BREAKING** Removed support for the legacy backend system and references to `@backstage/backend-common`, please migrate to the new backend system.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/backend-plugin-api@1.2.1
|
|
13
|
+
- @backstage/config@1.3.2
|
|
14
|
+
- @backstage/plugin-search-backend-node@1.3.9
|
|
15
|
+
- @backstage/plugin-search-common@1.2.17
|
|
16
|
+
|
|
17
|
+
## 0.2.9-next.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @backstage/backend-plugin-api@1.2.1-next.1
|
|
23
|
+
- @backstage/config@1.3.2
|
|
24
|
+
- @backstage/plugin-search-backend-node@1.3.9-next.1
|
|
25
|
+
- @backstage/plugin-search-common@1.2.17
|
|
26
|
+
|
|
3
27
|
## 0.2.9-next.0
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var backendCommon = require('@backstage/backend-common');
|
|
4
3
|
var stream = require('stream');
|
|
5
4
|
|
|
6
5
|
class ToolDocumentCollatorFactory {
|
|
@@ -11,7 +10,7 @@ class ToolDocumentCollatorFactory {
|
|
|
11
10
|
constructor(options) {
|
|
12
11
|
this.discovery = options.discovery;
|
|
13
12
|
this.logger = options.logger;
|
|
14
|
-
this.auth =
|
|
13
|
+
this.auth = options.auth;
|
|
15
14
|
}
|
|
16
15
|
static fromConfig(_config, options) {
|
|
17
16
|
return new ToolDocumentCollatorFactory(options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolDocumentCollatorFactory.cjs.js","sources":["../../src/collators/ToolDocumentCollatorFactory.ts"],"sourcesContent":["/*\n * Copyright 2022 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
|
|
1
|
+
{"version":3,"file":"ToolDocumentCollatorFactory.cjs.js","sources":["../../src/collators/ToolDocumentCollatorFactory.ts"],"sourcesContent":["/*\n * Copyright 2022 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 AuthService,\n DiscoveryService,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\nimport { ExploreTool } from '@backstage-community/plugin-explore-common';\nimport {\n DocumentCollatorFactory,\n IndexableDocument,\n} from '@backstage/plugin-search-common';\nimport { Readable } from 'stream';\n\n/**\n * Extended IndexableDocument with explore tool specific properties\n *\n * @public\n */\nexport interface ToolDocument extends IndexableDocument, ExploreTool {}\n\n/**\n * @internal\n */\nexport type ToolDocumentCollatorFactoryOptions = {\n discovery: DiscoveryService;\n logger: LoggerService;\n auth: AuthService;\n};\n\n/**\n * Search collator responsible for collecting explore tools to index.\n *\n * @internal\n */\nexport class ToolDocumentCollatorFactory implements DocumentCollatorFactory {\n public readonly type: string = 'tools';\n\n private readonly discovery: DiscoveryService;\n private readonly logger: LoggerService;\n private readonly auth: AuthService;\n\n private constructor(options: ToolDocumentCollatorFactoryOptions) {\n this.discovery = options.discovery;\n this.logger = options.logger;\n this.auth = options.auth;\n }\n\n static fromConfig(\n _config: Config,\n options: ToolDocumentCollatorFactoryOptions,\n ) {\n return new ToolDocumentCollatorFactory(options);\n }\n\n async getCollator() {\n return Readable.from(this.execute());\n }\n\n async *execute(): AsyncGenerator<ToolDocument> {\n this.logger.info('Starting collation of explore tools');\n\n const tools = await this.fetchTools();\n\n for (const tool of tools) {\n yield {\n ...tool,\n text: tool.description,\n location: tool.url,\n };\n }\n\n this.logger.info('Finished collation of explore tools');\n }\n\n private async fetchTools() {\n const baseUrl = await this.discovery.getBaseUrl('explore');\n\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: await this.auth.getOwnServiceCredentials(),\n targetPluginId: 'explore',\n });\n const response = await fetch(`${baseUrl}/tools`, {\n headers: { Authorization: `Bearer ${token}` },\n });\n\n if (!response.ok) {\n throw new Error(\n `Failed to explore fetch tools, ${response.status}: ${response.statusText}`,\n );\n }\n\n const data = await response.json();\n return data.tools;\n }\n}\n"],"names":["Readable"],"mappings":";;;;AAkDO,MAAM,2BAA+D,CAAA;AAAA,EAC1D,IAAe,GAAA,OAAA;AAAA,EAEd,SAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,E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G,CAAA;AAAA,KAC7C,CAAA;AAED,IAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAkC,+BAAA,EAAA,QAAA,CAAS,MAAM,CAAA,EAAA,EAAK,SAAS,UAAU,CAAA;AAAA,OAC3E;AAAA;AAGF,IAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAAS,IAAK,EAAA;AACjC,IAAA,OAAO,IAAK,CAAA,KAAA;AAAA;AAEhB;;;;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ToolDocumentCollatorFactory = require('./collators/ToolDocumentCollatorFactory.cjs.js');
|
|
6
5
|
var module$1 = require('./module.cjs.js');
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
|
|
10
|
-
exports.ToolDocumentCollatorFactory = ToolDocumentCollatorFactory.ToolDocumentCollatorFactory;
|
|
11
9
|
exports.default = module$1.default;
|
|
12
10
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { TokenManager } from '@backstage/backend-common';
|
|
3
|
-
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
4
|
-
import { DiscoveryService, LoggerService, AuthService } from '@backstage/backend-plugin-api';
|
|
5
|
-
import { Config } from '@backstage/config';
|
|
6
1
|
import { ExploreTool } from '@backstage-community/plugin-explore-common';
|
|
7
|
-
import { IndexableDocument
|
|
8
|
-
import
|
|
2
|
+
import { IndexableDocument } from '@backstage/plugin-search-common';
|
|
3
|
+
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
9
4
|
|
|
10
5
|
/**
|
|
11
6
|
* Extended IndexableDocument with explore tool specific properties
|
|
@@ -14,33 +9,6 @@ import { Readable } from 'stream';
|
|
|
14
9
|
*/
|
|
15
10
|
interface ToolDocument extends IndexableDocument, ExploreTool {
|
|
16
11
|
}
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
* @deprecated This type is deprecated along with the {@link ToolDocumentCollatorFactory}.
|
|
20
|
-
*/
|
|
21
|
-
type ToolDocumentCollatorFactoryOptions = {
|
|
22
|
-
discovery: DiscoveryService;
|
|
23
|
-
logger: LoggerService;
|
|
24
|
-
tokenManager?: TokenManager;
|
|
25
|
-
auth?: AuthService;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Search collator responsible for collecting explore tools to index.
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
* @deprecated Migrate to the {@link https://backstage.io/docs/backend-system/building-backends/migrating | new backend system} and install this collator via module instead (see {@link https://github.com/backstage/backstage/blob/nbs10/search-deprecate-create-router/plugins/search-backend-module-explore/README.md#installation | here} for more installation details).
|
|
32
|
-
*/
|
|
33
|
-
declare class ToolDocumentCollatorFactory implements DocumentCollatorFactory {
|
|
34
|
-
readonly type: string;
|
|
35
|
-
private readonly discovery;
|
|
36
|
-
private readonly logger;
|
|
37
|
-
private readonly auth;
|
|
38
|
-
private constructor();
|
|
39
|
-
static fromConfig(_config: Config, options: ToolDocumentCollatorFactoryOptions): ToolDocumentCollatorFactory;
|
|
40
|
-
getCollator(): Promise<Readable>;
|
|
41
|
-
execute(): AsyncGenerator<ToolDocument>;
|
|
42
|
-
private fetchTools;
|
|
43
|
-
}
|
|
44
12
|
|
|
45
13
|
/**
|
|
46
14
|
* Search backend module for the Explore index.
|
|
@@ -49,4 +17,4 @@ declare class ToolDocumentCollatorFactory implements DocumentCollatorFactory {
|
|
|
49
17
|
*/
|
|
50
18
|
declare const _default: _backstage_backend_plugin_api.BackendFeature;
|
|
51
19
|
|
|
52
|
-
export { type ToolDocument,
|
|
20
|
+
export { type ToolDocument, _default as default };
|
package/dist/module.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
6
6
|
var alpha = require('@backstage/plugin-search-backend-node/alpha');
|
|
7
|
-
var
|
|
7
|
+
var ToolDocumentCollatorFactory = require('./collators/ToolDocumentCollatorFactory.cjs.js');
|
|
8
8
|
|
|
9
9
|
var feature = backendPluginApi.createBackendModule({
|
|
10
10
|
pluginId: "search",
|
|
@@ -37,7 +37,7 @@ var feature = backendPluginApi.createBackendModule({
|
|
|
37
37
|
) : defaultSchedule;
|
|
38
38
|
indexRegistry.addCollator({
|
|
39
39
|
schedule: scheduler.createScheduledTaskRunner(schedule),
|
|
40
|
-
factory:
|
|
40
|
+
factory: ToolDocumentCollatorFactory.ToolDocumentCollatorFactory.fromConfig(config, {
|
|
41
41
|
discovery,
|
|
42
42
|
logger,
|
|
43
43
|
auth
|
package/dist/module.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.cjs.js","sources":["../src/module.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\n/**\n * @packageDocumentation\n * A module for the search backend that exports Explore modules.\n */\n\nimport {\n coreServices,\n createBackendModule,\n readSchedulerServiceTaskScheduleDefinitionFromConfig,\n} from '@backstage/backend-plugin-api';\nimport { searchIndexRegistryExtensionPoint } from '@backstage/plugin-search-backend-node/alpha';\
|
|
1
|
+
{"version":3,"file":"module.cjs.js","sources":["../src/module.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\n/**\n * @packageDocumentation\n * A module for the search backend that exports Explore modules.\n */\n\nimport {\n coreServices,\n createBackendModule,\n readSchedulerServiceTaskScheduleDefinitionFromConfig,\n} from '@backstage/backend-plugin-api';\nimport { searchIndexRegistryExtensionPoint } from '@backstage/plugin-search-backend-node/alpha';\nimport { ToolDocumentCollatorFactory } from './collators/ToolDocumentCollatorFactory';\n\n/**\n * Search backend module for the Explore index.\n *\n * @public\n */\nexport default createBackendModule({\n pluginId: 'search',\n moduleId: 'explore-collator',\n register(env) {\n env.registerInit({\n deps: {\n config: coreServices.rootConfig,\n logger: coreServices.logger,\n discovery: coreServices.discovery,\n scheduler: coreServices.scheduler,\n auth: coreServices.auth,\n indexRegistry: searchIndexRegistryExtensionPoint,\n },\n async init({\n config,\n logger,\n discovery,\n scheduler,\n auth,\n indexRegistry,\n }) {\n const defaultSchedule = {\n frequency: { minutes: 10 },\n timeout: { minutes: 15 },\n initialDelay: { seconds: 3 },\n };\n\n const schedule = config.has('search.collators.explore.schedule')\n ? readSchedulerServiceTaskScheduleDefinitionFromConfig(\n config.getConfig('search.collators.explore.schedule'),\n )\n : defaultSchedule;\n\n indexRegistry.addCollator({\n schedule: scheduler.createScheduledTaskRunner(schedule),\n factory: ToolDocumentCollatorFactory.fromConfig(config, {\n discovery,\n logger,\n auth,\n }),\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","coreServices","searchIndexRegistryExtensionPoint","readSchedulerServiceTaskScheduleDefinitionFromConfig","ToolDocumentCollatorFactory"],"mappings":";;;;;;;;AAkCA,cAAeA,oCAAoB,CAAA;AAAA,EACjC,QAAU,EAAA,QAAA;AAAA,EACV,QAAU,EAAA,kBAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,QAAQC,6BAAa,CAAA,UAAA;AAAA,QACrB,QAAQA,6BAAa,CAAA,MAAA;AAAA,QACrB,WAAWA,6BAAa,CAAA,SAAA;AAAA,QACxB,WAAWA,6BAAa,CAAA,SAAA;AAAA,QACxB,MAAMA,6BAAa,CAAA,IAAA;AAAA,QACnB,aAAe,EAAAC;AAAA,OACjB;AAAA,MACA,MAAM,IAAK,CAAA;AAAA,QACT,MAAA;AAAA,QACA,MAAA;AAAA,QACA,SAAA;AAAA,QACA,SAAA;AAAA,QACA,IAAA;AAAA,QACA;AAAA,OACC,EAAA;AACD,QAAA,MAAM,eAAkB,GAAA;AAAA,UACtB,SAAA,EAAW,EAAE,OAAA,EAAS,EAAG,EAAA;AAAA,UACzB,OAAA,EAAS,EAAE,OAAA,EAAS,EAAG,EAAA;AAAA,UACvB,YAAA,EAAc,EAAE,OAAA,EAAS,CAAE;AAAA,SAC7B;AAEA,QAAA,MAAM,QAAW,GAAA,MAAA,CAAO,GAAI,CAAA,mCAAmC,CAC3D,GAAAC,qEAAA;AAAA,UACE,MAAA,CAAO,UAAU,mCAAmC;AAAA,SAEtD,GAAA,eAAA;AAEJ,QAAA,aAAA,CAAc,WAAY,CAAA;AAAA,UACxB,QAAA,EAAU,SAAU,CAAA,yBAAA,CAA0B,QAAQ,CAAA;AAAA,UACtD,OAAA,EAASC,uDAA4B,CAAA,UAAA,CAAW,MAAQ,EAAA;AAAA,YACtD,SAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA,WACD;AAAA,SACF,CAAA;AAAA;AACH,KACD,CAAA;AAAA;AAEL,CAAC,CAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-search-backend-module-explore",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A module for the search backend that exports explore modules",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"types": "./dist/index.d.ts",
|
|
41
41
|
"typesVersions": {
|
|
42
42
|
"*": {
|
|
43
|
-
"
|
|
43
|
+
"*": [
|
|
44
44
|
"dist/index.d.ts"
|
|
45
45
|
],
|
|
46
46
|
"alpha": [
|
|
@@ -63,15 +63,14 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@backstage-community/plugin-explore-common": "^0.0.7",
|
|
66
|
-
"@backstage/backend-
|
|
67
|
-
"@backstage/
|
|
68
|
-
"@backstage/
|
|
69
|
-
"@backstage/plugin-search-
|
|
70
|
-
"@backstage/plugin-search-common": "1.2.17"
|
|
66
|
+
"@backstage/backend-plugin-api": "^1.2.1",
|
|
67
|
+
"@backstage/config": "^1.3.2",
|
|
68
|
+
"@backstage/plugin-search-backend-node": "^1.3.9",
|
|
69
|
+
"@backstage/plugin-search-common": "^1.2.17"
|
|
71
70
|
},
|
|
72
71
|
"devDependencies": {
|
|
73
|
-
"@backstage/backend-test-utils": "1.3.1
|
|
74
|
-
"@backstage/cli": "0.
|
|
72
|
+
"@backstage/backend-test-utils": "^1.3.1",
|
|
73
|
+
"@backstage/cli": "^0.31.0",
|
|
75
74
|
"msw": "^1.2.1"
|
|
76
75
|
},
|
|
77
76
|
"configSchema": "config.d.ts"
|