@backstage/plugin-search-backend-module-catalog 0.2.3-next.0 → 0.2.3-next.2

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,37 @@
1
1
  # @backstage/plugin-search-backend-module-catalog
2
2
 
3
+ ## 0.2.3-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/plugin-catalog-node@1.13.1-next.1
9
+ - @backstage/catalog-client@1.7.1-next.0
10
+ - @backstage/backend-plugin-api@1.0.1-next.1
11
+ - @backstage/catalog-model@1.7.0
12
+ - @backstage/config@1.2.0
13
+ - @backstage/errors@1.2.4
14
+ - @backstage/plugin-catalog-common@1.1.0
15
+ - @backstage/plugin-permission-common@0.8.1
16
+ - @backstage/plugin-search-backend-node@1.3.3-next.2
17
+ - @backstage/plugin-search-common@1.2.14
18
+
19
+ ## 0.2.3-next.1
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+ - @backstage/backend-plugin-api@1.0.1-next.0
25
+ - @backstage/catalog-client@1.7.0
26
+ - @backstage/catalog-model@1.7.0
27
+ - @backstage/config@1.2.0
28
+ - @backstage/errors@1.2.4
29
+ - @backstage/plugin-catalog-common@1.1.0
30
+ - @backstage/plugin-catalog-node@1.13.1-next.0
31
+ - @backstage/plugin-permission-common@0.8.1
32
+ - @backstage/plugin-search-backend-node@1.3.3-next.1
33
+ - @backstage/plugin-search-common@1.2.14
34
+
3
35
  ## 0.2.3-next.0
4
36
 
5
37
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-backend-module-catalog__alpha",
3
- "version": "0.2.3-next.0",
3
+ "version": "0.2.3-next.2",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
package/dist/alpha.cjs.js CHANGED
@@ -6,8 +6,7 @@ var backendPluginApi = require('@backstage/backend-plugin-api');
6
6
  var alpha$2 = require('@backstage/plugin-catalog-node/alpha');
7
7
  var pluginSearchBackendModuleCatalog = require('@backstage/plugin-search-backend-module-catalog');
8
8
  var alpha$1 = require('@backstage/plugin-search-backend-node/alpha');
9
- var config = require('./cjs/config-BgngnqUm.cjs.js');
10
- require('@backstage/errors');
9
+ var config = require('./collators/config.cjs.js');
11
10
 
