@backstage/plugin-search-backend-module-explore 0.1.17-next.0 → 0.1.17
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 +25 -9
- package/alpha/package.json +1 -1
- package/dist/index.cjs.js +10 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/package.json +29 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
# @backstage/plugin-search-backend-module-explore
|
|
2
2
|
|
|
3
|
-
## 0.1.17
|
|
3
|
+
## 0.1.17
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- bb368a5: Migrated to support new auth services.
|
|
8
7
|
- Updated dependencies
|
|
9
|
-
- @backstage/backend-common@0.21.3
|
|
10
|
-
- @backstage/backend-
|
|
11
|
-
- @backstage/plugin-search-
|
|
12
|
-
- @backstage/backend-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
- @backstage/backend-common@0.21.3
|
|
9
|
+
- @backstage/backend-tasks@0.5.18
|
|
10
|
+
- @backstage/plugin-search-backend-node@1.2.17
|
|
11
|
+
- @backstage/backend-plugin-api@0.6.13
|
|
12
|
+
|
|
13
|
+
## 0.1.16
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @backstage/backend-common@0.21.2
|
|
19
|
+
- @backstage/backend-tasks@0.5.17
|
|
20
|
+
- @backstage/plugin-search-backend-node@1.2.16
|
|
21
|
+
- @backstage/backend-plugin-api@0.6.12
|
|
22
|
+
|
|
23
|
+
## 0.1.15
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- @backstage/backend-common@0.21.1
|
|
29
|
+
- @backstage/backend-tasks@0.5.16
|
|
30
|
+
- @backstage/plugin-search-backend-node@1.2.15
|
|
31
|
+
- @backstage/backend-plugin-api@0.6.11
|
|
16
32
|
|
|
17
33
|
## 0.1.14
|
|
18
34
|
|
package/alpha/package.json
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var backendCommon = require('@backstage/backend-common');
|
|
6
5
|
var fetch = require('node-fetch');
|
|
7
6
|
var stream = require('stream');
|
|
8
7
|
|
|
@@ -21,10 +20,10 @@ class ToolDocumentCollatorFactory {
|
|
|
21
20
|
__publicField(this, "type", "tools");
|
|
22
21
|
__publicField(this, "discovery");
|
|
23
22
|
__publicField(this, "logger");
|
|
24
|
-
__publicField(this, "
|
|
23
|
+
__publicField(this, "tokenManager");
|
|
25
24
|
this.discovery = options.discovery;
|
|
26
25
|
this.logger = options.logger;
|
|
27
|
-
this.
|
|
26
|
+
this.tokenManager = options.tokenManager;
|
|
28
27
|
}
|
|
29
28
|
static fromConfig(_config, options) {
|
|
30
29
|
return new ToolDocumentCollatorFactory(options);
|
|
@@ -46,13 +45,14 @@ class ToolDocumentCollatorFactory {
|
|
|
46
45
|
}
|
|
47
46
|
async fetchTools() {
|
|
48
47
|
const baseUrl = await this.discovery.getBaseUrl("explore");
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
48
|
+
let headers = {};
|
|
49
|
+
if (this.tokenManager) {
|
|
50
|
+
const { token } = await this.tokenManager.getToken();
|
|
51
|
+
headers = {
|
|
52
|
+
Authorization: `Bearer ${token}`
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const response = await fetch__default["default"](`${baseUrl}/tools`, headers);
|
|
56
56
|
if (!response.ok) {
|
|
57
57
|
throw new Error(
|
|
58
58
|
`Failed to explore fetch tools, ${response.status}: ${response.statusText}`
|
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 PluginEndpointDiscovery,\n TokenManager,\n
|
|
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 PluginEndpointDiscovery,\n TokenManager,\n} from '@backstage/backend-common';\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';\nimport { Logger } from 'winston';\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: Logger;\n tokenManager?: TokenManager;\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: Logger;\n private readonly tokenManager?: TokenManager;\n\n private constructor(options: ToolDocumentCollatorFactoryOptions) {\n this.discovery = options.discovery;\n this.logger = options.logger;\n this.tokenManager = options.tokenManager;\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 let headers = {};\n\n if (this.tokenManager) {\n const { token } = await this.tokenManager.getToken();\n headers = {\n Authorization: `Bearer ${token}`,\n };\n }\n\n const response = await fetch(`${baseUrl}/tools`, headers);\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","fetch"],"mappings":";;;;;;;;;;;;;;;;;AAqDO,MAAM,2BAA+D,CAAA;AAAA,EAOlE,YAAY,OAA6C,EAAA;AANjE,IAAA,aAAA,CAAA,IAAA,EAAgB,MAAe,EAAA,OAAA,CAAA,CAAA;AAE/B,IAAiB,aAAA,CAAA,IAAA,EAAA,WAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAAA,IAAA,EAAA,QAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAAA,IAAA,EAAA,cAAA,CAAA,CAAA;AAGf,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,SAAA,CAAA;AACzB,IAAA,IAA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AI,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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { PluginEndpointDiscovery, TokenManager } from '@backstage/backend-common';
|
|
3
|
-
import { AuthService } from '@backstage/backend-plugin-api';
|
|
4
3
|
import { Config } from '@backstage/config';
|
|
5
4
|
import { ExploreTool } from '@backstage/plugin-explore-common';
|
|
6
5
|
import { IndexableDocument, DocumentCollatorFactory } from '@backstage/plugin-search-common';
|
|
@@ -23,7 +22,6 @@ type ToolDocumentCollatorFactoryOptions = {
|
|
|
23
22
|
discovery: PluginEndpointDiscovery;
|
|
24
23
|
logger: Logger;
|
|
25
24
|
tokenManager?: TokenManager;
|
|
26
|
-
auth?: AuthService;
|
|
27
25
|
};
|
|
28
26
|
/**
|
|
29
27
|
* Search collator responsible for collecting explore tools to index.
|
|
@@ -34,7 +32,7 @@ declare class ToolDocumentCollatorFactory implements DocumentCollatorFactory {
|
|
|
34
32
|
readonly type: string;
|
|
35
33
|
private readonly discovery;
|
|
36
34
|
private readonly logger;
|
|
37
|
-
private readonly
|
|
35
|
+
private readonly tokenManager?;
|
|
38
36
|
private constructor();
|
|
39
37
|
static fromConfig(_config: Config, options: ToolDocumentCollatorFactoryOptions): ToolDocumentCollatorFactory;
|
|
40
38
|
getCollator(): Promise<Readable>;
|
package/package.json
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-search-backend-module-explore",
|
|
3
|
-
"version": "0.1.17-next.0",
|
|
4
3
|
"description": "A module for the search backend that exports explore modules",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
"version": "0.1.17",
|
|
5
|
+
"main": "./dist/index.cjs.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://backstage.io",
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/backstage/backstage",
|
|
15
|
-
"directory": "plugins/search-backend-module-explore"
|
|
16
|
-
},
|
|
17
|
-
"license": "Apache-2.0",
|
|
18
11
|
"exports": {
|
|
19
12
|
".": {
|
|
20
13
|
"require": "./dist/index.cjs.js",
|
|
@@ -28,37 +21,44 @@
|
|
|
28
21
|
},
|
|
29
22
|
"./package.json": "./package.json"
|
|
30
23
|
},
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
24
|
+
"backstage": {
|
|
25
|
+
"role": "backend-plugin-module"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://backstage.io",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/backstage/backstage",
|
|
31
|
+
"directory": "plugins/search-backend-module-explore"
|
|
32
|
+
},
|
|
38
33
|
"scripts": {
|
|
34
|
+
"start": "backstage-cli package start",
|
|
39
35
|
"build": "backstage-cli package build",
|
|
40
|
-
"clean": "backstage-cli package clean",
|
|
41
36
|
"lint": "backstage-cli package lint",
|
|
37
|
+
"test": "backstage-cli package test",
|
|
42
38
|
"prepack": "backstage-cli package prepack",
|
|
43
39
|
"postpack": "backstage-cli package postpack",
|
|
44
|
-
"
|
|
45
|
-
"test": "backstage-cli package test"
|
|
40
|
+
"clean": "backstage-cli package clean"
|
|
46
41
|
},
|
|
47
42
|
"dependencies": {
|
|
48
|
-
"@backstage/backend-common": "^0.21.3
|
|
49
|
-
"@backstage/backend-plugin-api": "^0.6.13
|
|
50
|
-
"@backstage/backend-tasks": "^0.5.18
|
|
51
|
-
"@backstage/config": "^1.1.
|
|
43
|
+
"@backstage/backend-common": "^0.21.3",
|
|
44
|
+
"@backstage/backend-plugin-api": "^0.6.13",
|
|
45
|
+
"@backstage/backend-tasks": "^0.5.18",
|
|
46
|
+
"@backstage/config": "^1.1.1",
|
|
52
47
|
"@backstage/plugin-explore-common": "^0.0.2",
|
|
53
|
-
"@backstage/plugin-search-backend-node": "^1.2.17
|
|
54
|
-
"@backstage/plugin-search-common": "^1.2.
|
|
48
|
+
"@backstage/plugin-search-backend-node": "^1.2.17",
|
|
49
|
+
"@backstage/plugin-search-common": "^1.2.10",
|
|
55
50
|
"node-fetch": "^2.6.7",
|
|
56
51
|
"winston": "^3.2.1"
|
|
57
52
|
},
|
|
58
53
|
"devDependencies": {
|
|
59
|
-
"@backstage/backend-test-utils": "^0.3.3
|
|
60
|
-
"@backstage/cli": "^0.25.
|
|
54
|
+
"@backstage/backend-test-utils": "^0.3.3",
|
|
55
|
+
"@backstage/cli": "^0.25.2",
|
|
61
56
|
"msw": "^1.2.1"
|
|
62
57
|
},
|
|
58
|
+
"files": [
|
|
59
|
+
"dist",
|
|
60
|
+
"config.d.ts",
|
|
61
|
+
"alpha"
|
|
62
|
+
],
|
|
63
63
|
"configSchema": "config.d.ts"
|
|
64
64
|
}
|