@backstage/plugin-search-backend-module-catalog 0.2.5-next.3 → 0.2.6-next.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 CHANGED
@@ -1,5 +1,40 @@
1
1
  # @backstage/plugin-search-backend-module-catalog
2
2
 
3
+ ## 0.2.6-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - ed0aaec: Update README
8
+ - Updated dependencies
9
+ - @backstage/backend-plugin-api@1.0.3-next.0
10
+ - @backstage/catalog-client@1.8.1-next.0
11
+ - @backstage/catalog-model@1.7.1
12
+ - @backstage/config@1.3.0
13
+ - @backstage/errors@1.2.5
14
+ - @backstage/plugin-catalog-common@1.1.1
15
+ - @backstage/plugin-catalog-node@1.14.1-next.0
16
+ - @backstage/plugin-permission-common@0.8.2
17
+ - @backstage/plugin-search-backend-node@1.3.6-next.0
18
+ - @backstage/plugin-search-common@1.2.15
19
+
20
+ ## 0.2.5
21
+
22
+ ### Patch Changes
23
+
24
+ - 0b8f344: Fixed a bug where the `filter` setting of the collator was not permitted to be an array.
25
+ - 1a1e2f4: Fix search collator text formatting for catalog entities without description
26
+ - Updated dependencies
27
+ - @backstage/catalog-client@1.8.0
28
+ - @backstage/config@1.3.0
29
+ - @backstage/plugin-catalog-node@1.14.0
30
+ - @backstage/backend-plugin-api@1.0.2
31
+ - @backstage/plugin-search-backend-node@1.3.5
32
+ - @backstage/plugin-permission-common@0.8.2
33
+ - @backstage/catalog-model@1.7.1
34
+ - @backstage/errors@1.2.5
35
+ - @backstage/plugin-catalog-common@1.1.1
36
+ - @backstage/plugin-search-common@1.2.15
37
+
3
38
  ## 0.2.5-next.3
4
39
 
5
40
  ### Patch Changes
package/README.md CHANGED
@@ -16,12 +16,10 @@ Add the collator to your backend instance, along with the search plugin itself:
16
16
  ```tsx
17
17
  // packages/backend/src/index.ts
18
18
  import { createBackend } from '@backstage/backend-defaults';
19
- import { searchPlugin } from '@backstage/plugin-search-backend/alpha';
20
- import { searchModuleCatalogCollator } from '@backstage/plugin-search-backend-module-catalog/alpha';
21
19
 
22
20
  const backend = createBackend();
23
- backend.add(searchPlugin);
24
- backend.add(searchModuleCatalogCollator);
21
+ backend.add(import('@backstage/plugin-search-backend'));
22
+ backend.add(import('@backstage/plugin-search-backend-module-catalog'));
25
23
  backend.start();
26
24
  ```
27
25
 
@@ -35,12 +33,8 @@ This module also has an extension point, which lets you inject advanced customiz
35
33
  // packages/backend/src/index.ts
36
34
  import { createBackend } from '@backstage/backend-defaults';
37
35
  import { createBackendModule } from '@backstage/backend-plugin-api';
38
- import { searchPlugin } from '@backstage/plugin-search-backend/alpha';
39
36
  import { CatalogCollatorEntityTransformer } from '@backstage/plugin-search-backend-module-catalog';
40
- import {
41
- searchModuleCatalogCollator,
42
- catalogCollatorExtensionPoint,
43
- } from '@backstage/plugin-search-backend-module-catalog/alpha';
37
+ import { catalogCollatorExtensionPoint } from '@backstage/plugin-search-backend-module-catalog/alpha';
44
38
 
