@backstage/plugin-search-backend-module-explore 0.3.4 → 0.3.5
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
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @backstage/plugin-search-backend-module-explore
|
|
2
2
|
|
|
3
|
+
## 0.3.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3b8fac1: Updated dependency `@backstage-community/plugin-explore-common` to `^0.5.0`.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-search-backend-node@1.3.14
|
|
10
|
+
- @backstage/backend-plugin-api@1.4.2
|
|
11
|
+
|
|
12
|
+
## 0.3.5-next.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/plugin-search-backend-node@1.3.14-next.0
|
|
18
|
+
- @backstage/backend-plugin-api@1.4.2-next.0
|
|
19
|
+
- @backstage/config@1.3.3
|
|
20
|
+
- @backstage/plugin-search-common@1.2.19
|
|
21
|
+
|
|
3
22
|
## 0.3.4
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/alpha.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.cjs.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { default as feature } from './module';\n\n/** @alpha */\nconst _feature = feature;\nexport default _feature;\n"],"names":["feature"],"mappings":";;;;;;AAmBA,MAAM,
|
|
1
|
+
{"version":3,"file":"alpha.cjs.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { default as feature } from './module';\n\n/** @alpha */\nconst _feature = feature;\nexport default _feature;\n"],"names":["feature"],"mappings":";;;;;;AAmBA,MAAM,QAAA,GAAWA;;;;"}
|
|
@@ -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 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,
|
|
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 );\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yB;AAAA,MACrD,cAAA,EAAgB;AAAA,KACjB,CAAA;AACD,IAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,CAAA,EAAG,OAAO,CAAA,MAAA,CAAA,EAAU;AAAA,MAC/C,OAAA,EAAS,EAAE,aAAA,EAAe,CAAA,OAAA,EAAU,KAAK,CAAA,CAAA;AAAG,KAC7C,CAAA;AAED,IAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,+BAAA,EAAkC,QAAA,CAAS,MAAM,CAAA,EAAA,EAAK,SAAS,UAAU,CAAA;AAAA,OAC3E;AAAA,IACF;AAEA,IAAA,MAAM,IAAA,GAAO,MAAM,QAAA,CAAS,IAAA,EAAK;AACjC,IAAA,OAAO,IAAA,CAAK,KAAA;AAAA,EACd;AACF;;;;"}
|
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';\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,
|
|
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,oCAAA,CAAoB;AAAA,EACjC,QAAA,EAAU,QAAA;AAAA,EACV,QAAA,EAAU,kBAAA;AAAA,EACV,SAAS,GAAA,EAAK;AACZ,IAAA,GAAA,CAAI,YAAA,CAAa;AAAA,MACf,IAAA,EAAM;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,aAAA,EAAeC;AAAA,OACjB;AAAA,MACA,MAAM,IAAA,CAAK;AAAA,QACT,MAAA;AAAA,QACA,MAAA;AAAA,QACA,SAAA;AAAA,QACA,SAAA;AAAA,QACA,IAAA;AAAA,QACA;AAAA,OACF,EAAG;AACD,QAAA,MAAM,eAAA,GAAkB;AAAA,UACtB,SAAA,EAAW,EAAE,OAAA,EAAS,EAAA,EAAG;AAAA,UACzB,OAAA,EAAS,EAAE,OAAA,EAAS,EAAA,EAAG;AAAA,UACvB,YAAA,EAAc,EAAE,OAAA,EAAS,CAAA;AAAE,SAC7B;AAEA,QAAA,MAAM,QAAA,GAAW,MAAA,CAAO,GAAA,CAAI,mCAAmC,CAAA,GAC3DC,qEAAA;AAAA,UACE,MAAA,CAAO,UAAU,mCAAmC;AAAA,SACtD,GACA,eAAA;AAEJ,QAAA,aAAA,CAAc,WAAA,CAAY;AAAA,UACxB,QAAA,EAAU,SAAA,CAAU,yBAAA,CAA0B,QAAQ,CAAA;AAAA,UACtD,OAAA,EAASC,uDAAA,CAA4B,UAAA,CAAW,MAAA,EAAQ;AAAA,YACtD,SAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA,WACD;AAAA,SACF,CAAA;AAAA,MACH;AAAA,KACD,CAAA;AAAA,EACH;AACF,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.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "A module for the search backend that exports explore modules",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -62,15 +62,15 @@
|
|
|
62
62
|
"test": "backstage-cli package test"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@backstage-community/plugin-explore-common": "^0.0
|
|
66
|
-
"@backstage/backend-plugin-api": "^1.4.
|
|
65
|
+
"@backstage-community/plugin-explore-common": "^0.5.0",
|
|
66
|
+
"@backstage/backend-plugin-api": "^1.4.2",
|
|
67
67
|
"@backstage/config": "^1.3.3",
|
|
68
|
-
"@backstage/plugin-search-backend-node": "^1.3.
|
|
68
|
+
"@backstage/plugin-search-backend-node": "^1.3.14",
|
|
69
69
|
"@backstage/plugin-search-common": "^1.2.19"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@backstage/backend-test-utils": "^1.
|
|
73
|
-
"@backstage/cli": "^0.
|
|
72
|
+
"@backstage/backend-test-utils": "^1.8.0",
|
|
73
|
+
"@backstage/cli": "^0.34.0",
|
|
74
74
|
"msw": "^1.2.1"
|
|
75
75
|
},
|
|
76
76
|
"configSchema": "config.d.ts"
|