@backstage/plugin-search-backend-module-explore 0.1.4-next.1 → 0.1.4
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 +28 -0
- package/README.md +13 -24
- package/alpha/package.json +1 -1
- package/config.d.ts +33 -0
- package/dist/alpha.cjs.js +42 -35
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/alpha.d.ts +4 -12
- package/package.json +10 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @backstage/plugin-search-backend-module-explore
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 629cbd194a87: Use `coreServices.rootConfig` instead of `coreService.config`
|
|
8
|
+
- 29f77f923c71: Ensure that all services are dependency injected into the module instead of taken from options
|
|
9
|
+
- 12a8c94eda8d: Add package repository and homepage metadata
|
|
10
|
+
- 6694e79ab396: Breaking change for the alpha export moved `schedule` from module options into app-config for the new backend system. You can now pass in a `TaskScheduleDefinitionConfig` through the `search.collators.explore.schedule` configuration key.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/backend-common@0.19.2
|
|
13
|
+
- @backstage/backend-plugin-api@0.6.0
|
|
14
|
+
- @backstage/plugin-search-backend-node@1.2.4
|
|
15
|
+
- @backstage/backend-tasks@0.5.5
|
|
16
|
+
- @backstage/config@1.0.8
|
|
17
|
+
- @backstage/plugin-explore-common@0.0.1
|
|
18
|
+
- @backstage/plugin-search-common@1.2.5
|
|
19
|
+
|
|
20
|
+
## 0.1.4-next.2
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 29f77f923c71: Ensure that all services are dependency injected into the module instead of taken from options
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
- @backstage/backend-plugin-api@0.6.0-next.2
|
|
27
|
+
- @backstage/backend-tasks@0.5.5-next.2
|
|
28
|
+
- @backstage/backend-common@0.19.2-next.2
|
|
29
|
+
- @backstage/plugin-search-backend-node@1.2.4-next.2
|
|
30
|
+
|
|
3
31
|
## 0.1.4-next.1
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -2,47 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
> DISCLAIMER: The new backend system is in alpha, and so are the search backend module support for the new backend system. We don't recommend you to migrate your backend installations to the new system yet. But if you want to experiment, you can find getting started guides below.
|
|
4
4
|
|
|
5
|
-
This package exports
|
|
5
|
+
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).
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Add the module package as a dependency:
|
|
10
10
|
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { searchPlugin } from '@backstage/plugin-search-backend/alpha';
|
|
15
|
-
import { searchModuleExploreCollator } from '@backstage/plugin-search-backend-module-explore/alpha';
|
|
16
|
-
|
|
17
|
-
const backend = createBackend();
|
|
18
|
-
backend.add(searchPlugin());
|
|
19
|
-
backend.add(searchModuleExploreCollator());
|
|
20
|
-
backend.start();
|
|
11
|
+
```bash
|
|
12
|
+
# From your Backstage root directory
|
|
13
|
+
yarn add --cwd packages/backend @backstage/plugin-search-backend-module-explore
|
|
21
14
|
```
|
|
22
15
|
|
|
23
|
-
|
|
16
|
+
Add the collator to your backend instance, along with the search plugin itself:
|
|
24
17
|
|
|
25
18
|
```tsx
|
|
26
|
-
// packages/backend
|
|
19
|
+
// packages/backend/src/index.ts
|
|
27
20
|
import { createBackend } from '@backstage/backend-defaults';
|
|
28
21
|
import { searchPlugin } from '@backstage/plugin-search-backend/alpha';
|
|
29
22
|
import { searchModuleExploreCollator } from '@backstage/plugin-search-backend-module-explore/alpha';
|
|
30
23
|
|
|
31
|
-
const schedule = {
|
|
32
|
-
frequency: { minutes: 10 },
|
|
33
|
-
timeout: { minutes: 15 },
|
|
34
|
-
initialDelay: { seconds: 3 },
|
|
35
|
-
};
|
|
36
|
-
|
|
37
24
|
const backend = createBackend();
|
|
38
25
|
backend.add(searchPlugin());
|
|
39
|
-
backend.add(searchModuleExploreCollator(
|
|
26
|
+
backend.add(searchModuleExploreCollator());
|
|
40
27
|
backend.start();
|
|
41
28
|
```
|
|
42
29
|
|
|
43
|
-
|
|
30
|
+
You may also want to add configuration parameters to your app-config, for example for controlling the scheduled indexing interval. These parameters should be placed under the `search.collators.explore` key. See [the config definition file](https://github.com/backstage/backstage/blob/master/plugins/search-backend-module-explore/config.d.ts) for more details.
|
|
31
|
+
|
|
32
|
+
## Using Auth Middleware
|
|
44
33
|
|
|
45
|
-
If your Backstage instance uses service-to-service authentication
|
|
34
|
+
If your Backstage instance uses service-to-service authentication, the collator will need to have access to a `tokenManager`. This is automatically injected by the collator module when using the new backend system. But if you are using the old backend system, you will want to add it manually to ensure that the collator makes authenticated requests to the explore backend.
|
|
46
35
|
|
|
47
36
|
```tsx
|
|
48
37
|
indexBuilder.addCollator({
|
package/alpha/package.json
CHANGED
package/config.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 The Backstage Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { TaskScheduleDefinitionConfig } from '@backstage/backend-tasks';
|
|
18
|
+
|
|
19
|
+
export interface Config {
|
|
20
|
+
search?: {
|
|
21
|
+
collators?: {
|
|
22
|
+
/**
|
|
23
|
+
* Configuration options for `@backstage/plugin-search-backend-module-explore`
|
|
24
|
+
*/
|
|
25
|
+
explore?: {
|
|
26
|
+
/**
|
|
27
|
+
* The schedule for how often to run the collation job.
|
|
28
|
+
*/
|
|
29
|
+
schedule?: TaskScheduleDefinitionConfig;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}
|
package/dist/alpha.cjs.js
CHANGED
|
@@ -6,42 +6,49 @@ var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
|
6
6
|
var backendCommon = require('@backstage/backend-common');
|
|
7
7
|
var alpha = require('@backstage/plugin-search-backend-node/alpha');
|
|
8
8
|
var pluginSearchBackendModuleExplore = require('@backstage/plugin-search-backend-module-explore');
|
|
9
|
+
var backendTasks = require('@backstage/backend-tasks');
|
|
9
10
|
|
|
10
|
-
const searchModuleExploreCollator = backendPluginApi.createBackendModule(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
11
|
+
const searchModuleExploreCollator = backendPluginApi.createBackendModule({
|
|
12
|
+
moduleId: "exploreCollator",
|
|
13
|
+
pluginId: "search",
|
|
14
|
+
register(env) {
|
|
15
|
+
env.registerInit({
|
|
16
|
+
deps: {
|
|
17
|
+
config: backendPluginApi.coreServices.rootConfig,
|
|
18
|
+
logger: backendPluginApi.coreServices.logger,
|
|
19
|
+
discovery: backendPluginApi.coreServices.discovery,
|
|
20
|
+
scheduler: backendPluginApi.coreServices.scheduler,
|
|
21
|
+
tokenManager: backendPluginApi.coreServices.tokenManager,
|
|
22
|
+
indexRegistry: alpha.searchIndexRegistryExtensionPoint
|
|
23
|
+
},
|
|
24
|
+
async init({
|
|
25
|
+
config,
|
|
26
|
+
logger,
|
|
27
|
+
discovery,
|
|
28
|
+
scheduler,
|
|
29
|
+
indexRegistry,
|
|
30
|
+
tokenManager
|
|
31
|
+
}) {
|
|
32
|
+
const defaultSchedule = {
|
|
33
|
+
frequency: { minutes: 10 },
|
|
34
|
+
timeout: { minutes: 15 },
|
|
35
|
+
initialDelay: { seconds: 3 }
|
|
36
|
+
};
|
|
37
|
+
const schedule = config.has("search.collators.explore.schedule") ? backendTasks.readTaskScheduleDefinitionFromConfig(
|
|
38
|
+
config.getConfig("search.collators.explore.schedule")
|
|
39
|
+
) : defaultSchedule;
|
|
40
|
+
indexRegistry.addCollator({
|
|
41
|
+
schedule: scheduler.createScheduledTaskRunner(schedule),
|
|
42
|
+
factory: pluginSearchBackendModuleExplore.ToolDocumentCollatorFactory.fromConfig(config, {
|
|
43
|
+
discovery,
|
|
44
|
+
logger: backendCommon.loggerToWinstonLogger(logger),
|
|
45
|
+
tokenManager
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
45
52
|
|
|
46
53
|
exports.searchModuleExploreCollator = searchModuleExploreCollator;
|
|
47
54
|
//# sourceMappingURL=alpha.cjs.js.map
|
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\n/**\n * @packageDocumentation\n * A module for the search backend that exports Explore modules.\n */\n\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport {
|
|
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\n/**\n * @packageDocumentation\n * A module for the search backend that exports Explore modules.\n */\n\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { loggerToWinstonLogger } from '@backstage/backend-common';\nimport { searchIndexRegistryExtensionPoint } from '@backstage/plugin-search-backend-node/alpha';\n\nimport { ToolDocumentCollatorFactory } from '@backstage/plugin-search-backend-module-explore';\nimport { readTaskScheduleDefinitionFromConfig } from '@backstage/backend-tasks';\n\n/**\n * Search backend module for the Explore index.\n *\n * @alpha\n */\nexport const searchModuleExploreCollator = createBackendModule({\n moduleId: 'exploreCollator',\n pluginId: 'search',\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 tokenManager: coreServices.tokenManager,\n indexRegistry: searchIndexRegistryExtensionPoint,\n },\n async init({\n config,\n logger,\n discovery,\n scheduler,\n indexRegistry,\n tokenManager,\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 ? readTaskScheduleDefinitionFromConfig(\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: loggerToWinstonLogger(logger),\n tokenManager,\n }),\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","coreServices","searchIndexRegistryExtensionPoint","readTaskScheduleDefinitionFromConfig","ToolDocumentCollatorFactory","loggerToWinstonLogger"],"mappings":";;;;;;;;;;AAoCO,MAAM,8BAA8BA,oCAAoB,CAAA;AAAA,EAC7D,QAAU,EAAA,iBAAA;AAAA,EACV,QAAU,EAAA,QAAA;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,cAAcA,6BAAa,CAAA,YAAA;AAAA,QAC3B,aAAe,EAAAC,uCAAA;AAAA,OACjB;AAAA,MACA,MAAM,IAAK,CAAA;AAAA,QACT,MAAA;AAAA,QACA,MAAA;AAAA,QACA,SAAA;AAAA,QACA,SAAA;AAAA,QACA,aAAA;AAAA,QACA,YAAA;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,EAAA;AAAA,SAC7B,CAAA;AAEA,QAAA,MAAM,QAAW,GAAA,MAAA,CAAO,GAAI,CAAA,mCAAmC,CAC3D,GAAAC,iDAAA;AAAA,UACE,MAAA,CAAO,UAAU,mCAAmC,CAAA;AAAA,SAEtD,GAAA,eAAA,CAAA;AAEJ,QAAA,aAAA,CAAc,WAAY,CAAA;AAAA,UACxB,QAAA,EAAU,SAAU,CAAA,yBAAA,CAA0B,QAAQ,CAAA;AAAA,UACtD,OAAA,EAASC,4DAA4B,CAAA,UAAA,CAAW,MAAQ,EAAA;AAAA,YACtD,SAAA;AAAA,YACA,MAAA,EAAQC,oCAAsB,MAAM,CAAA;AAAA,YACpC,YAAA;AAAA,WACD,CAAA;AAAA,SACF,CAAA,CAAA;AAAA,OACH;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
|
-
import { TaskScheduleDefinition } from '@backstage/backend-tasks';
|
|
3
|
-
import { ToolDocumentCollatorFactoryOptions } from '@backstage/plugin-search-backend-module-explore';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
|
-
* @alpha
|
|
7
|
-
* Options for {@link searchModuleExploreCollator}.
|
|
8
|
-
*/
|
|
9
|
-
type SearchModuleExploreCollatorOptions = Omit<ToolDocumentCollatorFactoryOptions, 'logger' | 'discovery'> & {
|
|
10
|
-
schedule?: TaskScheduleDefinition;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* @alpha
|
|
14
4
|
* Search backend module for the Explore index.
|
|
5
|
+
*
|
|
6
|
+
* @alpha
|
|
15
7
|
*/
|
|
16
|
-
declare const searchModuleExploreCollator: (
|
|
8
|
+
declare const searchModuleExploreCollator: () => _backstage_backend_plugin_api.BackendFeature;
|
|
17
9
|
|
|
18
|
-
export {
|
|
10
|
+
export { searchModuleExploreCollator };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-search-backend-module-explore",
|
|
3
3
|
"description": "A module for the search backend that exports explore modules",
|
|
4
|
-
"version": "0.1.4
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -40,23 +40,25 @@
|
|
|
40
40
|
"clean": "backstage-cli package clean"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@backstage/backend-common": "^0.19.2
|
|
44
|
-
"@backstage/backend-plugin-api": "^0.6.0
|
|
45
|
-
"@backstage/backend-tasks": "^0.5.5
|
|
43
|
+
"@backstage/backend-common": "^0.19.2",
|
|
44
|
+
"@backstage/backend-plugin-api": "^0.6.0",
|
|
45
|
+
"@backstage/backend-tasks": "^0.5.5",
|
|
46
46
|
"@backstage/config": "^1.0.8",
|
|
47
47
|
"@backstage/plugin-explore-common": "^0.0.1",
|
|
48
|
-
"@backstage/plugin-search-backend-node": "^1.2.4
|
|
48
|
+
"@backstage/plugin-search-backend-node": "^1.2.4",
|
|
49
49
|
"@backstage/plugin-search-common": "^1.2.5",
|
|
50
50
|
"node-fetch": "^2.6.7",
|
|
51
51
|
"winston": "^3.2.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@backstage/backend-test-utils": "^0.2.0
|
|
55
|
-
"@backstage/cli": "^0.22.10
|
|
54
|
+
"@backstage/backend-test-utils": "^0.2.0",
|
|
55
|
+
"@backstage/cli": "^0.22.10",
|
|
56
56
|
"msw": "^1.2.1"
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
59
|
"dist",
|
|
60
|
+
"config.d.ts",
|
|
60
61
|
"alpha"
|
|
61
|
-
]
|
|
62
|
+
],
|
|
63
|
+
"configSchema": "config.d.ts"
|
|
62
64
|
}
|