45
39
  const customTransformer: CatalogCollatorEntityTransformer = entity => ({
46
40
  title: entity.metadata.title || entity.metadata.name,
@@ -54,8 +48,8 @@ const customTransformer: CatalogCollatorEntityTransformer = entity => ({
54
48
  });
55
49
 
56
50
  const backend = createBackend();
57
- backend.add(searchPlugin);
58
- backend.add(searchModuleCatalogCollator);
51
+ backend.add(import('@backstage/plugin-search-backend'));
52
+ backend.add(import('@backstage/plugin-search-backend-module-catalog'));
59
53
  backend.add(
60
54
  createBackendModule({
61
55
  pluginId: 'search',
@@ -63,7 +57,7 @@ backend.add(
63
57
  register(reg) {
64
58
  reg.registerInit({
65
59
  deps: { collator: catalogCollatorExtensionPoint },
66
- init({ collator }) {
60
+ async init({ collator }) {
67
61
  collator.setEntityTransformer(customTransformer);
68
62
  },
69
63
  });
@@ -4,7 +4,9 @@ var catalogModel = require('@backstage/catalog-model');
4
4
 
5
5
  const getDocumentText = (entity) => {
6
6
  const documentTexts = [];
7
- documentTexts.push(entity.metadata.description || "");
7
+ if (entity.metadata.description) {
8
+ documentTexts.push(entity.metadata.description);
9
+ }
8
10
  if (catalogModel.isUserEntity(entity) || catalogModel.isGroupEntity(entity)) {
9
11
  if (entity.spec?.profile?.displayName) {
10
12
  documentTexts.push(entity.spec.profile.displayName);
@@ -1 +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":["isUserE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,IACjD,KAAA,EAAQ,MAAO,CAAA,IAAA,EAAM,KAAoB,IAAA;AAAA,GAC3C;AACF;;;;"}
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 if (entity.metadata.description) {\n documentTexts.push(entity.metadata.description);\n }\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,g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AoB,IAAA;AAAA,GAC3C;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-backend-module-catalog",
3
- "version": "0.2.5-next.3",
3
+ "version": "0.2.6-next.0",
4
4
  "description": "A module for the search backend that exports catalog modules",
5
5
  "backstage": {
6
6
  "role": "backend-plugin-module",
@@ -59,21 +59,21 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@backstage/backend-common": "^0.25.0",
62
- "@backstage/backend-plugin-api": "1.0.2-next.2",
63
- "@backstage/catalog-client": "1.8.0-next.1",
64
- "@backstage/catalog-model": "1.7.0",
65
- "@backstage/config": "1.2.0",
66
- "@backstage/errors": "1.2.4",
67
- "@backstage/plugin-catalog-common": "1.1.0",
68
- "@backstage/plugin-catalog-node": "1.14.0-next.2",
69
- "@backstage/plugin-permission-common": "0.8.1",
70
- "@backstage/plugin-search-backend-node": "1.3.5-next.3",
71
- "@backstage/plugin-search-common": "1.2.14"
62
+ "@backstage/backend-plugin-api": "1.0.3-next.0",
63
+ "@backstage/catalog-client": "1.8.1-next.0",
64
+ "@backstage/catalog-model": "1.7.1",
65
+ "@backstage/config": "1.3.0",
66
+ "@backstage/errors": "1.2.5",
67
+ "@backstage/plugin-catalog-common": "1.1.1",
68
+ "@backstage/plugin-catalog-node": "1.14.1-next.0",
69
+ "@backstage/plugin-permission-common": "0.8.2",
70
+ "@backstage/plugin-search-backend-node": "1.3.6-next.0",
71
+ "@backstage/plugin-search-common": "1.2.15"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@backstage/backend-common": "^0.25.0",
75
- "@backstage/backend-test-utils": "1.1.0-next.3",
76
- "@backstage/cli": "0.29.0-next.3",
75
+ "@backstage/backend-test-utils": "1.2.0-next.0",
76
+ "@backstage/cli": "0.29.3-next.0",
77
77
  "msw": "^1.0.0"
78
78
  },
79
79
  "configSchema": "config.d.ts"