@backstage/plugin-search-backend-module-explore 0.2.3-next.1 → 0.2.3
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 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +3 -45
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/alpha.d.ts +3 -7
- package/dist/collators/ToolDocumentCollatorFactory.cjs.js +59 -0
- package/dist/collators/ToolDocumentCollatorFactory.cjs.js.map +1 -0
- package/dist/index.cjs.js +5 -52
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/module.cjs.js +52 -0
- package/dist/module.cjs.js.map +1 -0
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @backstage/plugin-search-backend-module-explore
|
|
2
2
|
|
|
3
|
+
## 0.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 094eaa3: Remove references to in-repo backend-common
|
|
8
|
+
- 3109c24: The export for the new backend system at the `/alpha` export is now also available via the main entry point, which means that you can remove the `/alpha` suffix from the import.
|
|
9
|
+
- c052931: Updated dependency `@backstage-community/plugin-explore-common` to `^0.0.6`.
|
|
10
|
+
- 2f88f88: Updated backend installation instructions.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/plugin-search-backend-node@1.3.3
|
|
13
|
+
- @backstage/backend-plugin-api@1.0.1
|
|
14
|
+
- @backstage/config@1.2.0
|
|
15
|
+
- @backstage/plugin-search-common@1.2.14
|
|
16
|
+
|
|
17
|
+
## 0.2.3-next.2
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- c052931: Updated dependency `@backstage-community/plugin-explore-common` to `^0.0.6`.
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @backstage/backend-plugin-api@1.0.1-next.1
|
|
24
|
+
- @backstage/config@1.2.0
|
|
25
|
+
- @backstage/plugin-search-backend-node@1.3.3-next.2
|
|
26
|
+
- @backstage/plugin-search-common@1.2.14
|
|
27
|
+
|
|
3
28
|
## 0.2.3-next.1
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.cjs.js
CHANGED
|
@@ -2,51 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var alpha$1 = require('@backstage/plugin-search-backend-node/alpha');
|
|
7
|
-
var pluginSearchBackendModuleExplore = require('@backstage/plugin-search-backend-module-explore');
|
|
5
|
+
var module$1 = require('./module.cjs.js');
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
pluginId: "search",
|
|
11
|
-
moduleId: "explore-collator",
|
|
12
|
-
register(env) {
|
|
13
|
-
env.registerInit({
|
|
14
|
-
deps: {
|
|
15
|
-
config: backendPluginApi.coreServices.rootConfig,
|
|
16
|
-
logger: backendPluginApi.coreServices.logger,
|
|
17
|
-
discovery: backendPluginApi.coreServices.discovery,
|
|
18
|
-
scheduler: backendPluginApi.coreServices.scheduler,
|
|
19
|
-
auth: backendPluginApi.coreServices.auth,
|
|
20
|
-
indexRegistry: alpha$1.searchIndexRegistryExtensionPoint
|
|
21
|
-
},
|
|
22
|
-
async init({
|
|
23
|
-
config,
|
|
24
|
-
logger,
|
|
25
|
-
discovery,
|
|
26
|
-
scheduler,
|
|
27
|
-
auth,
|
|
28
|
-
indexRegistry
|
|
29
|
-
}) {
|
|
30
|
-
const defaultSchedule = {
|
|
31
|
-
frequency: { minutes: 10 },
|
|
32
|
-
timeout: { minutes: 15 },
|
|
33
|
-
initialDelay: { seconds: 3 }
|
|
34
|
-
};
|
|
35
|
-
const schedule = config.has("search.collators.explore.schedule") ? backendPluginApi.readSchedulerServiceTaskScheduleDefinitionFromConfig(
|
|
36
|
-
config.getConfig("search.collators.explore.schedule")
|
|
37
|
-
) : defaultSchedule;
|
|
38
|
-
indexRegistry.addCollator({
|
|
39
|
-
schedule: scheduler.createScheduledTaskRunner(schedule),
|
|
40
|
-
factory: pluginSearchBackendModuleExplore.ToolDocumentCollatorFactory.fromConfig(config, {
|
|
41
|
-
discovery,
|
|
42
|
-
logger,
|
|
43
|
-
auth
|
|
44
|
-
})
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
});
|
|
7
|
+
const _feature = module$1.default;
|
|
50
8
|
|
|
51
|
-
exports.default =
|
|
9
|
+
exports.default = _feature;
|
|
52
10
|
//# 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
|
|
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,QAAW,GAAAA;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* @alpha
|
|
7
|
-
*/
|
|
8
|
-
declare const _default: _backstage_backend_plugin_api.BackendFeature;
|
|
3
|
+
/** @alpha */
|
|
4
|
+
declare const _feature: _backstage_backend_plugin_api.BackendFeature;
|
|
9
5
|
|
|
10
|
-
export {
|
|
6
|
+
export { _feature as default };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var backendCommon = require('@backstage/backend-common');
|
|
4
|
+
var fetch = require('node-fetch');
|
|
5
|
+
var stream = require('stream');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var fetch__default = /*#__PURE__*/_interopDefaultCompat(fetch);
|
|
10
|
+
|
|
11
|
+
class ToolDocumentCollatorFactory {
|
|
12
|
+
type = "tools";
|
|
13
|
+
discovery;
|
|
14
|
+
logger;
|
|
15
|
+
auth;
|
|
16
|
+
constructor(options) {
|
|
17
|
+
this.discovery = options.discovery;
|
|
18
|
+
this.logger = options.logger;
|
|
19
|
+
this.auth = backendCommon.createLegacyAuthAdapters(options).auth;
|
|
20
|
+
}
|
|
21
|
+
static fromConfig(_config, options) {
|
|
22
|
+
return new ToolDocumentCollatorFactory(options);
|
|
23
|
+
}
|
|
24
|
+
async getCollator() {
|
|
25
|
+
return stream.Readable.from(this.execute());
|
|
26
|
+
}
|
|
27
|
+
async *execute() {
|
|
28
|
+
this.logger.info("Starting collation of explore tools");
|
|
29
|
+
const tools = await this.fetchTools();
|
|
30
|
+
for (const tool of tools) {
|
|
31
|
+
yield {
|
|
32
|
+
...tool,
|
|
33
|
+
text: tool.description,
|
|
34
|
+
location: tool.url
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
this.logger.info("Finished collation of explore tools");
|
|
38
|
+
}
|
|
39
|
+
async fetchTools() {
|
|
40
|
+
const baseUrl = await this.discovery.getBaseUrl("explore");
|
|
41
|
+
const { token } = await this.auth.getPluginRequestToken({
|
|
42
|
+
onBehalfOf: await this.auth.getOwnServiceCredentials(),
|
|
43
|
+
targetPluginId: "explore"
|
|
44
|
+
});
|
|
45
|
+
const response = await fetch__default.default(`${baseUrl}/tools`, {
|
|
46
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
47
|
+
});
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`Failed to explore fetch tools, ${response.status}: ${response.statusText}`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
const data = await response.json();
|
|
54
|
+
return data.tools;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
exports.ToolDocumentCollatorFactory = ToolDocumentCollatorFactory;
|
|
59
|
+
//# sourceMappingURL=ToolDocumentCollatorFactory.cjs.js.map
|
|
@@ -0,0 +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 createLegacyAuthAdapters,\n TokenManager,\n} from '@backstage/backend-common';\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 fetch from 'node-fetch';\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 * @public\n * @deprecated This type is deprecated along with the {@link ToolDocumentCollatorFactory}.\n */\nexport type ToolDocumentCollatorFactoryOptions = {\n discovery: DiscoveryService;\n logger: LoggerService;\n tokenManager?: TokenManager;\n auth?: AuthService;\n};\n\n/**\n * Search collator responsible for collecting explore tools to index.\n *\n * @public\n * @deprecated Migrate to the {@link https://backstage.io/docs/backend-system/building-backends/migrating | new backend system} and install this collator via module instead (see {@link https://github.com/backstage/backstage/blob/nbs10/search-deprecate-create-router/plugins/search-backend-module-explore/README.md#installation | here} for more installation details).\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 = createLegacyAuthAdapters(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":["createLegacyAuthAdapters","Readable","fetch"],"mappings":";;;;;;;;;;AA0DO,MAAM,2BAA+D,CAAA;AAAA,EAC1D,IAAe,GAAA,OAAA,CAAA;AAAA,EAEd,SAAA,CAAA;AAAA,EACA,MAAA,CAAA;AAAA,EACA,IAAA,CAAA;AAAA,EAET,YAAY,OAA6C,EAAA;AAC/D,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,SAAA,CAAA;AACzB,IAAA,IAAA,CAAK,SAAS,OAAQ,CAAA,MAAA,CAAA;AACtB,IAAK,IAAA,CAAA,IAAA,GAAOA,sCAAyB,CAAA,OAAO,CAAE,CAAA,IAAA,CAAA;AAAA,GAChD;AAAA,EAEA,OAAO,UACL,CAAA,OAAA,EACA,OACA,EAAA;AACA,IAAO,OAAA,IAAI,4BAA4B,OAAO,CAAA,CAAA;AAAA,GAChD;AAAA,EAEA,MAAM,WAAc,GAAA;AAClB,IAAA,OAAOC,eAAS,CAAA,IAAA,CAAK,IAAK,CAAA,OAAA,EAAS,CAAA,CAAA;AAAA,GACrC;AAAA,EAEA,OAAO,OAAwC,GAAA;AAC7C,IAAK,IAAA,CAAA,MAAA,CAAO,KAAK,qCAAqC,CAAA,CAAA;AAEtD,IAAM,MAAA,KAAA,GAAQ,MAAM,IAAA,CAAK,UAAW,EAAA,CAAA;AAEpC,IAAA,KAAA,MAAW,QAAQ,KAAO,EAAA;AACxB,MAAM,MAAA;AAAA,QACJ,GAAG,IAAA;AAAA,QACH,MAAM,IAAK,CAAA,WAAA;AAAA,QACX,UAAU,IAAK,CAAA,GAAA;AAAA,OACjB,CAAA;AAAA,KACF;AAEA,IAAK,IAAA,CAAA,MAAA,CAAO,KAAK,qCAAqC,CAAA,CAAA;AAAA,GACxD;AAAA,EAEA,MAAc,UAAa,GAAA;AACzB,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,SAAA,CAAU,WAAW,SAAS,CAAA,CAAA;AAEzD,IAAA,MAAM,EAAE,KAAM,EAAA,GAAI,MAAM,IAAA,CAAK,KAAK,qBAAsB,CAAA;AAAA,MACtD,UAAY,EAAA,MAAM,IAAK,CAAA,IAAA,CAAK,wBAAyB,EAAA;AAAA,MACrD,cAAgB,EAAA,SAAA;AAAA,KACjB,CAAA,CAAA;AACD,IAAA,MAAM,QAAW,GAAA,MAAMC,sBAAM,CAAA,CAAA,EAAG,OAAO,CAAU,MAAA,CAAA,EAAA;AAAA,MAC/C,OAAS,EAAA,EAAE,aAAe,EAAA,CAAA,OAAA,EAAU,KAAK,CAAG,CAAA,EAAA;AAAA,KAC7C,CAAA,CAAA;AAED,IAAI,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.cjs.js
CHANGED
|
@@ -1,59 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var fetch = require('node-fetch');
|
|
5
|
-
var stream = require('stream');
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
var ToolDocumentCollatorFactory = require('./collators/ToolDocumentCollatorFactory.cjs.js');
|
|
6
|
+
var module$1 = require('./module.cjs.js');
|
|
8
7
|
|
|
9
|
-
var fetch__default = /*#__PURE__*/_interopDefaultCompat(fetch);
|
|
10
8
|
|
|
11
|
-
class ToolDocumentCollatorFactory {
|
|
12
|
-
type = "tools";
|
|
13
|
-
discovery;
|
|
14
|
-
logger;
|
|
15
|
-
auth;
|
|
16
|
-
constructor(options) {
|
|
17
|
-
this.discovery = options.discovery;
|
|
18
|
-
this.logger = options.logger;
|
|
19
|
-
this.auth = backendCommon.createLegacyAuthAdapters(options).auth;
|
|
20
|
-
}
|
|
21
|
-
static fromConfig(_config, options) {
|
|
22
|
-
return new ToolDocumentCollatorFactory(options);
|
|
23
|
-
}
|
|
24
|
-
async getCollator() {
|
|
25
|
-
return stream.Readable.from(this.execute());
|
|
26
|
-
}
|
|
27
|
-
async *execute() {
|
|
28
|
-
this.logger.info("Starting collation of explore tools");
|
|
29
|
-
const tools = await this.fetchTools();
|
|
30
|
-
for (const tool of tools) {
|
|
31
|
-
yield {
|
|
32
|
-
...tool,
|
|
33
|
-
text: tool.description,
|
|
34
|
-
location: tool.url
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
this.logger.info("Finished collation of explore tools");
|
|
38
|
-
}
|
|
39
|
-
async fetchTools() {
|
|
40
|
-
const baseUrl = await this.discovery.getBaseUrl("explore");
|
|
41
|
-
const { token } = await this.auth.getPluginRequestToken({
|
|
42
|
-
onBehalfOf: await this.auth.getOwnServiceCredentials(),
|
|
43
|
-
targetPluginId: "explore"
|
|
44
|
-
});
|
|
45
|
-
const response = await fetch__default.default(`${baseUrl}/tools`, {
|
|
46
|
-
headers: { Authorization: `Bearer ${token}` }
|
|
47
|
-
});
|
|
48
|
-
if (!response.ok) {
|
|
49
|
-
throw new Error(
|
|
50
|
-
`Failed to explore fetch tools, ${response.status}: ${response.statusText}`
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
const data = await response.json();
|
|
54
|
-
return data.tools;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
9
|
|
|
58
|
-
exports.ToolDocumentCollatorFactory = ToolDocumentCollatorFactory;
|
|
10
|
+
exports.ToolDocumentCollatorFactory = ToolDocumentCollatorFactory.ToolDocumentCollatorFactory;
|
|
11
|
+
exports.default = module$1.default;
|
|
59
12
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { TokenManager } from '@backstage/backend-common';
|
|
3
|
+
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
3
4
|
import { DiscoveryService, LoggerService, AuthService } from '@backstage/backend-plugin-api';
|
|
4
5
|
import { Config } from '@backstage/config';
|
|
5
6
|
import { ExploreTool } from '@backstage-community/plugin-explore-common';
|
|
@@ -41,4 +42,11 @@ declare class ToolDocumentCollatorFactory implements DocumentCollatorFactory {
|
|
|
41
42
|
private fetchTools;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Search backend module for the Explore index.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
declare const _default: _backstage_backend_plugin_api.BackendFeature;
|
|
51
|
+
|
|
52
|
+
export { type ToolDocument, ToolDocumentCollatorFactory, type ToolDocumentCollatorFactoryOptions, _default as default };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
6
|
+
var alpha = require('@backstage/plugin-search-backend-node/alpha');
|
|
7
|
+
var pluginSearchBackendModuleExplore = require('@backstage/plugin-search-backend-module-explore');
|
|
8
|
+
|
|
9
|
+
var feature = backendPluginApi.createBackendModule({
|
|
10
|
+
pluginId: "search",
|
|
11
|
+
moduleId: "explore-collator",
|
|
12
|
+
register(env) {
|
|
13
|
+
env.registerInit({
|
|
14
|
+
deps: {
|
|
15
|
+
config: backendPluginApi.coreServices.rootConfig,
|
|
16
|
+
logger: backendPluginApi.coreServices.logger,
|
|
17
|
+
discovery: backendPluginApi.coreServices.discovery,
|
|
18
|
+
scheduler: backendPluginApi.coreServices.scheduler,
|
|
19
|
+
auth: backendPluginApi.coreServices.auth,
|
|
20
|
+
indexRegistry: alpha.searchIndexRegistryExtensionPoint
|
|
21
|
+
},
|
|
22
|
+
async init({
|
|
23
|
+
config,
|
|
24
|
+
logger,
|
|
25
|
+
discovery,
|
|
26
|
+
scheduler,
|
|
27
|
+
auth,
|
|
28
|
+
indexRegistry
|
|
29
|
+
}) {
|
|
30
|
+
const defaultSchedule = {
|
|
31
|
+
frequency: { minutes: 10 },
|
|
32
|
+
timeout: { minutes: 15 },
|
|
33
|
+
initialDelay: { seconds: 3 }
|
|
34
|
+
};
|
|
35
|
+
const schedule = config.has("search.collators.explore.schedule") ? backendPluginApi.readSchedulerServiceTaskScheduleDefinitionFromConfig(
|
|
36
|
+
config.getConfig("search.collators.explore.schedule")
|
|
37
|
+
) : defaultSchedule;
|
|
38
|
+
indexRegistry.addCollator({
|
|
39
|
+
schedule: scheduler.createScheduledTaskRunner(schedule),
|
|
40
|
+
factory: pluginSearchBackendModuleExplore.ToolDocumentCollatorFactory.fromConfig(config, {
|
|
41
|
+
discovery,
|
|
42
|
+
logger,
|
|
43
|
+
auth
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
exports.default = feature;
|
|
52
|
+
//# sourceMappingURL=module.cjs.js.map
|
|
@@ -0,0 +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';\n\nimport { ToolDocumentCollatorFactory } from '@backstage/plugin-search-backend-module-explore';\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":";;;;;;;;AAmCA,cAAeA,oCAAoB,CAAA;AAAA,EACjC,QAAU,EAAA,QAAA;AAAA,EACV,QAAU,EAAA,kBAAA;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,MAAMA,6BAAa,CAAA,IAAA;AAAA,QACnB,aAAe,EAAAC,uCAAA;AAAA,OACjB;AAAA,MACA,MAAM,IAAK,CAAA;AAAA,QACT,MAAA;AAAA,QACA,MAAA;AAAA,QACA,SAAA;AAAA,QACA,SAAA;AAAA,QACA,IAAA;AAAA,QACA,aAAA;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,qEAAA;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;AAAA,YACA,IAAA;AAAA,WACD,CAAA;AAAA,SACF,CAAA,CAAA;AAAA,OACH;AAAA,KACD,CAAA,CAAA;AAAA,GACH;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.2.3
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "A module for the search backend that exports explore modules",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
+
"backstage": "@backstage/BackendFeature",
|
|
22
23
|
"require": "./dist/index.cjs.js",
|
|
23
24
|
"types": "./dist/index.d.ts",
|
|
24
25
|
"default": "./dist/index.cjs.js"
|
|
@@ -48,17 +49,17 @@
|
|
|
48
49
|
"test": "backstage-cli package test"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"@backstage-community/plugin-explore-common": "^0.0.
|
|
52
|
+
"@backstage-community/plugin-explore-common": "^0.0.6",
|
|
52
53
|
"@backstage/backend-common": "^0.25.0",
|
|
53
|
-
"@backstage/backend-plugin-api": "1.0.1
|
|
54
|
-
"@backstage/config": "1.2.0",
|
|
55
|
-
"@backstage/plugin-search-backend-node": "1.3.3
|
|
56
|
-
"@backstage/plugin-search-common": "1.2.14",
|
|
54
|
+
"@backstage/backend-plugin-api": "^1.0.1",
|
|
55
|
+
"@backstage/config": "^1.2.0",
|
|
56
|
+
"@backstage/plugin-search-backend-node": "^1.3.3",
|
|
57
|
+
"@backstage/plugin-search-common": "^1.2.14",
|
|
57
58
|
"node-fetch": "^2.7.0"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@backstage/backend-test-utils": "1.0.1
|
|
61
|
-
"@backstage/cli": "0.28.0
|
|
61
|
+
"@backstage/backend-test-utils": "^1.0.1",
|
|
62
|
+
"@backstage/cli": "^0.28.0",
|
|
62
63
|
"msw": "^1.2.1"
|
|
63
64
|
},
|
|
64
65
|
"configSchema": "config.d.ts"
|