12
11
  const catalogCollatorExtensionPoint = backendPluginApi.createExtensionPoint({
13
12
  id: "search.catalogCollator.extension"
@@ -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 Catalog modules.\n */\n\nimport {\n coreServices,\n createBackendModule,\n createExtensionPoint,\n} from '@backstage/backend-plugin-api';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';\nimport {\n CatalogCollatorEntityTransformer,\n DefaultCatalogCollatorFactory,\n} from '@backstage/plugin-search-backend-module-catalog';\nimport { searchIndexRegistryExtensionPoint } from '@backstage/plugin-search-backend-node/alpha';\nimport { readScheduleConfigOptions } from './collators/config';\n\n/**\n * Options for {@link catalogCollatorExtensionPoint}.\n *\n * @alpha\n */\nexport type CatalogCollatorExtensionPoint = {\n /**\n * Allows you to customize how entities are shaped into documents.\n */\n setEntityTransformer(transformer: CatalogCollatorEntityTransformer): void;\n};\n\n/**\n * Extension point for customizing how catalog entities are shaped into\n * documents for the search backend.\n *\n * @alpha\n */\nexport const catalogCollatorExtensionPoint =\n createExtensionPoint<CatalogCollatorExtensionPoint>({\n id: 'search.catalogCollator.extension',\n });\n\n/**\n * Search backend module for the Catalog index.\n *\n * @alpha\n */\nexport default createBackendModule({\n pluginId: 'search',\n moduleId: 'catalog-collator',\n register(env) {\n let entityTransformer: CatalogCollatorEntityTransformer | undefined;\n\n env.registerExtensionPoint(catalogCollatorExtensionPoint, {\n setEntityTransformer(transformer) {\n if (entityTransformer) {\n throw new Error('setEntityTransformer can only be called once');\n }\n entityTransformer = transformer;\n },\n });\n\n env.registerInit({\n deps: {\n auth: coreServices.auth,\n config: coreServices.rootConfig,\n discovery: coreServices.discovery,\n scheduler: coreServices.scheduler,\n indexRegistry: searchIndexRegistryExtensionPoint,\n catalog: catalogServiceRef,\n },\n async init({\n auth,\n config,\n discovery,\n scheduler,\n indexRegistry,\n catalog,\n }) {\n indexRegistry.addCollator({\n schedule: scheduler.createScheduledTaskRunner(\n readScheduleConfigOptions(config),\n ),\n factory: DefaultCatalogCollatorFactory.fromConfig(config, {\n auth,\n entityTransformer,\n discovery,\n catalogClient: catalog,\n }),\n });\n },\n });\n },\n});\n"],"names":["createExtensionPoint","createBackendModule","coreServices","searchIndexRegistryExtensionPoint","catalogServiceRef","config","readScheduleConfigOptions","DefaultCatalogCollatorFactory"],"mappings":";;;;;;;;;;;AAoDO,MAAM,gCACXA,qCAAoD,CAAA;AAAA,EAClD,EAAI,EAAA,kCAAA;AACN,CAAC,EAAA;AAOH,YAAeC,oCAAoB,CAAA;AAAA,EACjC,QAAU,EAAA,QAAA;AAAA,EACV,QAAU,EAAA,kBAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAI,IAAA,iBAAA,CAAA;AAEJ,IAAA,GAAA,CAAI,uBAAuB,6BAA+B,EAAA;AAAA,MACxD,qBAAqB,WAAa,EAAA;AAChC,QAAA,IAAI,iBAAmB,EAAA;AACrB,UAAM,MAAA,IAAI,MAAM,8CAA8C,CAAA,CAAA;AAAA,SAChE;AACA,QAAoB,iBAAA,GAAA,WAAA,CAAA;AAAA,OACtB;AAAA,KACD,CAAA,CAAA;AAED,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,MAAMC,6BAAa,CAAA,IAAA;AAAA,QACnB,QAAQA,6BAAa,CAAA,UAAA;AAAA,QACrB,WAAWA,6BAAa,CAAA,SAAA;AAAA,QACxB,WAAWA,6BAAa,CAAA,SAAA;AAAA,QACxB,aAAe,EAAAC,yCAAA;AAAA,QACf,OAAS,EAAAC,yBAAA;AAAA,OACX;AAAA,MACA,MAAM,IAAK,CAAA;AAAA,QACT,IAAA;AAAA,gBACAC,QAAA;AAAA,QACA,SAAA;AAAA,QACA,SAAA;AAAA,QACA,aAAA;AAAA,QACA,OAAA;AAAA,OACC,EAAA;AACD,QAAA,aAAA,CAAc,WAAY,CAAA;AAAA,UACxB,UAAU,SAAU,CAAA,yBAAA;AAAA,YAClBC,iCAA0BD,QAAM,CAAA;AAAA,WAClC;AAAA,UACA,OAAA,EAASE,8DAA8B,CAAA,UAAA,CAAWF,QAAQ,EAAA;AAAA,YACxD,IAAA;AAAA,YACA,iBAAA;AAAA,YACA,SAAA;AAAA,YACA,aAAe,EAAA,OAAA;AAAA,WAChB,CAAA;AAAA,SACF,CAAA,CAAA;AAAA,OACH;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC,CAAA;;;;;"}
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 Catalog modules.\n */\n\nimport {\n coreServices,\n createBackendModule,\n createExtensionPoint,\n} from '@backstage/backend-plugin-api';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';\nimport {\n CatalogCollatorEntityTransformer,\n DefaultCatalogCollatorFactory,\n} from '@backstage/plugin-search-backend-module-catalog';\nimport { searchIndexRegistryExtensionPoint } from '@backstage/plugin-search-backend-node/alpha';\nimport { readScheduleConfigOptions } from './collators/config';\n\n/**\n * Options for {@link catalogCollatorExtensionPoint}.\n *\n * @alpha\n */\nexport type CatalogCollatorExtensionPoint = {\n /**\n * Allows you to customize how entities are shaped into documents.\n */\n setEntityTransformer(transformer: CatalogCollatorEntityTransformer): void;\n};\n\n/**\n * Extension point for customizing how catalog entities are shaped into\n * documents for the search backend.\n *\n * @alpha\n */\nexport const catalogCollatorExtensionPoint =\n createExtensionPoint<CatalogCollatorExtensionPoint>({\n id: 'search.catalogCollator.extension',\n });\n\n/**\n * Search backend module for the Catalog index.\n *\n * @alpha\n */\nexport default createBackendModule({\n pluginId: 'search',\n moduleId: 'catalog-collator',\n register(env) {\n let entityTransformer: CatalogCollatorEntityTransformer | undefined;\n\n env.registerExtensionPoint(catalogCollatorExtensionPoint, {\n setEntityTransformer(transformer) {\n if (entityTransformer) {\n throw new Error('setEntityTransformer can only be called once');\n }\n entityTransformer = transformer;\n },\n });\n\n env.registerInit({\n deps: {\n auth: coreServices.auth,\n config: coreServices.rootConfig,\n discovery: coreServices.discovery,\n scheduler: coreServices.scheduler,\n indexRegistry: searchIndexRegistryExtensionPoint,\n catalog: catalogServiceRef,\n },\n async init({\n auth,\n config,\n discovery,\n scheduler,\n indexRegistry,\n catalog,\n }) {\n indexRegistry.addCollator({\n schedule: scheduler.createScheduledTaskRunner(\n readScheduleConfigOptions(config),\n ),\n factory: DefaultCatalogCollatorFactory.fromConfig(config, {\n auth,\n entityTransformer,\n discovery,\n catalogClient: catalog,\n }),\n });\n },\n });\n },\n});\n"],"names":["createExtensionPoint","createBackendModule","coreServices","searchIndexRegistryExtensionPoint","catalogServiceRef","config","readScheduleConfigOptions","DefaultCatalogCollatorFactory"],"mappings":";;;;;;;;;;AAoDO,MAAM,gCACXA,qCAAoD,CAAA;AAAA,EAClD,EAAI,EAAA,kCAAA;AACN,CAAC,EAAA;AAOH,YAAeC,oCAAoB,CAAA;AAAA,EACjC,QAAU,EAAA,QAAA;AAAA,EACV,QAAU,EAAA,kBAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAI,IAAA,iBAAA,CAAA;AAEJ,IAAA,GAAA,CAAI,uBAAuB,6BAA+B,EAAA;AAAA,MACxD,qBAAqB,WAAa,EAAA;AAChC,QAAA,IAAI,iBAAmB,EAAA;AACrB,UAAM,MAAA,IAAI,MAAM,8CAA8C,CAAA,CAAA;AAAA,SAChE;AACA,QAAoB,iBAAA,GAAA,WAAA,CAAA;AAAA,OACtB;AAAA,KACD,CAAA,CAAA;AAED,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,MAAMC,6BAAa,CAAA,IAAA;AAAA,QACnB,QAAQA,6BAAa,CAAA,UAAA;AAAA,QACrB,WAAWA,6BAAa,CAAA,SAAA;AAAA,QACxB,WAAWA,6BAAa,CAAA,SAAA;AAAA,QACxB,aAAe,EAAAC,yCAAA;AAAA,QACf,OAAS,EAAAC,yBAAA;AAAA,OACX;AAAA,MACA,MAAM,IAAK,CAAA;AAAA,QACT,IAAA;AAAA,gBACAC,QAAA;AAAA,QACA,SAAA;AAAA,QACA,SAAA;AAAA,QACA,aAAA;AAAA,QACA,OAAA;AAAA,OACC,EAAA;AACD,QAAA,aAAA,CAAc,WAAY,CAAA;AAAA,UACxB,UAAU,SAAU,CAAA,yBAAA;AAAA,YAClBC,iCAA0BD,QAAM,CAAA;AAAA,WAClC;AAAA,UACA,OAAA,EAASE,8DAA8B,CAAA,UAAA,CAAWF,QAAQ,EAAA;AAAA,YACxD,IAAA;AAAA,YACA,iBAAA;AAAA,YACA,SAAA;AAAA,YACA,aAAe,EAAA,OAAA;AAAA,WAChB,CAAA;AAAA,SACF,CAAA,CAAA;AAAA,OACH;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC,CAAA;;;;;"}
@@ -0,0 +1,100 @@
1
+ 'use strict';
2
+
3
+ var backendCommon = require('@backstage/backend-common');
4
+ var catalogClient = require('@backstage/catalog-client');
5
+ var catalogModel = require('@backstage/catalog-model');
6
+ var alpha = require('@backstage/plugin-catalog-common/alpha');
7
+ var stream = require('stream');
8
+ var config = require('./config.cjs.js');
9
+ var defaultCatalogCollatorEntityTransformer = require('./defaultCatalogCollatorEntityTransformer.cjs.js');
10
+
11
+ class DefaultCatalogCollatorFactory {
12
+ type = "software-catalog";
13
+ visibilityPermission = alpha.catalogEntityReadPermission;
14
+ locationTemplate;
15
+ filter;
16
+ batchSize;
17
+ catalogClient;
18
+ entityTransformer;
19
+ auth;
20
+ static fromConfig(configRoot, options) {
21
+ const configOptions = config.readCollatorConfigOptions(configRoot);
22
+ const { auth: adaptedAuth } = backendCommon.createLegacyAuthAdapters({
23
+ auth: options.auth,
24
+ discovery: options.discovery,
25
+ tokenManager: options.tokenManager
26
+ });
27
+ return new DefaultCatalogCollatorFactory({
28
+ locationTemplate: options.locationTemplate ?? configOptions.locationTemplate,
29
+ filter: options.filter ?? configOptions.filter,
30
+ batchSize: options.batchSize ?? configOptions.batchSize,
31
+ entityTransformer: options.entityTransformer,
32
+ auth: adaptedAuth,
33
+ discovery: options.discovery,
34
+ catalogClient: options.catalogClient
35
+ });
36
+ }
37
+ constructor(options) {
38
+ const {
39
+ auth,
40
+ batchSize,
41
+ discovery,
42
+ locationTemplate,
43
+ filter,
44
+ catalogClient: catalogClient$1,
45
+ entityTransformer
46
+ } = options;
47
+ this.locationTemplate = locationTemplate;
48
+ this.filter = filter;
49
+ this.batchSize = batchSize;
50
+ this.catalogClient = catalogClient$1 || new catalogClient.CatalogClient({ discoveryApi: discovery });
51
+ this.entityTransformer = entityTransformer ?? defaultCatalogCollatorEntityTransformer.defaultCatalogCollatorEntityTransformer;
52
+ this.auth = auth;
53
+ }
54
+ async getCollator() {
55
+ return stream.Readable.from(this.execute());
56
+ }
57
+ async *execute() {
58
+ let entitiesRetrieved = 0;
59
+ let moreEntitiesToGet = true;
60
+ while (moreEntitiesToGet) {
61
+ const { token } = await this.auth.getPluginRequestToken({
62
+ onBehalfOf: await this.auth.getOwnServiceCredentials(),
63
+ targetPluginId: "catalog"
64
+ });
65
+ const entities = (await this.catalogClient.getEntities(
66
+ {
67
+ filter: this.filter,
68
+ limit: this.batchSize,
69
+ offset: entitiesRetrieved
70
+ },
71
+ { token }
72
+ )).items;
73
+ moreEntitiesToGet = entities.length === this.batchSize;
74
+ entitiesRetrieved += entities.length;
75
+ for (const entity of entities) {
76
+ yield {
77
+ ...this.entityTransformer(entity),
78
+ authorization: {
79
+ resourceRef: catalogModel.stringifyEntityRef(entity)
80
+ },
81
+ location: this.applyArgsToFormat(this.locationTemplate, {
82
+ namespace: entity.metadata.namespace || "default",
83
+ kind: entity.kind,
84
+ name: entity.metadata.name
85
+ })
86
+ };
87
+ }
88
+ }
89
+ }
90
+ applyArgsToFormat(format, args) {
91
+ let formatted = format;
92
+ for (const [key, value] of Object.entries(args)) {
93
+ formatted = formatted.replace(`:${key}`, value);
94
+ }
95
+ return formatted.toLowerCase();
96
+ }
97
+ }
98
+
99
+ exports.DefaultCatalogCollatorFactory = DefaultCatalogCollatorFactory;
100
+ //# sourceMappingURL=DefaultCatalogCollatorFactory.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultCatalogCollatorFactory.cjs.js","sources":["../../src/collators/DefaultCatalogCollatorFactory.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 TokenManager,\n createLegacyAuthAdapters,\n} from '@backstage/backend-common';\nimport {\n CatalogApi,\n CatalogClient,\n GetEntitiesRequest,\n} from '@backstage/catalog-client';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { Config } from '@backstage/config';\nimport { CatalogEntityDocument } from '@backstage/plugin-catalog-common';\nimport { catalogEntityReadPermission } from '@backstage/plugin-catalog-common/alpha';\nimport { Permission } from '@backstage/plugin-permission-common';\nimport { DocumentCollatorFactory } from '@backstage/plugin-search-common';\nimport { Readable } from 'stream';\nimport { CatalogCollatorEntityTransformer } from './CatalogCollatorEntityTransformer';\nimport { readCollatorConfigOptions } from './config';\nimport { defaultCatalogCollatorEntityTransformer } from './defaultCatalogCollatorEntityTransformer';\nimport { AuthService, DiscoveryService } from '@backstage/backend-plugin-api';\n\n/**\n * @public\n * @deprecated This type is deprecated along with the {@link DefaultCatalogCollatorFactory}.\n */\nexport type DefaultCatalogCollatorFactoryOptions = {\n auth?: AuthService;\n discovery: DiscoveryService;\n tokenManager?: TokenManager;\n /**\n * @deprecated Use the config key `search.collators.catalog.locationTemplate` instead.\n */\n locationTemplate?: string;\n /**\n * @deprecated Use the config key `search.collators.catalog.filter` instead.\n */\n filter?: GetEntitiesRequest['filter'];\n /**\n * @deprecated Use the config key `search.collators.catalog.batchSize` instead.\n */\n batchSize?: number;\n catalogClient?: CatalogApi;\n /**\n * Allows you to customize how entities are shaped into documents.\n */\n entityTransformer?: CatalogCollatorEntityTransformer;\n};\n\n/**\n * Collates entities from the Catalog into documents for the search backend.\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-catalog/README.md#installation | here} for more installation details).\n */\nexport class DefaultCatalogCollatorFactory implements DocumentCollatorFactory {\n public readonly type = 'software-catalog';\n public readonly visibilityPermission: Permission =\n catalogEntityReadPermission;\n\n private locationTemplate: string;\n private filter?: GetEntitiesRequest['filter'];\n private batchSize: number;\n private readonly catalogClient: CatalogApi;\n private entityTransformer: CatalogCollatorEntityTransformer;\n private auth: AuthService;\n\n static fromConfig(\n configRoot: Config,\n options: DefaultCatalogCollatorFactoryOptions,\n ) {\n const configOptions = readCollatorConfigOptions(configRoot);\n const { auth: adaptedAuth } = createLegacyAuthAdapters({\n auth: options.auth,\n discovery: options.discovery,\n tokenManager: options.tokenManager,\n });\n return new DefaultCatalogCollatorFactory({\n locationTemplate:\n options.locationTemplate ?? configOptions.locationTemplate,\n filter: options.filter ?? configOptions.filter,\n batchSize: options.batchSize ?? configOptions.batchSize,\n entityTransformer: options.entityTransformer,\n auth: adaptedAuth,\n discovery: options.discovery,\n catalogClient: options.catalogClient,\n });\n }\n\n private constructor(options: {\n locationTemplate: string;\n filter: GetEntitiesRequest['filter'];\n batchSize: number;\n entityTransformer?: CatalogCollatorEntityTransformer;\n auth: AuthService;\n discovery: DiscoveryService;\n catalogClient?: CatalogApi;\n }) {\n const {\n auth,\n batchSize,\n discovery,\n locationTemplate,\n filter,\n catalogClient,\n entityTransformer,\n } = options;\n\n this.locationTemplate = locationTemplate;\n this.filter = filter;\n this.batchSize = batchSize;\n this.catalogClient =\n catalogClient || new CatalogClient({ discoveryApi: discovery });\n this.entityTransformer =\n entityTransformer ?? defaultCatalogCollatorEntityTransformer;\n this.auth = auth;\n }\n\n async getCollator(): Promise<Readable> {\n return Readable.from(this.execute());\n }\n\n private async *execute(): AsyncGenerator<CatalogEntityDocument> {\n let entitiesRetrieved = 0;\n let moreEntitiesToGet = true;\n\n // Offset/limit pagination is used on the Catalog Client in order to\n // limit (and allow some control over) memory used by the search backend\n // at index-time.\n while (moreEntitiesToGet) {\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: await this.auth.getOwnServiceCredentials(),\n targetPluginId: 'catalog',\n });\n const entities = (\n await this.catalogClient.getEntities(\n {\n filter: this.filter,\n limit: this.batchSize,\n offset: entitiesRetrieved,\n },\n { token },\n )\n ).items;\n\n // Control looping through entity batches.\n moreEntitiesToGet = entities.length === this.batchSize;\n entitiesRetrieved += entities.length;\n\n for (const entity of entities) {\n yield {\n ...this.entityTransformer(entity),\n authorization: {\n resourceRef: stringifyEntityRef(entity),\n },\n location: this.applyArgsToFormat(this.locationTemplate, {\n namespace: entity.metadata.namespace || 'default',\n kind: entity.kind,\n name: entity.metadata.name,\n }),\n };\n }\n }\n }\n\n private applyArgsToFormat(\n format: string,\n args: Record<string, string>,\n ): string {\n let formatted = format;\n\n for (const [key, value] of Object.entries(args)) {\n formatted = formatted.replace(`:${key}`, value);\n }\n\n return formatted.toLowerCase();\n }\n}\n"],"names":["catalogEntityReadPermission","readCollatorConfigOptions","createLegacyAuthAdapters","catalogClient","CatalogClient","defaultCatalogCollatorEntityTransformer","Readable","stringifyEntityRef"],"mappings":";;;;;;;;;;AAsEO,MAAM,6BAAiE,CAAA;AAAA,EAC5D,IAAO,GAAA,kBAAA,CAAA;AAAA,EACP,oBACd,GAAAA,iCAAA,CAAA;AAAA,EAEM,gBAAA,CAAA;AAAA,EACA,MAAA,CAAA;AAAA,EACA,SAAA,CAAA;AAAA,EACS,aAAA,CAAA;AAAA,EACT,iBAAA,CAAA;AAAA,EACA,IAAA,CAAA;AAAA,EAER,OAAO,UACL,CAAA,UAAA,EACA,OACA,EAAA;AACA,IAAM,MAAA,aAAA,GAAgBC,iCAA0B,UAAU,CAAA,CAAA;AAC1D,IAAA,MAAM,EAAE,IAAA,EAAM,WAAY,EAAA,GAAIC,sCAAyB,CAAA;AAAA,MACrD,MAAM,OAAQ,CAAA,IAAA;AAAA,MACd,WAAW,OAAQ,CAAA,SAAA;AAAA,MACnB,cAAc,OAAQ,CAAA,YAAA;AAAA,KACvB,CAAA,CA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,EAAA,KAAK,KAAK,MAAO,CAAA,OAAA,CAAQ,IAAI,CAAG,EAAA;AAC/C,MAAA,SAAA,GAAY,SAAU,CAAA,OAAA,CAAQ,CAAI,CAAA,EAAA,GAAG,IAAI,KAAK,CAAA,CAAA;AAAA,KAChD;AAEA,IAAA,OAAO,UAAU,WAAY,EAAA,CAAA;AAAA,GAC/B;AACF;;;;"}
@@ -43,6 +43,7 @@ function readCollatorConfigOptions(configRoot) {
43
43
  };
44
44
  }
45
45
 
46
+ exports.defaults = defaults;
46
47
  exports.readCollatorConfigOptions = readCollatorConfigOptions;
47
48
  exports.readScheduleConfigOptions = readScheduleConfigOptions;
48
- //# sourceMappingURL=config-BgngnqUm.cjs.js.map
49
+ //# sourceMappingURL=config.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.cjs.js","sources":["../../src/collators/config.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\nimport {\n SchedulerServiceTaskScheduleDefinition,\n readSchedulerServiceTaskScheduleDefinitionFromConfig,\n} from '@backstage/backend-plugin-api';\nimport { EntityFilterQuery } from '@backstage/catalog-client';\nimport { Config } from '@backstage/config';\nimport { InputError } from '@backstage/errors';\n\nconst configKey = 'search.collators.catalog';\n\nexport const defaults = {\n schedule: {\n frequency: { minutes: 10 },\n timeout: { minutes: 15 },\n initialDelay: { seconds: 3 },\n },\n collatorOptions: {\n locationTemplate: '/catalog/:namespace/:kind/:name',\n filter: undefined,\n batchSize: 500,\n },\n};\n\nexport function readScheduleConfigOptions(\n configRoot: Config,\n): SchedulerServiceTaskScheduleDefinition {\n let schedule: SchedulerServiceTaskScheduleDefinition | undefined = undefined;\n\n const config = configRoot.getOptionalConfig(configKey);\n if (config) {\n const scheduleConfig = config.getOptionalConfig('schedule');\n if (scheduleConfig) {\n try {\n schedule =\n readSchedulerServiceTaskScheduleDefinitionFromConfig(scheduleConfig);\n } catch (error) {\n throw new InputError(`Invalid schedule at ${configKey}, ${error}`);\n }\n }\n }\n\n return schedule ?? defaults.schedule;\n}\n\nexport function readCollatorConfigOptions(configRoot: Config): {\n locationTemplate: string;\n filter: EntityFilterQuery | undefined;\n batchSize: number;\n} {\n const config = configRoot.getOptionalConfig(configKey);\n if (!config) {\n return defaults.collatorOptions;\n }\n\n return {\n locationTemplate:\n config.getOptionalString('locationTemplate') ??\n defaults.collatorOptions.locationTemplate,\n filter:\n config.getOptionalConfig('filter')?.get<EntityFilterQuery>() ??\n defaults.collatorOptions.filter,\n batchSize:\n config.getOptionalNumber('batchSize') ??\n defaults.collatorOptions.batchSize,\n };\n}\n"],"names":["readSchedulerServiceTaskScheduleDefinitionFromConfig","InputError"],"mappings":";;;;;AAwBA,MAAM,SAAY,GAAA,0BAAA,CAAA;AAEX,MAAM,QAAW,GAAA;AAAA,EACtB,QAAU,EAAA;AAAA,IACR,SAAA,EAAW,EAAE,OAAA,EAAS,EAAG,EAAA;AAAA,IACzB,OAAA,EAAS,EAAE,OAAA,EAAS,EAAG,EAAA;AAAA,IACvB,YAAA,EAAc,EAAE,OAAA,EAAS,CAAE,EAAA;AAAA,GAC7B;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,gBAAkB,EAAA,iCAAA;AAAA,IAClB,MAAQ,EAAA,KAAA,CAAA;AAAA,IACR,SAAW,EAAA,GAAA;AAAA,GACb;AACF,EAAA;AAEO,SAAS,0BACd,UACwC,EAAA;AACxC,EAAA,IAAI,QAA+D,GAAA,KAAA,CAAA,CAAA;AAEnE,EAAM,MAAA,MAAA,GAAS,UAAW,CAAA,iBAAA,CAAkB,SAAS,CAAA,CAAA;AACrD,EAAA,IAAI,MAAQ,EAAA;AACV,IAAM,MAAA,cAAA,GAAiB,MAAO,CAAA,iBAAA,CAAkB,UAAU,CAAA,CAAA;AAC1D,IAAA,IAAI,cAAgB,EAAA;AAClB,MAAI,IAAA;AACF,QAAA,QAAA,GACEA,sEAAqD,cAAc,CAAA,CAAA;AAAA,eAC9D,KAAO,EAAA;AACd,QAAA,MAAM,IAAIC,iBAAW,CAAA,CAAA,oBAAA,EAAuB,SAAS,CAAA,EAAA,EAAK,KAAK,CAAE,CAAA,CAAA,CAAA;AAAA,OACnE;AAAA,KACF;AAAA,GACF;AAEA,EAAA,OAAO,YAAY,QAAS,CAAA,QAAA,CAAA;AAC9B,CAAA;AAEO,SAAS,0BAA0B,UAIxC,EAAA;AACA,EAAM,MAAA,MAAA,GAAS,UAAW,CAAA,iBAAA,CAAkB,SAAS,CAAA,CAAA;AACrD,EAAA,IAAI,CAAC,MAAQ,EAAA;AACX,IAAA,OAAO,QAAS,CAAA,eAAA,CAAA;AAAA,GAClB;AAEA,EAAO,OAAA;AAAA,IACL,kBACE,MAAO,CAAA,iBAAA,CAAkB,kBAAkB,CAAA,IAC3C,SAAS,eAAgB,CAAA,gBAAA;AAAA,IAC3B,MAAA,EACE,OAAO,iBAAkB,CAAA,QAAQ,GAAG,GAAuB,EAAA,IAC3D,SAAS,eAAgB,CAAA,MAAA;AAAA,IAC3B,WACE,MAAO,CAAA,iBAAA,CAAkB,WAAW,CAAA,IACpC,SAAS,eAAgB,CAAA,SAAA;AAAA,GAC7B,CAAA;AACF;;;;;;"}
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ var catalogModel = require('@backstage/catalog-model');
4
+
5
+ const getDocumentText = (entity) => {
6
+ const documentTexts = [];
7
+ documentTexts.push(entity.metadata.description || "");
8
+ if (catalogModel.isUserEntity(entity) || catalogModel.isGroupEntity(entity)) {
9
+ if (entity.spec?.profile?.displayName) {
10
+ documentTexts.push(entity.spec.profile.displayName);
11
+ }
12
+ }
13
+ if (catalogModel.isUserEntity(entity)) {
14
+ if (entity.spec?.profile?.email) {
15
+ documentTexts.push(entity.spec.profile.email);
16
+ }
17
+ }
18
+ return documentTexts.join(" : ");
19
+ };
20
+ const defaultCatalogCollatorEntityTransformer = (entity) => {
21
+ return {
22
+ title: entity.metadata.title ?? entity.metadata.name,
23
+ text: getDocumentText(entity),
24
+ componentType: entity.spec?.type?.toString() || "other",
25
+ type: entity.spec?.type?.toString() || "other",
26
+ namespace: entity.metadata.namespace || "default",
27
+ kind: entity.kind,
28
+ lifecycle: entity.spec?.lifecycle || "",
29
+ owner: entity.spec?.owner || ""
30
+ };
31
+ };
32
+
33
+ exports.defaultCatalogCollatorEntityTransformer = defaultCatalogCollatorEntityTransformer;
34
+ //# sourceMappingURL=defaultCatalogCollatorEntityTransformer.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultCatalogCollatorEntityTransformer.cjs.js","sources":["../../src/collators/defaultCatalogCollatorEntityTransformer.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 { Entity, isGroupEntity, isUserEntity } from '@backstage/catalog-model';\nimport { CatalogCollatorEntityTransformer } from './CatalogCollatorEntityTransformer';\n\nconst getDocumentText = (entity: Entity): string => {\n const documentTexts: string[] = [];\n documentTexts.push(entity.metadata.description || '');\n\n if (isUserEntity(entity) || isGroupEntity(entity)) {\n if (entity.spec?.profile?.displayName) {\n documentTexts.push(entity.spec.profile.displayName);\n }\n }\n\n if (isUserEntity(entity)) {\n if (entity.spec?.profile?.email) {\n documentTexts.push(entity.spec.profile.email);\n }\n }\n\n return documentTexts.join(' : ');\n};\n\n/** @public */\nexport const defaultCatalogCollatorEntityTransformer: CatalogCollatorEntityTransformer =\n (entity: Entity) => {\n return {\n title: entity.metadata.title ?? entity.metadata.name,\n text: getDocumentText(entity),\n componentType: entity.spec?.type?.toString() || 'other',\n type: entity.spec?.type?.toString() || 'other',\n namespace: entity.metadata.namespace || 'default',\n kind: entity.kind,\n lifecycle: (entity.spec?.lifecycle as string) || '',\n owner: (entity.spec?.owner as string) || '',\n };\n };\n"],"names":["isUserEntity","isGroupEntity"],"mappings":";;;;AAmBA,MAAM,eAAA,GAAkB,CAAC,MAA2B,KAAA;AAClD,EAAA,MAAM,gBAA0B,EAAC,CAAA;AACjC,EAAA,aAAA,CAAc,IAAK,CAAA,MAAA,CAAO,QAAS,CAAA,WAAA,IAAe,EAAE,CAAA,CAAA;AAEpD,EAAA,IAAIA,yBAAa,CAAA,MAAM,CAAK,IAAAC,0BAAA,CAAc,MAAM,CAAG,EAAA;AACjD,IAAI,IAAA,MAAA,CAAO,IAAM,EAAA,OAAA,EAAS,WAAa,EAAA;AACrC,MAAA,aAAA,CAAc,IAAK,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA,CAAQ,WAAW,CAAA,CAAA;AAAA,KACpD;AAAA,GACF;AAEA,EAAI,IAAAD,yBAAA,CAAa,MAAM,CAAG,EAAA;AACxB,IAAI,IAAA,MAAA,CAAO,IAAM,EAAA,OAAA,EAAS,KAAO,EAAA;AAC/B,MAAA,aAAA,CAAc,IAAK,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA,CAAQ,KAAK,CAAA,CAAA;AAAA,KAC9C;AAAA,GACF;AAEA,EAAO,OAAA,aAAA,CAAc,KAAK,KAAK,CAAA,CAAA;AACjC,CAAA,CAAA;AAGa,MAAA,uCAAA,GACX,CAAC,MAAmB,KAAA;AAClB,EAAO,OAAA;AAAA,IACL,KAAO,EAAA,MAAA,CAAO,QAAS,CAAA,KAAA,IAAS,OAAO,QAAS,CAAA,IAAA;AAAA,IAChD,IAAA,EAAM,gBAAgB,MAAM,CAAA;AAAA,IAC5B,aAAe,EAAA,MAAA,CAAO,IAAM,EAAA,IAAA,EAAM,UAAc,IAAA,OAAA;AAAA,IAChD,IAAM,EAAA,MAAA,CAAO,IAAM,EAAA,IAAA,EAAM,UAAc,IAAA,OAAA;AAAA,IACvC,SAAA,EAAW,MAAO,CAAA,QAAA,CAAS,SAAa,IAAA,SAAA;AAAA,IACxC,MAAM,MAAO,CAAA,IAAA;AAAA,IACb,SAAA,EAAY,MAAO,CAAA,IAAA,EAAM,SAAwB,IAAA,EAAA;AAAA,IACjD,KAAA,EAAQ,MAAO,CAAA,IAAA,EAAM,KAAoB,IAAA,EAAA;AAAA,GAC3C,CAAA;AACF;;;;"}
package/dist/index.cjs.js CHANGED
@@ -1,130 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var backendCommon = require('@backstage/backend-common');
4
- var catalogClient = require('@backstage/catalog-client');
5
- var catalogModel = require('@backstage/catalog-model');
6
- var alpha = require('@backstage/plugin-catalog-common/alpha');
7
- var stream = require('stream');
8
- var config = require('./cjs/config-BgngnqUm.cjs.js');
9
- require('@backstage/backend-plugin-api');
10
- require('@backstage/errors');
3
+ var DefaultCatalogCollatorFactory = require('./collators/DefaultCatalogCollatorFactory.cjs.js');
4
+ var defaultCatalogCollatorEntityTransformer = require('./collators/defaultCatalogCollatorEntityTransformer.cjs.js');
11
5
 
12
- const getDocumentText = (entity) => {
13
- const documentTexts = [];
14
- documentTexts.push(entity.metadata.description || "");
15
- if (catalogModel.isUserEntity(entity) || catalogModel.isGroupEntity(entity)) {
16
- if (entity.spec?.profile?.displayName) {
17
- documentTexts.push(entity.spec.profile.displayName);
18
- }
19
- }
20
- if (catalogModel.isUserEntity(entity)) {
21
- if (entity.spec?.profile?.email) {
22
- documentTexts.push(entity.spec.profile.email);
23
- }
24
- }
25
- return documentTexts.join(" : ");
26
- };
27
- const defaultCatalogCollatorEntityTransformer = (entity) => {
28
- return {
29
- title: entity.metadata.title ?? entity.metadata.name,
30
- text: getDocumentText(entity),
31
- componentType: entity.spec?.type?.toString() || "other",
32
- type: entity.spec?.type?.toString() || "other",
33
- namespace: entity.metadata.namespace || "default",
34
- kind: entity.kind,
35
- lifecycle: entity.spec?.lifecycle || "",
36
- owner: entity.spec?.owner || ""
37
- };
38
- };
39
6
 
40
- class DefaultCatalogCollatorFactory {
41
- type = "software-catalog";
42
- visibilityPermission = alpha.catalogEntityReadPermission;
43
- locationTemplate;
44
- filter;
45
- batchSize;
46
- catalogClient;
47
- entityTransformer;
48
- auth;
49
- static fromConfig(configRoot, options) {
50
- const configOptions = config.readCollatorConfigOptions(configRoot);
51
- const { auth: adaptedAuth } = backendCommon.createLegacyAuthAdapters({
52
- auth: options.auth,
53
- discovery: options.discovery,
54
- tokenManager: options.tokenManager
55
- });
56
- return new DefaultCatalogCollatorFactory({
57
- locationTemplate: options.locationTemplate ?? configOptions.locationTemplate,
58
- filter: options.filter ?? configOptions.filter,
59
- batchSize: options.batchSize ?? configOptions.batchSize,
60
- entityTransformer: options.entityTransformer,
61
- auth: adaptedAuth,
62
- discovery: options.discovery,
63
- catalogClient: options.catalogClient
64
- });
65
- }
66
- constructor(options) {
67
- const {
68
- auth,
69
- batchSize,
70
- discovery,
71
- locationTemplate,
72
- filter,
73
- catalogClient: catalogClient$1,
74
- entityTransformer
75
- } = options;
76
- this.locationTemplate = locationTemplate;
77
- this.filter = filter;
78
- this.batchSize = batchSize;
79
- this.catalogClient = catalogClient$1 || new catalogClient.CatalogClient({ discoveryApi: discovery });
80
- this.entityTransformer = entityTransformer ?? defaultCatalogCollatorEntityTransformer;
81
- this.auth = auth;
82
- }
83
- async getCollator() {
84
- return stream.Readable.from(this.execute());
85
- }
86
- async *execute() {
87
- let entitiesRetrieved = 0;
88
- let moreEntitiesToGet = true;
89
- while (moreEntitiesToGet) {
90
- const { token } = await this.auth.getPluginRequestToken({
91
- onBehalfOf: await this.auth.getOwnServiceCredentials(),
92
- targetPluginId: "catalog"
93
- });
94
- const entities = (await this.catalogClient.getEntities(
95
- {
96
- filter: this.filter,
97
- limit: this.batchSize,
98
- offset: entitiesRetrieved
99
- },
100
- { token }
101
- )).items;
102
- moreEntitiesToGet = entities.length === this.batchSize;
103
- entitiesRetrieved += entities.length;
104
- for (const entity of entities) {
105
- yield {
106
- ...this.entityTransformer(entity),
107
- authorization: {
108
- resourceRef: catalogModel.stringifyEntityRef(entity)
109
- },
110
- location: this.applyArgsToFormat(this.locationTemplate, {
111
- namespace: entity.metadata.namespace || "default",
112
- kind: entity.kind,
113
- name: entity.metadata.name
114
- })
115
- };
116
- }
117
- }
118
- }
119
- applyArgsToFormat(format, args) {
120
- let formatted = format;
121
- for (const [key, value] of Object.entries(args)) {
122
- formatted = formatted.replace(`:${key}`, value);
123
- }
124
- return formatted.toLowerCase();
125
- }
126
- }
127
7
 
128
- exports.DefaultCatalogCollatorFactory = DefaultCatalogCollatorFactory;
129
- exports.defaultCatalogCollatorEntityTransformer = defaultCatalogCollatorEntityTransformer;
8
+ exports.DefaultCatalogCollatorFactory = DefaultCatalogCollatorFactory.DefaultCatalogCollatorFactory;
9
+ exports.defaultCatalogCollatorEntityTransformer = defaultCatalogCollatorEntityTransformer.defaultCatalogCollatorEntityTransformer;
130
10
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/collators/defaultCatalogCollatorEntityTransformer.ts","../src/collators/DefaultCatalogCollatorFactory.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 { Entity, isGroupEntity, isUserEntity } from '@backstage/catalog-model';\nimport { CatalogCollatorEntityTransformer } from './CatalogCollatorEntityTransformer';\n\nconst getDocumentText = (entity: Entity): string => {\n const documentTexts: string[] = [];\n documentTexts.push(entity.metadata.description || '');\n\n if (isUserEntity(entity) || isGroupEntity(entity)) {\n if (entity.spec?.profile?.displayName) {\n documentTexts.push(entity.spec.profile.displayName);\n }\n }\n\n if (isUserEntity(entity)) {\n if (entity.spec?.profile?.email) {\n documentTexts.push(entity.spec.profile.email);\n }\n }\n\n return documentTexts.join(' : ');\n};\n\n/** @public */\nexport const defaultCatalogCollatorEntityTransformer: CatalogCollatorEntityTransformer =\n (entity: Entity) => {\n return {\n title: entity.metadata.title ?? entity.metadata.name,\n text: getDocumentText(entity),\n componentType: entity.spec?.type?.toString() || 'other',\n type: entity.spec?.type?.toString() || 'other',\n namespace: entity.metadata.namespace || 'default',\n kind: entity.kind,\n lifecycle: (entity.spec?.lifecycle as string) || '',\n owner: (entity.spec?.owner as string) || '',\n };\n };\n","/*\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 TokenManager,\n createLegacyAuthAdapters,\n} from '@backstage/backend-common';\nimport {\n CatalogApi,\n CatalogClient,\n GetEntitiesRequest,\n} from '@backstage/catalog-client';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport { Config } from '@backstage/config';\nimport { CatalogEntityDocument } from '@backstage/plugin-catalog-common';\nimport { catalogEntityReadPermission } from '@backstage/plugin-catalog-common/alpha';\nimport { Permission } from '@backstage/plugin-permission-common';\nimport { DocumentCollatorFactory } from '@backstage/plugin-search-common';\nimport { Readable } from 'stream';\nimport { CatalogCollatorEntityTransformer } from './CatalogCollatorEntityTransformer';\nimport { readCollatorConfigOptions } from './config';\nimport { defaultCatalogCollatorEntityTransformer } from './defaultCatalogCollatorEntityTransformer';\nimport { AuthService, DiscoveryService } from '@backstage/backend-plugin-api';\n\n/**\n * @public\n * @deprecated This type is deprecated along with the {@link DefaultCatalogCollatorFactory}.\n */\nexport type DefaultCatalogCollatorFactoryOptions = {\n auth?: AuthService;\n discovery: DiscoveryService;\n tokenManager?: TokenManager;\n /**\n * @deprecated Use the config key `search.collators.catalog.locationTemplate` instead.\n */\n locationTemplate?: string;\n /**\n * @deprecated Use the config key `search.collators.catalog.filter` instead.\n */\n filter?: GetEntitiesRequest['filter'];\n /**\n * @deprecated Use the config key `search.collators.catalog.batchSize` instead.\n */\n batchSize?: number;\n catalogClient?: CatalogApi;\n /**\n * Allows you to customize how entities are shaped into documents.\n */\n entityTransformer?: CatalogCollatorEntityTransformer;\n};\n\n/**\n * Collates entities from the Catalog into documents for the search backend.\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-catalog/README.md#installation | here} for more installation details).\n */\nexport class DefaultCatalogCollatorFactory implements DocumentCollatorFactory {\n public readonly type = 'software-catalog';\n public readonly visibilityPermission: Permission =\n catalogEntityReadPermission;\n\n private locationTemplate: string;\n private filter?: GetEntitiesRequest['filter'];\n private batchSize: number;\n private readonly catalogClient: CatalogApi;\n private entityTransformer: CatalogCollatorEntityTransformer;\n private auth: AuthService;\n\n static fromConfig(\n configRoot: Config,\n options: DefaultCatalogCollatorFactoryOptions,\n ) {\n const configOptions = readCollatorConfigOptions(configRoot);\n const { auth: adaptedAuth } = createLegacyAuthAdapters({\n auth: options.auth,\n discovery: options.discovery,\n tokenManager: options.tokenManager,\n });\n return new DefaultCatalogCollatorFactory({\n locationTemplate:\n options.locationTemplate ?? configOptions.locationTemplate,\n filter: options.filter ?? configOptions.filter,\n batchSize: options.batchSize ?? configOptions.batchSize,\n entityTransformer: options.entityTransformer,\n auth: adaptedAuth,\n discovery: options.discovery,\n catalogClient: options.catalogClient,\n });\n }\n\n private constructor(options: {\n locationTemplate: string;\n filter: GetEntitiesRequest['filter'];\n batchSize: number;\n entityTransformer?: CatalogCollatorEntityTransformer;\n auth: AuthService;\n discovery: DiscoveryService;\n catalogClient?: CatalogApi;\n }) {\n const {\n auth,\n batchSize,\n discovery,\n locationTemplate,\n filter,\n catalogClient,\n entityTransformer,\n } = options;\n\n this.locationTemplate = locationTemplate;\n this.filter = filter;\n this.batchSize = batchSize;\n this.catalogClient =\n catalogClient || new CatalogClient({ discoveryApi: discovery });\n this.entityTransformer =\n entityTransformer ?? defaultCatalogCollatorEntityTransformer;\n this.auth = auth;\n }\n\n async getCollator(): Promise<Readable> {\n return Readable.from(this.execute());\n }\n\n private async *execute(): AsyncGenerator<CatalogEntityDocument> {\n let entitiesRetrieved = 0;\n let moreEntitiesToGet = true;\n\n // Offset/limit pagination is used on the Catalog Client in order to\n // limit (and allow some control over) memory used by the search backend\n // at index-time.\n while (moreEntitiesToGet) {\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: await this.auth.getOwnServiceCredentials(),\n targetPluginId: 'catalog',\n });\n const entities = (\n await this.catalogClient.getEntities(\n {\n filter: this.filter,\n limit: this.batchSize,\n offset: entitiesRetrieved,\n },\n { token },\n )\n ).items;\n\n // Control looping through entity batches.\n moreEntitiesToGet = entities.length === this.batchSize;\n entitiesRetrieved += entities.length;\n\n for (const entity of entities) {\n yield {\n ...this.entityTransformer(entity),\n authorization: {\n resourceRef: stringifyEntityRef(entity),\n },\n location: this.applyArgsToFormat(this.locationTemplate, {\n namespace: entity.metadata.namespace || 'default',\n kind: entity.kind,\n name: entity.metadata.name,\n }),\n };\n }\n }\n }\n\n private applyArgsToFormat(\n format: string,\n args: Record<string, string>,\n ): string {\n let formatted = format;\n\n for (const [key, value] of Object.entries(args)) {\n formatted = formatted.replace(`:${key}`, value);\n }\n\n return formatted.toLowerCase();\n }\n}\n"],"names":["isUserEntity","isGroupEntity","catalogEntityReadPermission","readCollatorConfigOptions","createLegacyAuthAdapters","catalogClient","CatalogClient","Readable","stringifyEntityRef"],"mappings":";;;;;;;;;;;AAmBA,MAAM,eAAA,GAAkB,CAAC,MAA2B,KAAA;AAClD,EAAA,MAAM,gBAA0B,EAAC,CAAA;AACjC,EAAA,aAAA,CAAc,IAAK,CAAA,MAAA,CAAO,QAAS,CAAA,WAAA,IAAe,EAAE,CAAA,CAAA;AAEpD,EAAA,IAAIA,yBAAa,CAAA,MAAM,CAAK,IAAAC,0BAAA,CAAc,MAAM,CAAG,EAAA;AACjD,IAAI,IAAA,MAAA,CAAO,IAAM,EAAA,OAAA,EAAS,WAAa,EAAA;AACrC,MAAA,aAAA,CAAc,IAAK,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA,CAAQ,WAAW,CAAA,CAAA;AAAA,KACpD;AAAA,GACF;AAEA,EAAI,IAAAD,yBAAA,CAAa,MAAM,CAAG,EAAA;AACxB,IAAI,IAAA,MAAA,CAAO,IAAM,EAAA,OAAA,EAAS,KAAO,EAAA;AAC/B,MAAA,aAAA,CAAc,IAAK,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA,CAAQ,KAAK,CAAA,CAAA;AAAA,KAC9C;AAAA,GACF;AAEA,EAAO,OAAA,aAAA,CAAc,KAAK,KAAK,CAAA,CAAA;AACjC,CAAA,CAAA;AAGa,MAAA,uCAAA,GACX,CAAC,MAAmB,KAAA;AAClB,EAAO,OAAA;AAAA,IACL,KAAO,EAAA,MAAA,CAAO,QAAS,CAAA,KAAA,IAAS,OAAO,QAAS,CAAA,IAAA;AAAA,IAChD,IAAA,EAAM,gBAAgB,MAAM,CAAA;AAAA,IAC5B,aAAe,EAAA,MAAA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[],"mappings":";;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-backend-module-catalog",
3
- "version": "0.2.3-next.0",
3
+ "version": "0.2.3-next.2",
4
4
  "description": "A module for the search backend that exports catalog modules",
5
5
  "backstage": {
6
6
  "role": "backend-plugin-module",
@@ -49,21 +49,21 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@backstage/backend-common": "^0.25.0",
52
- "@backstage/backend-plugin-api": "^1.0.1-next.0",
53
- "@backstage/catalog-client": "^1.7.0",
54
- "@backstage/catalog-model": "^1.7.0",
55
- "@backstage/config": "^1.2.0",
56
- "@backstage/errors": "^1.2.4",
57
- "@backstage/plugin-catalog-common": "^1.1.0",
58
- "@backstage/plugin-catalog-node": "^1.13.1-next.0",
59
- "@backstage/plugin-permission-common": "^0.8.1",
60
- "@backstage/plugin-search-backend-node": "^1.3.3-next.0",
61
- "@backstage/plugin-search-common": "^1.2.14"
52
+ "@backstage/backend-plugin-api": "1.0.1-next.1",
53
+ "@backstage/catalog-client": "1.7.1-next.0",
54
+ "@backstage/catalog-model": "1.7.0",
55
+ "@backstage/config": "1.2.0",
56
+ "@backstage/errors": "1.2.4",
57
+ "@backstage/plugin-catalog-common": "1.1.0",
58
+ "@backstage/plugin-catalog-node": "1.13.1-next.1",
59
+ "@backstage/plugin-permission-common": "0.8.1",
60
+ "@backstage/plugin-search-backend-node": "1.3.3-next.2",
61
+ "@backstage/plugin-search-common": "1.2.14"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@backstage/backend-common": "^0.25.0",
65
- "@backstage/backend-test-utils": "^1.0.1-next.0",
66
- "@backstage/cli": "^0.28.0-next.0",
65
+ "@backstage/backend-test-utils": "1.0.1-next.2",
66
+ "@backstage/cli": "0.28.0-next.2",
67
67
  "msw": "^1.0.0"
68
68
  },
69
69
  "configSchema": "config.d.ts"
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-BgngnqUm.cjs.js","sources":["../../src/collators/config.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\nimport {\n SchedulerServiceTaskScheduleDefinition,\n readSchedulerServiceTaskScheduleDefinitionFromConfig,\n} from '@backstage/backend-plugin-api';\nimport { EntityFilterQuery } from '@backstage/catalog-client';\nimport { Config } from '@backstage/config';\nimport { InputError } from '@backstage/errors';\n\nconst configKey = 'search.collators.catalog';\n\nexport const defaults = {\n schedule: {\n frequency: { minutes: 10 },\n timeout: { minutes: 15 },\n initialDelay: { seconds: 3 },\n },\n collatorOptions: {\n locationTemplate: '/catalog/:namespace/:kind/:name',\n filter: undefined,\n batchSize: 500,\n },\n};\n\nexport function readScheduleConfigOptions(\n configRoot: Config,\n): SchedulerServiceTaskScheduleDefinition {\n let schedule: SchedulerServiceTaskScheduleDefinition | undefined = undefined;\n\n const config = configRoot.getOptionalConfig(configKey);\n if (config) {\n const scheduleConfig = config.getOptionalConfig('schedule');\n if (scheduleConfig) {\n try {\n schedule =\n readSchedulerServiceTaskScheduleDefinitionFromConfig(scheduleConfig);\n } catch (error) {\n throw new InputError(`Invalid schedule at ${configKey}, ${error}`);\n }\n }\n }\n\n return schedule ?? defaults.schedule;\n}\n\nexport function readCollatorConfigOptions(configRoot: Config): {\n locationTemplate: string;\n filter: EntityFilterQuery | undefined;\n batchSize: number;\n} {\n const config = configRoot.getOptionalConfig(configKey);\n if (!config) {\n return defaults.collatorOptions;\n }\n\n return {\n locationTemplate:\n config.getOptionalString('locationTemplate') ??\n defaults.collatorOptions.locationTemplate,\n filter:\n config.getOptionalConfig('filter')?.get<EntityFilterQuery>() ??\n defaults.collatorOptions.filter,\n batchSize:\n config.getOptionalNumber('batchSize') ??\n defaults.collatorOptions.batchSize,\n };\n}\n"],"names":["readSchedulerServiceTaskScheduleDefinitionFromConfig","InputError"],"mappings":";;;;;AAwBA,MAAM,SAAY,GAAA,0BAAA,CAAA;AAEX,MAAM,QAAW,GAAA;AAAA,EACtB,QAAU,EAAA;AAAA,IACR,SAAA,EAAW,EAAE,OAAA,EAAS,EAAG,EAAA;AAAA,IACzB,OAAA,EAAS,EAAE,OAAA,EAAS,EAAG,EAAA;AAAA,IACvB,YAAA,EAAc,EAAE,OAAA,EAAS,CAAE,EAAA;AAAA,GAC7B;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,gBAAkB,EAAA,iCAAA;AAAA,IAClB,MAAQ,EAAA,KAAA,CAAA;AAAA,IACR,SAAW,EAAA,GAAA;AAAA,GACb;AACF,CAAA,CAAA;AAEO,SAAS,0BACd,UACwC,EAAA;AACxC,EAAA,IAAI,QAA+D,GAAA,KAAA,CAAA,CAAA;AAEnE,EAAM,MAAA,MAAA,GAAS,UAAW,CAAA,iBAAA,CAAkB,SAAS,CAAA,CAAA;AACrD,EAAA,IAAI,MAAQ,EAAA;AACV,IAAM,MAAA,cAAA,GAAiB,MAAO,CAAA,iBAAA,CAAkB,UAAU,CAAA,CAAA;AAC1D,IAAA,IAAI,cAAgB,EAAA;AAClB,MAAI,IAAA;AACF,QAAA,QAAA,GACEA,sEAAqD,cAAc,CAAA,CAAA;AAAA,eAC9D,KAAO,EAAA;AACd,QAAA,MAAM,IAAIC,iBAAW,CAAA,CAAA,oBAAA,EAAuB,SAAS,CAAA,EAAA,EAAK,KAAK,CAAE,CAAA,CAAA,CAAA;AAAA,OACnE;AAAA,KACF;AAAA,GACF;AAEA,EAAA,OAAO,YAAY,QAAS,CAAA,QAAA,CAAA;AAC9B,CAAA;AAEO,SAAS,0BAA0B,UAIxC,EAAA;AACA,EAAM,MAAA,MAAA,GAAS,UAAW,CAA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