Version Packages

This commit is contained in:
github-actions[bot]
2022-04-19 14:28:08 +00:00
parent c888455313
commit 3f7acfb96e
459 changed files with 6352 additions and 3402 deletions
+92
View File
@@ -1,5 +1,97 @@
# @backstage/plugin-search-backend-node
## 0.6.0
### Minor Changes
- 0a63e99a26: **BREAKING**: `IndexBuilder.addCollator()` now requires a `schedule` parameter (replacing `defaultRefreshIntervalSeconds`) which is expected to be a `TaskRunner` that is configured with the desired search indexing schedule for the given collator.
`Scheduler.addToSchedule()` now takes a new parameter object (`ScheduleTaskParameters`) with two new options `id` and `scheduledRunner` in addition to the migrated `task` argument.
NOTE: The search backend plugin now creates a dedicated database for coordinating indexing tasks.
To make this change to an existing app, make the following changes to `packages/backend/src/plugins/search.ts`:
```diff
+import { Duration } from 'luxon';
/* ... */
+ const schedule = env.scheduler.createScheduledTaskRunner({
+ frequency: Duration.fromObject({ minutes: 10 }),
+ timeout: Duration.fromObject({ minutes: 15 }),
+ initialDelay: Duration.fromObject({ seconds: 3 }),
+ });
indexBuilder.addCollator({
- defaultRefreshIntervalSeconds: 600,
+ schedule,
factory: DefaultCatalogCollatorFactory.fromConfig(env.config, {
discovery: env.discovery,
tokenManager: env.tokenManager,
}),
});
indexBuilder.addCollator({
- defaultRefreshIntervalSeconds: 600,
+ schedule,
factory: DefaultTechDocsCollatorFactory.fromConfig(env.config, {
discovery: env.discovery,
tokenManager: env.tokenManager,
}),
});
const { scheduler } = await indexBuilder.build();
- setTimeout(() => scheduler.start(), 3000);
+ scheduler.start();
/* ... */
```
NOTE: For scenarios where the `lunr` search engine is used in a multi-node configuration, a non-distributed `TaskRunner` like the following should be implemented to ensure consistency across nodes (alternatively, you can configure
the search plugin to use a non-distributed DB such as [SQLite](https://backstage.io/docs/tutorials/configuring-plugin-databases#postgresql-and-sqlite-3)):
```diff
+import { TaskInvocationDefinition, TaskRunner } from '@backstage/backend-tasks';
/* ... */
+ const schedule: TaskRunner = {
+ run: async (task: TaskInvocationDefinition) => {
+ const startRefresh = async () => {
+ while (!task.signal?.aborted) {
+ try {
+ await task.fn(task.signal);
+ } catch {
+ // ignore intentionally
+ }
+
+ await new Promise(resolve => setTimeout(resolve, 600 * 1000));
+ }
+ };
+ startRefresh();
+ },
+ };
indexBuilder.addCollator({
- defaultRefreshIntervalSeconds: 600,
+ schedule,
factory: DefaultCatalogCollatorFactory.fromConfig(env.config, {
discovery: env.discovery,
tokenManager: env.tokenManager,
}),
});
/* ... */
```
### Patch Changes
- 62ee65422c: Use new `IndexableResultSet` type as return type of query method in `SearchEngine` implementation.
- 230ad0826f: Bump to using `@types/node` v16
- Updated dependencies
- @backstage/backend-tasks@0.3.0
- @backstage/plugin-search-common@0.3.3
## 0.6.0-next.1
### Minor Changes
+5 -5
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-search-backend-node",
"description": "A library for Backstage backend plugins that want to interact with the search backend plugin",
"version": "0.6.0-next.1",
"version": "0.6.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -23,9 +23,9 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/backend-tasks": "^0.3.0-next.2",
"@backstage/backend-tasks": "^0.3.0",
"@backstage/errors": "^1.0.0",
"@backstage/plugin-search-common": "^0.3.3-next.1",
"@backstage/plugin-search-common": "^0.3.3",
"@types/lunr": "^2.3.3",
"lodash": "^4.17.21",
"lunr": "^2.3.9",
@@ -33,8 +33,8 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/backend-common": "^0.13.2-next.2",
"@backstage/cli": "^0.17.0-next.3"
"@backstage/backend-common": "^0.13.2",
"@backstage/cli": "^0.17.0"
},
"files": [
"dist"