@backstage/plugin-search-backend-node 0.6.0-next.1 → 0.6.0
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 +92 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,97 @@
|
|
|
1
1
|
# @backstage/plugin-search-backend-node
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
`Scheduler.addToSchedule()` now takes a new parameter object (`ScheduleTaskParameters`) with two new options `id` and `scheduledRunner` in addition to the migrated `task` argument.
|
|
10
|
+
|
|
11
|
+
NOTE: The search backend plugin now creates a dedicated database for coordinating indexing tasks.
|
|
12
|
+
|
|
13
|
+
To make this change to an existing app, make the following changes to `packages/backend/src/plugins/search.ts`:
|
|
14
|
+
|
|
15
|
+
```diff
|
|
16
|
+
+import { Duration } from 'luxon';
|
|
17
|
+
|
|
18
|
+
/* ... */
|
|
19
|
+
|
|
20
|
+
+ const schedule = env.scheduler.createScheduledTaskRunner({
|
|
21
|
+
+ frequency: Duration.fromObject({ minutes: 10 }),
|
|
22
|
+
+ timeout: Duration.fromObject({ minutes: 15 }),
|
|
23
|
+
+ initialDelay: Duration.fromObject({ seconds: 3 }),
|
|
24
|
+
+ });
|
|
25
|
+
|
|
26
|
+
indexBuilder.addCollator({
|
|
27
|
+
- defaultRefreshIntervalSeconds: 600,
|
|
28
|
+
+ schedule,
|
|
29
|
+
factory: DefaultCatalogCollatorFactory.fromConfig(env.config, {
|
|
30
|
+
discovery: env.discovery,
|
|
31
|
+
tokenManager: env.tokenManager,
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
indexBuilder.addCollator({
|
|
36
|
+
- defaultRefreshIntervalSeconds: 600,
|
|
37
|
+
+ schedule,
|
|
38
|
+
factory: DefaultTechDocsCollatorFactory.fromConfig(env.config, {
|
|
39
|
+
discovery: env.discovery,
|
|
40
|
+
tokenManager: env.tokenManager,
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const { scheduler } = await indexBuilder.build();
|
|
45
|
+
- setTimeout(() => scheduler.start(), 3000);
|
|
46
|
+
+ scheduler.start();
|
|
47
|
+
/* ... */
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
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
|
|
51
|
+
the search plugin to use a non-distributed DB such as [SQLite](https://backstage.io/docs/tutorials/configuring-plugin-databases#postgresql-and-sqlite-3)):
|
|
52
|
+
|
|
53
|
+
```diff
|
|
54
|
+
+import { TaskInvocationDefinition, TaskRunner } from '@backstage/backend-tasks';
|
|
55
|
+
|
|
56
|
+
/* ... */
|
|
57
|
+
|
|
58
|
+
+ const schedule: TaskRunner = {
|
|
59
|
+
+ run: async (task: TaskInvocationDefinition) => {
|
|
60
|
+
+ const startRefresh = async () => {
|
|
61
|
+
+ while (!task.signal?.aborted) {
|
|
62
|
+
+ try {
|
|
63
|
+
+ await task.fn(task.signal);
|
|
64
|
+
+ } catch {
|
|
65
|
+
+ // ignore intentionally
|
|
66
|
+
+ }
|
|
67
|
+
+
|
|
68
|
+
+ await new Promise(resolve => setTimeout(resolve, 600 * 1000));
|
|
69
|
+
+ }
|
|
70
|
+
+ };
|
|
71
|
+
+ startRefresh();
|
|
72
|
+
+ },
|
|
73
|
+
+ };
|
|
74
|
+
|
|
75
|
+
indexBuilder.addCollator({
|
|
76
|
+
- defaultRefreshIntervalSeconds: 600,
|
|
77
|
+
+ schedule,
|
|
78
|
+
factory: DefaultCatalogCollatorFactory.fromConfig(env.config, {
|
|
79
|
+
discovery: env.discovery,
|
|
80
|
+
tokenManager: env.tokenManager,
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
/* ... */
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- 62ee65422c: Use new `IndexableResultSet` type as return type of query method in `SearchEngine` implementation.
|
|
90
|
+
- 230ad0826f: Bump to using `@types/node` v16
|
|
91
|
+
- Updated dependencies
|
|
92
|
+
- @backstage/backend-tasks@0.3.0
|
|
93
|
+
- @backstage/plugin-search-common@0.3.3
|
|
94
|
+
|
|
3
95
|
## 0.6.0-next.1
|
|
4
96
|
|
|
5
97
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-search-backend-node",
|
|
3
3
|
"description": "A library for Backstage backend plugins that want to interact with the search backend plugin",
|
|
4
|
-
"version": "0.6.0
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"clean": "backstage-cli package clean"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@backstage/backend-tasks": "^0.3.0
|
|
26
|
+
"@backstage/backend-tasks": "^0.3.0",
|
|
27
27
|
"@backstage/errors": "^1.0.0",
|
|
28
|
-
"@backstage/plugin-search-common": "^0.3.3
|
|
28
|
+
"@backstage/plugin-search-common": "^0.3.3",
|
|
29
29
|
"@types/lunr": "^2.3.3",
|
|
30
30
|
"lodash": "^4.17.21",
|
|
31
31
|
"lunr": "^2.3.9",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"winston": "^3.2.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@backstage/backend-common": "^0.13.2
|
|
37
|
-
"@backstage/cli": "^0.17.0
|
|
36
|
+
"@backstage/backend-common": "^0.13.2",
|
|
37
|
+
"@backstage/cli": "^0.17.0"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"dist"
|
|
41
41
|
],
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "e0e44c433319711c2fb8b175db411a621f7aaec2"
|
|
43
43
|
}
|