@backstage/plugin-search-backend-module-explore 0.1.23-next.0 → 0.1.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 +12 -7
- package/README.md +1 -1
- package/alpha/package.json +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
# @backstage/plugin-search-backend-module-explore
|
|
2
2
|
|
|
3
|
-
## 0.1.23
|
|
3
|
+
## 0.1.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- da02d13: Migrate search collator to use the new auth services.
|
|
8
|
+
|
|
9
|
+
## 0.1.22
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
6
12
|
|
|
7
|
-
- ca6e2e0: Migrate search collator to use the new auth services.
|
|
8
|
-
- 5d99272: Update README.md to point to explore plugin in community-plugins repository.
|
|
9
13
|
- Updated dependencies
|
|
10
|
-
- @backstage/plugin-
|
|
11
|
-
- @backstage/backend-common@0.21.
|
|
12
|
-
- @backstage/backend-plugin-api@0.6.
|
|
13
|
-
- @backstage/backend-tasks@0.5.
|
|
14
|
+
- @backstage/plugin-explore-common@0.0.3
|
|
15
|
+
- @backstage/backend-common@0.21.7
|
|
16
|
+
- @backstage/backend-plugin-api@0.6.17
|
|
17
|
+
- @backstage/backend-tasks@0.5.22
|
|
14
18
|
- @backstage/config@1.2.0
|
|
19
|
+
- @backstage/plugin-search-backend-node@1.2.21
|
|
15
20
|
- @backstage/plugin-search-common@1.2.11
|
|
16
21
|
|
|
17
22
|
## 0.1.21
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# search-backend-module-explore
|
|
2
2
|
|
|
3
|
-
This package exports a module that extends the search backend to also indexing the tools exposed by the [`explore` service](https://github.com/backstage/
|
|
3
|
+
This package exports a module that extends the search backend to also indexing the tools exposed by the [`explore` service](https://github.com/backstage/backstage/tree/master/plugins/explore-backend).
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
package/alpha/package.json
CHANGED
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.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 createLegacyAuthAdapters,\n PluginEndpointDiscovery,\n TokenManager,\n} from '@backstage/backend-common';\nimport { AuthService, LoggerService } from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\nimport { ExploreTool } from '@backstage
|
|
1
|
+
{"version":3,"file":"index.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 createLegacyAuthAdapters,\n PluginEndpointDiscovery,\n TokenManager,\n} from '@backstage/backend-common';\nimport { AuthService, LoggerService } from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\nimport { ExploreTool } from '@backstage/plugin-explore-common';\nimport {\n DocumentCollatorFactory,\n IndexableDocument,\n} from '@backstage/plugin-search-common';\nimport fetch from 'node-fetch';\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 * The options for the {@link ToolDocumentCollatorFactory}.\n *\n * @public\n */\nexport type ToolDocumentCollatorFactoryOptions = {\n discovery: PluginEndpointDiscovery;\n logger: LoggerService;\n tokenManager?: TokenManager;\n auth?: AuthService;\n};\n\n/**\n * Search collator responsible for collecting explore tools to index.\n *\n * @public\n */\nexport class ToolDocumentCollatorFactory implements DocumentCollatorFactory {\n public readonly type: string = 'tools';\n\n private readonly discovery: PluginEndpointDiscovery;\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\n this.auth = createLegacyAuthAdapters(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":["createLegacyAuthAdapters","Readable","fetch"],"mappings":";;;;;;;;;;;;;;;;A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A,SAAA,CAAU,WAAW,SAAS,CAAA,CAAA;AAEzD,IAAA,MAAM,EAAE,KAAM,EAAA,GAAI,MAAM,IAAA,CAAK,KAAK,qBAAsB,CAAA;AAAA,MACtD,UAAY,EAAA,MAAM,IAAK,CAAA,IAAA,CAAK,wBAAyB,EAAA;AAAA,MACrD,cAAgB,EAAA,SAAA;AAAA,KACjB,CAAA,CAAA;AACD,IAAA,MAAM,QAAW,GAAA,MAAMC,sBAAM,CAAA,CAAA,EAAG,OAAO,CAAU,MAAA,CAAA,EAAA;AAAA,MAC/C,OAAS,EAAA,EAAE,aAAe,EAAA,CAAA,OAAA,EAAU,KAAK,CAAG,CAAA,EAAA;AAAA,KAC7C,CAAA,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,CAAA;AAAA,OAC3E,CAAA;AAAA,KACF;AAEA,IAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AACjC,IAAA,OAAO,IAAK,CAAA,KAAA,CAAA;AAAA,GACd;AACF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { PluginEndpointDiscovery, TokenManager } from '@backstage/backend-common';
|
|
3
3
|
import { LoggerService, AuthService } from '@backstage/backend-plugin-api';
|
|
4
4
|
import { Config } from '@backstage/config';
|
|
5
|
-
import { ExploreTool } from '@backstage
|
|
5
|
+
import { ExploreTool } from '@backstage/plugin-explore-common';
|
|
6
6
|
import { IndexableDocument, DocumentCollatorFactory } from '@backstage/plugin-search-common';
|
|
7
7
|
import { Readable } from 'stream';
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-search-backend-module-explore",
|
|
3
|
-
"version": "0.1.23
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"description": "A module for the search backend that exports explore modules",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module"
|
|
@@ -45,18 +45,18 @@
|
|
|
45
45
|
"test": "backstage-cli package test"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@backstage
|
|
49
|
-
"@backstage/backend-
|
|
50
|
-
"@backstage/backend-
|
|
51
|
-
"@backstage/backend-tasks": "^0.5.23-next.0",
|
|
48
|
+
"@backstage/backend-common": "^0.21.7",
|
|
49
|
+
"@backstage/backend-plugin-api": "^0.6.17",
|
|
50
|
+
"@backstage/backend-tasks": "^0.5.22",
|
|
52
51
|
"@backstage/config": "^1.2.0",
|
|
53
|
-
"@backstage/plugin-
|
|
52
|
+
"@backstage/plugin-explore-common": "^0.0.3",
|
|
53
|
+
"@backstage/plugin-search-backend-node": "^1.2.21",
|
|
54
54
|
"@backstage/plugin-search-common": "^1.2.11",
|
|
55
55
|
"node-fetch": "^2.6.7"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@backstage/backend-test-utils": "^0.3.
|
|
59
|
-
"@backstage/cli": "^0.26.
|
|
58
|
+
"@backstage/backend-test-utils": "^0.3.7",
|
|
59
|
+
"@backstage/cli": "^0.26.4",
|
|
60
60
|
"msw": "^1.2.1"
|
|
61
61
|
},
|
|
62
62
|
"configSchema": "config.d.ts"
|