@backstage/plugin-catalog-backend 1.31.0-next.1 → 1.31.0-next.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 CHANGED
@@ -1,5 +1,58 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
+ ## 1.31.0-next.3
4
+
5
+ ### Minor Changes
6
+
7
+ - 5aebc13: The `UrlReaderProccessor` accepts a new config flag `catalog.useUrlReadersSearch` to always call the `search` method of `UrlReaders`.
8
+
9
+ This flag currently defaults to `false`, but adopters are encouraged to enable it as this behavior will be the default in a future release.
10
+
11
+ Previous behavior was to call the `search` method only if the parsed Git URL's filename contained a wildcard and use `readUrl` otherwise. `UrlReaderService` must implement this logic in the `search` method instead.
12
+
13
+ This allows each `UrlReaderService` implementation to check whether it's a search URL (that contains a wildcard pattern) or not using logic that is specific to each provider.
14
+
15
+ ### Patch Changes
16
+
17
+ - ef73f97: Updated permission integration to use new permission resource ref.
18
+ - Updated dependencies
19
+ - @backstage/plugin-catalog-node@1.16.0-next.3
20
+ - @backstage/plugin-permission-node@0.8.8-next.2
21
+ - @backstage/backend-plugin-api@1.2.0-next.2
22
+ - @backstage/plugin-search-backend-module-catalog@0.3.1-next.3
23
+ - @backstage/plugin-events-node@0.4.8-next.2
24
+ - @backstage/backend-openapi-utils@0.5.0-next.3
25
+ - @backstage/catalog-client@1.9.1
26
+ - @backstage/catalog-model@1.7.3
27
+ - @backstage/config@1.3.2
28
+ - @backstage/errors@1.2.7
29
+ - @backstage/integration@1.16.1
30
+ - @backstage/types@1.2.1
31
+ - @backstage/plugin-catalog-common@1.1.3
32
+ - @backstage/plugin-permission-common@0.8.4
33
+ - @backstage/plugin-search-common@1.2.17
34
+
35
+ ## 1.31.0-next.2
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies
40
+ - @backstage/backend-plugin-api@1.2.0-next.1
41
+ - @backstage/plugin-search-backend-module-catalog@0.3.1-next.2
42
+ - @backstage/backend-openapi-utils@0.5.0-next.2
43
+ - @backstage/catalog-client@1.9.1
44
+ - @backstage/catalog-model@1.7.3
45
+ - @backstage/config@1.3.2
46
+ - @backstage/errors@1.2.7
47
+ - @backstage/integration@1.16.1
48
+ - @backstage/types@1.2.1
49
+ - @backstage/plugin-catalog-common@1.1.3
50
+ - @backstage/plugin-catalog-node@1.16.0-next.2
51
+ - @backstage/plugin-events-node@0.4.8-next.1
52
+ - @backstage/plugin-permission-common@0.8.4
53
+ - @backstage/plugin-permission-node@0.8.8-next.1
54
+ - @backstage/plugin-search-common@1.2.17
55
+
3
56
  ## 1.31.0-next.1
4
57
 
5
58
  ### Minor Changes
package/config.d.ts CHANGED
@@ -202,5 +202,19 @@ export interface Config {
202
202
  * housing catalog-info files.
203
203
  */
204
204
  processingInterval?: HumanDuration | false;
205
+
206
+ /**
207
+ * Defines if the UrlReaderProcessor should always call the search method of the
208
+ * different UrlReaders.
209
+ *
210
+ * If set to false, the UrlReaderProcessor will use the legacy behavior that tries to
211
+ * parse a Git URL and calls search if there's wildcard patterns and readUrl otherwise.
212
+ *
213
+ * If set to true, the UrlReaderProcessor always call the search method and lets each UrlReader
214
+ * determine if it's a search pattern or not.
215
+ *
216
+ * This flag is temporary and will be enabled by default in future releases.
217
+ */
218
+ useUrlReadersSearch?: boolean;
205
219
  };
206
220
  }
package/dist/index.d.ts CHANGED
@@ -129,6 +129,7 @@ declare class UrlReaderProcessor implements CatalogProcessor$1 {
129
129
  constructor(options: {
130
130
  reader: UrlReaderService;
131
131
  logger: LoggerService;
132
+ config?: Config;
132
133
  });
133
134
  getProcessorName(): string;
134
135
  readLocation(location: LocationSpec$1, optional: boolean, emit: CatalogProcessorEmit$1, parser: CatalogProcessorParser$1, cache: CatalogProcessorCache$1): Promise<boolean>;
@@ -1,12 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var alpha = require('@backstage/plugin-catalog-common/alpha');
4
3
  var pluginPermissionNode = require('@backstage/plugin-permission-node');
5
4
  var index = require('./rules/index.cjs.js');
5
+ var alpha = require('@backstage/plugin-catalog-node/alpha');
6
6
 
7
7
  const { conditions, createConditionalDecision } = pluginPermissionNode.createConditionExports({
8
- pluginId: "catalog",
9
- resourceType: alpha.RESOURCE_TYPE_CATALOG_ENTITY,
8
+ resourceRef: alpha.catalogEntityPermissionResourceRef,
10
9
  rules: index.permissionRules
11
10
  });
12
11
  const catalogConditions = conditions;
@@ -1 +1 @@
1
- {"version":3,"file":"conditionExports.cjs.js","sources":["../../src/permissions/conditionExports.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 { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';\nimport { createConditionExports } from '@backstage/plugin-permission-node';\nimport { permissionRules } from './rules';\n\nconst { conditions, createConditionalDecision } = createConditionExports({\n pluginId: 'catalog',\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n rules: permissionRules,\n});\n\n/**\n * These conditions are used when creating conditional decisions for catalog\n * entities that are returned by authorization policies.\n *\n * @alpha\n */\nexport const catalogConditions = conditions;\n\n/**\n * `createCatalogConditionalDecision` can be used when authoring policies to\n * create conditional decisions. It requires a permission of type\n * `ResourcePermission<'catalog-entity'>` to be passed as the first parameter.\n * It's recommended that you use the provided `isResourcePermission` and\n * `isPermission` helper methods to narrow the type of the permission passed to\n * the handle method as shown below.\n *\n * ```\n * // MyAuthorizationPolicy.ts\n * ...\n * import { createCatalogPolicyDecision } from '@backstage/plugin-catalog-backend';\n * import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common';\n *\n * class MyAuthorizationPolicy implements PermissionPolicy {\n * async handle(request, user) {\n * ...\n *\n * if (isResourcePermission(request.permission, RESOURCE_TYPE_CATALOG_ENTITY)) {\n * return createCatalogConditionalDecision(\n * request.permission,\n * { anyOf: [...insert conditions here...] }\n * );\n * }\n *\n * ...\n * }\n * ```\n *\n * @alpha\n */\nexport const createCatalogConditionalDecision = createConditionalDecision;\n"],"names":["createConditionExports","RESOURCE_TYPE_CATALOG_ENTITY","permissionRules"],"mappings":";;;;;;AAoBA,MAAM,EAAE,UAAA,EAAY,yBAA0B,EAAA,GAAIA,2CAAuB,CAAA;AAAA,EACvE,QAAU,EAAA,SAAA;AAAA,EACV,YAAc,EAAAC,kCAAA;AAAA,EACd,KAAO,EAAAC;AACT,CAAC,CAAA;AAQM,MAAM,iBAAoB,GAAA;AAiC1B,MAAM,gCAAmC,GAAA;;;;;"}
1
+ {"version":3,"file":"conditionExports.cjs.js","sources":["../../src/permissions/conditionExports.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 { createConditionExports } from '@backstage/plugin-permission-node';\nimport { permissionRules } from './rules';\nimport { catalogEntityPermissionResourceRef } from '@backstage/plugin-catalog-node/alpha';\n\nconst { conditions, createConditionalDecision } = createConditionExports({\n resourceRef: catalogEntityPermissionResourceRef,\n rules: permissionRules,\n});\n\n/**\n * These conditions are used when creating conditional decisions for catalog\n * entities that are returned by authorization policies.\n *\n * @alpha\n */\nexport const catalogConditions = conditions;\n\n/**\n * `createCatalogConditionalDecision` can be used when authoring policies to\n * create conditional decisions. It requires a permission of type\n * `ResourcePermission<'catalog-entity'>` to be passed as the first parameter.\n * It's recommended that you use the provided `isResourcePermission` and\n * `isPermission` helper methods to narrow the type of the permission passed to\n * the handle method as shown below.\n *\n * ```\n * // MyAuthorizationPolicy.ts\n * ...\n * import { createCatalogPolicyDecision } from '@backstage/plugin-catalog-backend';\n * import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common';\n *\n * class MyAuthorizationPolicy implements PermissionPolicy {\n * async handle(request, user) {\n * ...\n *\n * if (isResourcePermission(request.permission, RESOURCE_TYPE_CATALOG_ENTITY)) {\n * return createCatalogConditionalDecision(\n * request.permission,\n * { anyOf: [...insert conditions here...] }\n * );\n * }\n *\n * ...\n * }\n * ```\n *\n * @alpha\n */\nexport const createCatalogConditionalDecision = createConditionalDecision;\n"],"names":["createConditionExports","catalogEntityPermissionResourceRef","permissionRules"],"mappings":";;;;;;AAoBA,MAAM,EAAE,UAAA,EAAY,yBAA0B,EAAA,GAAIA,2CAAuB,CAAA;AAAA,EACvE,WAAa,EAAAC,wCAAA;AAAA,EACb,KAAO,EAAAC;AACT,CAAC,CAAA;AAQM,MAAM,iBAAoB,GAAA;AAiC1B,MAAM,gCAAmC,GAAA;;;;;"}
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
+ var alpha = require('@backstage/plugin-catalog-node/alpha');
4
+ var pluginPermissionNode = require('@backstage/plugin-permission-node');
3
5
  var lodash = require('lodash');
4
- var alpha = require('@backstage/plugin-catalog-common/alpha');
5
- var util = require('./util.cjs.js');
6
6
  var zod = require('zod');
7
7
 
8
- const createPropertyRule = (propertyType) => util.createCatalogPermissionRule({
8
+ const createPropertyRule = (propertyType) => pluginPermissionNode.createPermissionRule({
9
9
  name: `HAS_${propertyType.toUpperCase()}`,
10
10
  description: `Allow entities with the specified ${propertyType} subfield`,
11
- resourceType: alpha.RESOURCE_TYPE_CATALOG_ENTITY,
11
+ resourceRef: alpha.catalogEntityPermissionResourceRef,
12
12
  paramsSchema: zod.z.object({
13
13
  key: zod.z.string().describe(`Property within the entities ${propertyType} to match on`),
14
14
  value: zod.z.string().optional().describe(`Value of the given property to match on`)
@@ -1 +1 @@
1
- {"version":3,"file":"createPropertyRule.cjs.js","sources":["../../../src/permissions/rules/createPropertyRule.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 { get } from 'lodash';\nimport { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';\nimport { createCatalogPermissionRule } from './util';\nimport { z } from 'zod';\n\nexport const createPropertyRule = (propertyType: 'metadata' | 'spec') =>\n createCatalogPermissionRule({\n name: `HAS_${propertyType.toUpperCase()}`,\n description: `Allow entities with the specified ${propertyType} subfield`,\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n paramsSchema: z.object({\n key: z\n .string()\n .describe(`Property within the entities ${propertyType} to match on`),\n value: z\n .string()\n .optional()\n .describe(`Value of the given property to match on`),\n }),\n apply: (resource, { key, value }) => {\n const foundValue = get(resource[propertyType], key);\n\n if (Array.isArray(foundValue)) {\n if (value !== undefined) {\n return foundValue.includes(value);\n }\n return foundValue.length > 0;\n }\n if (value !== undefined) {\n return value === foundValue;\n }\n return !!foundValue;\n },\n toQuery: ({ key, value }) => ({\n key: `${propertyType}.${key}`,\n ...(value !== undefined && { values: [value] }),\n }),\n });\n"],"names":["createCatalogPermissionRule","RESOURCE_TYPE_CATALOG_ENTITY","z","get"],"mappings":";;;;;;;AAqBa,MAAA,kBAAA,GAAqB,CAAC,YAAA,KACj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PropertyRule.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 { catalogEntityPermissionResourceRef } from '@backstage/plugin-catalog-node/alpha';\nimport { createPermissionRule } from '@backstage/plugin-permission-node';\nimport { get } from 'lodash';\nimport { z } from 'zod';\n\nexport const createPropertyRule = (propertyType: 'metadata' | 'spec') =>\n createPermissionRule({\n name: `HAS_${propertyType.toUpperCase()}`,\n description: `Allow entities with the specified ${propertyType} subfield`,\n resourceRef: catalogEntityPermissionResourceRef,\n paramsSchema: z.object({\n key: z\n .string()\n .describe(`Property within the entities ${propertyType} to match on`),\n value: z\n .string()\n .optional()\n .describe(`Value of the given property to match on`),\n }),\n apply: (resource, { key, value }) => {\n const foundValue = get(resource[propertyType], key);\n\n if (Array.isArray(foundValue)) {\n if (value !== undefined) {\n return foundValue.includes(value);\n }\n return foundValue.length > 0;\n }\n if (value !== undefined) {\n return value === foundValue;\n }\n return !!foundValue;\n },\n toQuery: ({ key, value }) => ({\n key: `${propertyType}.${key}`,\n ...(value !== undefined && { values: [value] }),\n }),\n });\n"],"names":["createPermissionRule","catalogEntityPermissionResourceRef","z","get"],"mappings":";;;;;;;AAqBa,MAAA,kBAAA,GAAqB,CAAC,YAAA,KACjCA,yCAAqB,CAAA;AAAA,EACnB,IAAM,EAAA,CAAA,IAAA,EAAO,YAAa,CAAA,WAAA,EAAa,CAAA,CAAA;AAAA,EACvC,WAAA,EAAa,qCAAqC,YAAY,CAAA,SAAA,CAAA;AAAA,EAC9D,WAAa,EAAAC,wCAAA;AAAA,EACb,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,KAAKA,KACF,CAAA,MAAA,GACA,QAAS,CAAA,CAAA,6BAAA,EAAgC,YAAY,CAAc,YAAA,CAAA,CAAA;AAAA,IACtE,OAAOA,KACJ,CAAA,MAAA,GACA,QAAS,EAAA,CACT,SAAS,CAAyC,uCAAA,CAAA;AAAA,GACtD,CAAA;AAAA,EACD,OAAO,CAAC,QAAA,EAAU,EAAE,GAAA,EAAK,OAAY,KAAA;AACnC,IAAA,MAAM,UAAa,GAAAC,UAAA,CAAI,QAAS,CAAA,YAAY,GAAG,GAAG,CAAA;AAElD,IAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,UAAU,CAAG,EAAA;AAC7B,MAAA,IAAI,UAAU,KAAW,CAAA,EAAA;AACvB,QAAO,OAAA,UAAA,CAAW,SAAS,KAAK,CAAA;AAAA;AAElC,MAAA,OAAO,WAAW,MAAS,GAAA,CAAA;AAAA;AAE7B,IAAA,IAAI,UAAU,KAAW,CAAA,EAAA;AACvB,MAAA,OAAO,KAAU,KAAA,UAAA;AAAA;AAEnB,IAAA,OAAO,CAAC,CAAC,UAAA;AAAA,GACX;AAAA,EACA,OAAS,EAAA,CAAC,EAAE,GAAA,EAAK,OAAa,MAAA;AAAA,IAC5B,GAAK,EAAA,CAAA,EAAG,YAAY,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA;AAAA,IAC3B,GAAI,KAAU,KAAA,KAAA,CAAA,IAAa,EAAE,MAAQ,EAAA,CAAC,KAAK,CAAE;AAAA,GAC/C;AACF,CAAC;;;;"}
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var alpha = require('@backstage/plugin-catalog-common/alpha');
3
+ var alpha = require('@backstage/plugin-catalog-node/alpha');
4
+ var pluginPermissionNode = require('@backstage/plugin-permission-node');
4
5
  var zod = require('zod');
5
- var util = require('./util.cjs.js');
6
6
 
7
- const hasAnnotation = util.createCatalogPermissionRule({
7
+ const hasAnnotation = pluginPermissionNode.createPermissionRule({
8
8
  name: "HAS_ANNOTATION",
9
9
  description: "Allow entities with the specified annotation",
10
- resourceType: alpha.RESOURCE_TYPE_CATALOG_ENTITY,
10
+ resourceRef: alpha.catalogEntityPermissionResourceRef,
11
11
  paramsSchema: zod.z.object({
12
12
  annotation: zod.z.string().describe("Name of the annotation to match on"),
13
13
  value: zod.z.string().optional().describe("Value of the annotation to match on")
@@ -1 +1 @@
1
- {"version":3,"file":"hasAnnotation.cjs.js","sources":["../../../src/permissions/rules/hasAnnotation.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';\nimport { z } from 'zod';\nimport { createCatalogPermissionRule } from './util';\n\n/**\n * A catalog {@link @backstage/plugin-permission-node#PermissionRule} which\n * filters for the presence of an annotation on a given entity.\n *\n * If a value is given, it filters for the annotation value, too.\n *\n * @alpha\n */\nexport const hasAnnotation = createCatalogPermissionRule({\n name: 'HAS_ANNOTATION',\n description: 'Allow entities with the specified annotation',\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n paramsSchema: z.object({\n annotation: z.string().describe('Name of the annotation to match on'),\n value: z\n .string()\n .optional()\n .describe('Value of the annotation to match on'),\n }),\n apply: (resource, { annotation, value }) =>\n !!resource.metadata.annotations?.hasOwnProperty(annotation) &&\n (value === undefined\n ? true\n : resource.metadata.annotations?.[annotation] === value),\n toQuery: ({ annotation, value }) =>\n value === undefined\n ? {\n key: `metadata.annotations.${annotation}`,\n }\n : {\n key: `metadata.annotations.${annotation}`,\n values: [value],\n },\n});\n"],"names":["createCatalogPermissionRule","RESOURCE_TYPE_CATALOG_ENTITY","z"],"mappings":";;;;;;AA4BO,MAAM,gBAAgBA,gCAA4B,CAAA;AAAA,EACvD,IAAM,EAAA,gBAAA;AAAA,EACN,WAAa,EAAA,8CAAA;AAAA,EACb,YAAc,EAAAC,kCAAA;AAAA,EACd,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,UAAY,EAAAA,KAAA,CAAE,MAAO,EAAA,CAAE,SAAS,oCAAoC,CAAA;AAAA,IACpE,OAAOA,KACJ,CAAA,MAAA,GACA,QAAS,EAAA,CACT,SAAS,qCAAqC;AAAA,GAClD,CAAA;AAAA,EACD,KAAA,EAAO,CAAC,QAAU,EAAA,EAAE,YAAY,KAAM,EAAA,KACpC,CAAC,CAAC,QAAS,CAAA,QAAA,CAAS,aAAa,cAAe,CAAA,UAAU,MACzD,KAAU,KAAA,KAAA,CAAA,GACP,OACA,QAAS,CAAA,QAAA,CAAS,WAAc,GAAA,UAAU,CAAM,KAAA,KAAA,CAAA;AAAA,EACtD,SAAS,CAAC,EAAE,YAAY,KAAM,EAAA,KAC5B,UAAU,KACN,CAAA,GAAA;AAAA,IACE,GAAA,EAAK,wBAAwB,UAAU,CAAA;AAAA,GAEzC,GAAA;AAAA,IACE,GAAA,EAAK,wBAAwB,UAAU,CAAA,CAAA;AAAA,IACvC,MAAA,EAAQ,CAAC,KAAK;AAAA;AAExB,CAAC;;;;"}
1
+ {"version":3,"file":"hasAnnotation.cjs.js","sources":["../../../src/permissions/rules/hasAnnotation.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { catalogEntityPermissionResourceRef } from '@backstage/plugin-catalog-node/alpha';\nimport { createPermissionRule } from '@backstage/plugin-permission-node';\nimport { z } from 'zod';\n\n/**\n * A catalog {@link @backstage/plugin-permission-node#PermissionRule} which\n * filters for the presence of an annotation on a given entity.\n *\n * If a value is given, it filters for the annotation value, too.\n *\n * @alpha\n */\nexport const hasAnnotation = createPermissionRule({\n name: 'HAS_ANNOTATION',\n description: 'Allow entities with the specified annotation',\n resourceRef: catalogEntityPermissionResourceRef,\n paramsSchema: z.object({\n annotation: z.string().describe('Name of the annotation to match on'),\n value: z\n .string()\n .optional()\n .describe('Value of the annotation to match on'),\n }),\n apply: (resource, { annotation, value }) =>\n !!resource.metadata.annotations?.hasOwnProperty(annotation) &&\n (value === undefined\n ? true\n : resource.metadata.annotations?.[annotation] === value),\n toQuery: ({ annotation, value }) =>\n value === undefined\n ? {\n key: `metadata.annotations.${annotation}`,\n }\n : {\n key: `metadata.annotations.${annotation}`,\n values: [value],\n },\n});\n"],"names":["createPermissionRule","catalogEntityPermissionResourceRef","z"],"mappings":";;;;;;AA4BO,MAAM,gBAAgBA,yCAAqB,CAAA;AAAA,EAChD,IAAM,EAAA,gBAAA;AAAA,EACN,WAAa,EAAA,8CAAA;AAAA,EACb,WAAa,EAAAC,wCAAA;AAAA,EACb,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,UAAY,EAAAA,KAAA,CAAE,MAAO,EAAA,CAAE,SAAS,oCAAoC,CAAA;AAAA,IACpE,OAAOA,KACJ,CAAA,MAAA,GACA,QAAS,EAAA,CACT,SAAS,qCAAqC;AAAA,GAClD,CAAA;AAAA,EACD,KAAA,EAAO,CAAC,QAAU,EAAA,EAAE,YAAY,KAAM,EAAA,KACpC,CAAC,CAAC,QAAS,CAAA,QAAA,CAAS,aAAa,cAAe,CAAA,UAAU,MACzD,KAAU,KAAA,KAAA,CAAA,GACP,OACA,QAAS,CAAA,QAAA,CAAS,WAAc,GAAA,UAAU,CAAM,KAAA,KAAA,CAAA;AAAA,EACtD,SAAS,CAAC,EAAE,YAAY,KAAM,EAAA,KAC5B,UAAU,KACN,CAAA,GAAA;AAAA,IACE,GAAA,EAAK,wBAAwB,UAAU,CAAA;AAAA,GAEzC,GAAA;AAAA,IACE,GAAA,EAAK,wBAAwB,UAAU,CAAA,CAAA;AAAA,IACvC,MAAA,EAAQ,CAAC,KAAK;AAAA;AAExB,CAAC;;;;"}
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var alpha = require('@backstage/plugin-catalog-common/alpha');
3
+ var alpha = require('@backstage/plugin-catalog-node/alpha');
4
+ var pluginPermissionNode = require('@backstage/plugin-permission-node');
4
5
  var zod = require('zod');
5
- var util = require('./util.cjs.js');
6
6
 
7
- const hasLabel = util.createCatalogPermissionRule({
7
+ const hasLabel = pluginPermissionNode.createPermissionRule({
8
8
  name: "HAS_LABEL",
9
9
  description: "Allow entities with the specified label",
10
- resourceType: alpha.RESOURCE_TYPE_CATALOG_ENTITY,
10
+ resourceRef: alpha.catalogEntityPermissionResourceRef,
11
11
  paramsSchema: zod.z.object({
12
12
  label: zod.z.string().describe("Name of the label to match on")
13
13
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"hasLabel.cjs.js","sources":["../../../src/permissions/rules/hasLabel.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 { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';\nimport { z } from 'zod';\nimport { createCatalogPermissionRule } from './util';\n\n/**\n * A catalog {@link @backstage/plugin-permission-node#PermissionRule} which\n * filters for entities with a specified label in its metadata.\n * @alpha\n */\nexport const hasLabel = createCatalogPermissionRule({\n name: 'HAS_LABEL',\n description: 'Allow entities with the specified label',\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n paramsSchema: z.object({\n label: z.string().describe('Name of the label to match on'),\n }),\n apply: (resource, { label }) =>\n !!resource.metadata.labels?.hasOwnProperty(label),\n toQuery: ({ label }) => ({\n key: `metadata.labels.${label}`,\n }),\n});\n"],"names":["createCatalogPermissionRule","RESOURCE_TYPE_CATALOG_ENTITY","z"],"mappings":";;;;;;AAyBO,MAAM,WAAWA,gCAA4B,CAAA;AAAA,EAClD,IAAM,EAAA,WAAA;AAAA,EACN,WAAa,EAAA,yCAAA;AAAA,EACb,YAAc,EAAAC,kCAAA;AAAA,EACd,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,KAAO,EAAAA,KAAA,CAAE,MAAO,EAAA,CAAE,SAAS,+BAA+B;AAAA,GAC3D,CAAA;AAAA,EACD,KAAO,EAAA,CAAC,QAAU,EAAA,EAAE,KAAM,EAAA,KACxB,CAAC,CAAC,QAAS,CAAA,QAAA,CAAS,MAAQ,EAAA,cAAA,CAAe,KAAK,CAAA;AAAA,EAClD,OAAS,EAAA,CAAC,EAAE,KAAA,EAAa,MAAA;AAAA,IACvB,GAAA,EAAK,mBAAmB,KAAK,CAAA;AAAA,GAC/B;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"hasLabel.cjs.js","sources":["../../../src/permissions/rules/hasLabel.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 { catalogEntityPermissionResourceRef } from '@backstage/plugin-catalog-node/alpha';\nimport { createPermissionRule } from '@backstage/plugin-permission-node';\nimport { z } from 'zod';\n\n/**\n * A catalog {@link @backstage/plugin-permission-node#PermissionRule} which\n * filters for entities with a specified label in its metadata.\n * @alpha\n */\nexport const hasLabel = createPermissionRule({\n name: 'HAS_LABEL',\n description: 'Allow entities with the specified label',\n resourceRef: catalogEntityPermissionResourceRef,\n paramsSchema: z.object({\n label: z.string().describe('Name of the label to match on'),\n }),\n apply: (resource, { label }) =>\n !!resource.metadata.labels?.hasOwnProperty(label),\n toQuery: ({ label }) => ({\n key: `metadata.labels.${label}`,\n }),\n});\n"],"names":["createPermissionRule","catalogEntityPermissionResourceRef","z"],"mappings":";;;;;;AAyBO,MAAM,WAAWA,yCAAqB,CAAA;AAAA,EAC3C,IAAM,EAAA,WAAA;AAAA,EACN,WAAa,EAAA,yCAAA;AAAA,EACb,WAAa,EAAAC,wCAAA;AAAA,EACb,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,KAAO,EAAAA,KAAA,CAAE,MAAO,EAAA,CAAE,SAAS,+BAA+B;AAAA,GAC3D,CAAA;AAAA,EACD,KAAO,EAAA,CAAC,QAAU,EAAA,EAAE,KAAM,EAAA,KACxB,CAAC,CAAC,QAAS,CAAA,QAAA,CAAS,MAAQ,EAAA,cAAA,CAAe,KAAK,CAAA;AAAA,EAClD,OAAS,EAAA,CAAC,EAAE,KAAA,EAAa,MAAA;AAAA,IACvB,GAAA,EAAK,mBAAmB,KAAK,CAAA;AAAA,GAC/B;AACF,CAAC;;;;"}
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var alpha = require('@backstage/plugin-catalog-common/alpha');
3
+ var alpha = require('@backstage/plugin-catalog-node/alpha');
4
+ var pluginPermissionNode = require('@backstage/plugin-permission-node');
4
5
  var zod = require('zod');
5
- var util = require('./util.cjs.js');
6
6
 
7
- const isEntityKind = util.createCatalogPermissionRule({
7
+ const isEntityKind = pluginPermissionNode.createPermissionRule({
8
8
  name: "IS_ENTITY_KIND",
9
9
  description: "Allow entities matching a specified kind",
10
- resourceType: alpha.RESOURCE_TYPE_CATALOG_ENTITY,
10
+ resourceRef: alpha.catalogEntityPermissionResourceRef,
11
11
  paramsSchema: zod.z.object({
12
12
  kinds: zod.z.array(zod.z.string()).describe("List of kinds to match at least one of")
13
13
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"isEntityKind.cjs.js","sources":["../../../src/permissions/rules/isEntityKind.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';\nimport { z } from 'zod';\nimport { createCatalogPermissionRule } from './util';\n\n/**\n * A catalog {@link @backstage/plugin-permission-node#PermissionRule} which\n * filters for entities with a specified kind.\n * @alpha\n */\nexport const isEntityKind = createCatalogPermissionRule({\n name: 'IS_ENTITY_KIND',\n description: 'Allow entities matching a specified kind',\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n paramsSchema: z.object({\n kinds: z\n .array(z.string())\n .describe('List of kinds to match at least one of'),\n }),\n apply(resource, { kinds }) {\n const resourceKind = resource.kind.toLocaleLowerCase('en-US');\n return kinds.some(kind => kind.toLocaleLowerCase('en-US') === resourceKind);\n },\n toQuery({ kinds }) {\n return {\n key: 'kind',\n values: kinds.map(kind => kind.toLocaleLowerCase('en-US')),\n };\n },\n});\n"],"names":["createCatalogPermissionRule","RESOURCE_TYPE_CATALOG_ENTITY","z"],"mappings":";;;;;;AAyBO,MAAM,eAAeA,gCAA4B,CAAA;AAAA,EACtD,IAAM,EAAA,gBAAA;AAAA,EACN,WAAa,EAAA,0CAAA;AAAA,EACb,YAAc,EAAAC,kCAAA;AAAA,EACd,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,KAAA,EAAOA,MACJ,KAAM,CAAAA,KAAA,CAAE,QAAQ,CAAA,CAChB,SAAS,wCAAwC;AAAA,GACrD,CAAA;AAAA,EACD,KAAM,CAAA,QAAA,EAAU,EAAE,KAAA,EAAS,EAAA;AACzB,IAAA,MAAM,YAAe,GAAA,QAAA,CAAS,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA;AAC5D,IAAA,OAAO,MAAM,IAAK,CAAA,CAAA,IAAA,KAAQ,KAAK,iBAAkB,CAAA,OAAO,MAAM,YAAY,CAAA;AAAA,GAC5E;AAAA,EACA,OAAA,CAAQ,EAAE,KAAA,EAAS,EAAA;AACjB,IAAO,OAAA;AAAA,MACL,GAAK,EAAA,MAAA;AAAA,MACL,QAAQ,KAAM,CAAA,GAAA,CAAI,UAAQ,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAC;AAAA,KAC3D;AAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"isEntityKind.cjs.js","sources":["../../../src/permissions/rules/isEntityKind.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { catalogEntityPermissionResourceRef } from '@backstage/plugin-catalog-node/alpha';\nimport { createPermissionRule } from '@backstage/plugin-permission-node';\nimport { z } from 'zod';\n\n/**\n * A catalog {@link @backstage/plugin-permission-node#PermissionRule} which\n * filters for entities with a specified kind.\n * @alpha\n */\nexport const isEntityKind = createPermissionRule({\n name: 'IS_ENTITY_KIND',\n description: 'Allow entities matching a specified kind',\n resourceRef: catalogEntityPermissionResourceRef,\n paramsSchema: z.object({\n kinds: z\n .array(z.string())\n .describe('List of kinds to match at least one of'),\n }),\n apply(resource, { kinds }) {\n const resourceKind = resource.kind.toLocaleLowerCase('en-US');\n return kinds.some(kind => kind.toLocaleLowerCase('en-US') === resourceKind);\n },\n toQuery({ kinds }) {\n return {\n key: 'kind',\n values: kinds.map(kind => kind.toLocaleLowerCase('en-US')),\n };\n },\n});\n"],"names":["createPermissionRule","catalogEntityPermissionResourceRef","z"],"mappings":";;;;;;AAyBO,MAAM,eAAeA,yCAAqB,CAAA;AAAA,EAC/C,IAAM,EAAA,gBAAA;AAAA,EACN,WAAa,EAAA,0CAAA;AAAA,EACb,WAAa,EAAAC,wCAAA;AAAA,EACb,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,KAAA,EAAOA,MACJ,KAAM,CAAAA,KAAA,CAAE,QAAQ,CAAA,CAChB,SAAS,wCAAwC;AAAA,GACrD,CAAA;AAAA,EACD,KAAM,CAAA,QAAA,EAAU,EAAE,KAAA,EAAS,EAAA;AACzB,IAAA,MAAM,YAAe,GAAA,QAAA,CAAS,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA;AAC5D,IAAA,OAAO,MAAM,IAAK,CAAA,CAAA,IAAA,KAAQ,KAAK,iBAAkB,CAAA,OAAO,MAAM,YAAY,CAAA;AAAA,GAC5E;AAAA,EACA,OAAA,CAAQ,EAAE,KAAA,EAAS,EAAA;AACjB,IAAO,OAAA;AAAA,MACL,GAAK,EAAA,MAAA;AAAA,MACL,QAAQ,KAAM,CAAA,GAAA,CAAI,UAAQ,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAC;AAAA,KAC3D;AAAA;AAEJ,CAAC;;;;"}
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var catalogModel = require('@backstage/catalog-model');
4
- var alpha = require('@backstage/plugin-catalog-common/alpha');
4
+ var pluginPermissionNode = require('@backstage/plugin-permission-node');
5
5
  var zod = require('zod');
6
- var util = require('./util.cjs.js');
6
+ var alpha = require('@backstage/plugin-catalog-node/alpha');
7
7
 
8
- const isEntityOwner = util.createCatalogPermissionRule({
8
+ const isEntityOwner = pluginPermissionNode.createPermissionRule({
9
9
  name: "IS_ENTITY_OWNER",
10
10
  description: "Allow entities owned by a specified claim",
11
- resourceType: alpha.RESOURCE_TYPE_CATALOG_ENTITY,
11
+ resourceRef: alpha.catalogEntityPermissionResourceRef,
12
12
  paramsSchema: zod.z.object({
13
13
  claims: zod.z.array(zod.z.string()).describe(
14
14
  `List of claims to match at least one on within ${catalogModel.RELATION_OWNED_BY}`
@@ -1 +1 @@
1
- {"version":3,"file":"isEntityOwner.cjs.js","sources":["../../../src/permissions/rules/isEntityOwner.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';\nimport { z } from 'zod';\nimport { createCatalogPermissionRule } from './util';\n\n/**\n * A catalog {@link @backstage/plugin-permission-node#PermissionRule} which\n * filters for entities with a specified owner.\n *\n * @alpha\n */\nexport const isEntityOwner = createCatalogPermissionRule({\n name: 'IS_ENTITY_OWNER',\n description: 'Allow entities owned by a specified claim',\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n paramsSchema: z.object({\n claims: z\n .array(z.string())\n .describe(\n `List of claims to match at least one on within ${RELATION_OWNED_BY}`,\n ),\n }),\n apply: (resource, { claims }) => {\n if (!resource.relations) {\n return false;\n }\n\n return resource.relations\n .filter(relation => relation.type === RELATION_OWNED_BY)\n .some(relation => claims.includes(relation.targetRef));\n },\n toQuery: ({ claims }) => ({\n key: 'relations.ownedBy',\n values: claims,\n }),\n});\n"],"names":["createCatalogPermissionRule","RESOURCE_TYPE_CATALOG_ENTITY","z","RELATION_OWNED_BY"],"mappings":";;;;;;;AA2BO,MAAM,gBAAgBA,gCAA4B,CAAA;AAAA,EACvD,IAAM,EAAA,iBAAA;AAAA,EACN,WAAa,EAAA,2CAAA;AAAA,EACb,YAAc,EAAAC,kCAAA;AAAA,EACd,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,QAAQA,KACL,CAAA,KAAA,CAAMA,KAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA;AAAA,MACC,kDAAkDC,8BAAiB,CAAA;AAAA;AACrE,GACH,CAAA;AAAA,EACD,KAAO,EAAA,CAAC,QAAU,EAAA,EAAE,QAAa,KAAA;AAC/B,IAAI,IAAA,CAAC,SAAS,SAAW,EAAA;AACvB,MAAO,OAAA,KAAA;AAAA;AAGT,IAAA,OAAO,QAAS,CAAA,SAAA,CACb,MAAO,CAAA,CAAA,QAAA,KAAY,SAAS,IAAS,KAAAA,8BAAiB,CACtD,CAAA,IAAA,CAAK,CAAY,QAAA,KAAA,MAAA,CAAO,QAAS,CAAA,QAAA,CAAS,SAAS,CAAC,CAAA;AAAA,GACzD;AAAA,EACA,OAAS,EAAA,CAAC,EAAE,MAAA,EAAc,MAAA;AAAA,IACxB,GAAK,EAAA,mBAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACV;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"isEntityOwner.cjs.js","sources":["../../../src/permissions/rules/isEntityOwner.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport { createPermissionRule } from '@backstage/plugin-permission-node';\nimport { z } from 'zod';\nimport { catalogEntityPermissionResourceRef } from '@backstage/plugin-catalog-node/alpha';\n\n/**\n * A catalog {@link @backstage/plugin-permission-node#PermissionRule} which\n * filters for entities with a specified owner.\n *\n * @alpha\n */\nexport const isEntityOwner = createPermissionRule({\n name: 'IS_ENTITY_OWNER',\n description: 'Allow entities owned by a specified claim',\n resourceRef: catalogEntityPermissionResourceRef,\n paramsSchema: z.object({\n claims: z\n .array(z.string())\n .describe(\n `List of claims to match at least one on within ${RELATION_OWNED_BY}`,\n ),\n }),\n apply: (resource, { claims }) => {\n if (!resource.relations) {\n return false;\n }\n\n return resource.relations\n .filter(relation => relation.type === RELATION_OWNED_BY)\n .some(relation => claims.includes(relation.targetRef));\n },\n toQuery: ({ claims }) => ({\n key: 'relations.ownedBy',\n values: claims,\n }),\n});\n"],"names":["createPermissionRule","catalogEntityPermissionResourceRef","z","RELATION_OWNED_BY"],"mappings":";;;;;;;AA2BO,MAAM,gBAAgBA,yCAAqB,CAAA;AAAA,EAChD,IAAM,EAAA,iBAAA;AAAA,EACN,WAAa,EAAA,2CAAA;AAAA,EACb,WAAa,EAAAC,wCAAA;AAAA,EACb,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,QAAQA,KACL,CAAA,KAAA,CAAMA,KAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA;AAAA,MACC,kDAAkDC,8BAAiB,CAAA;AAAA;AACrE,GACH,CAAA;AAAA,EACD,KAAO,EAAA,CAAC,QAAU,EAAA,EAAE,QAAa,KAAA;AAC/B,IAAI,IAAA,CAAC,SAAS,SAAW,EAAA;AACvB,MAAO,OAAA,KAAA;AAAA;AAGT,IAAA,OAAO,QAAS,CAAA,SAAA,CACb,MAAO,CAAA,CAAA,QAAA,KAAY,SAAS,IAAS,KAAAA,8BAAiB,CACtD,CAAA,IAAA,CAAK,CAAY,QAAA,KAAA,MAAA,CAAO,QAAS,CAAA,QAAA,CAAS,SAAS,CAAC,CAAA;AAAA,GACzD;AAAA,EACA,OAAS,EAAA,CAAC,EAAE,MAAA,EAAc,MAAA;AAAA,IACxB,GAAK,EAAA,mBAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACV;AACF,CAAC;;;;"}
@@ -15,10 +15,17 @@ class UrlReaderProcessor {
15
15
  constructor(options) {
16
16
  this.options = options;
17
17
  this.#limiter = limiterFactory__default.default(5);
18
+ this.#useUrlReadersSearch = this.options.config?.getOptionalBoolean("catalog.useUrlReadersSearch") || false;
19
+ if (!this.#useUrlReadersSearch) {
20
+ this.options.logger.warn(
21
+ "UrlReaderProcessor uses the legacy readUrl/search behavior which will be removed in a future release. Set catalog.useUrlReadersSearch to true to adopt the new behavior."
22
+ );
23
+ }
18
24
  }
19
25
  // This limiter is used for only consuming a limited number of read streams
20
26
  // concurrently.
21
27
  #limiter;
28
+ #useUrlReadersSearch;
22
29
  getProcessorName() {
23
30
  return "url-reader";
24
31
  }
@@ -32,6 +39,14 @@ class UrlReaderProcessor {
32
39
  location.target,
33
40
  cacheItem?.etag
34
41
  );
42
+ if (response.length === 0 && !optional) {
43
+ emit(
44
+ pluginCatalogNode.processingResult.notFoundError(
45
+ location,
46
+ `Unable to read ${location.type}, no matching files found for ${location.target}`
47
+ )
48
+ );
49
+ }
35
50
  const parseResults = [];
36
51
  for (const item of response) {
37
52
  for await (const parseResult of parser({
@@ -73,6 +88,14 @@ class UrlReaderProcessor {
73
88
  return true;
74
89
  }
75
90
  async doRead(location, etag) {
91
+ if (this.#useUrlReadersSearch) {
92
+ const response = await this.options.reader.search(location, { etag });
93
+ const output = response.files.map(async (file) => ({
94
+ url: file.url,
95
+ data: await this.#limiter(file.content)
96
+ }));
97
+ return { response: await Promise.all(output), etag: response.etag };
98
+ }
76
99
  const { filepath } = parseGitUrl__default.default(location);
77
100
  if (filepath?.match(/[*?]/)) {
78
101
  const response = await this.options.reader.search(location, { etag });
@@ -1 +1 @@
1
- {"version":3,"file":"UrlReaderProcessor.cjs.js","sources":["../../src/processors/UrlReaderProcessor.ts"],"sourcesContent":["/*\n * Copyright 2020 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 } from '@backstage/catalog-model';\nimport { assertError } from '@backstage/errors';\nimport limiterFactory, { Limit } from 'p-limit';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\nimport parseGitUrl from 'git-url-parse';\nimport {\n CatalogProcessor,\n CatalogProcessorCache,\n CatalogProcessorEmit,\n CatalogProcessorEntityResult,\n CatalogProcessorParser,\n CatalogProcessorResult,\n processingResult,\n} from '@backstage/plugin-catalog-node';\nimport { LoggerService, UrlReaderService } from '@backstage/backend-plugin-api';\n\nconst CACHE_KEY = 'v1';\n\n// WARNING: If you change this type, you likely need to bump the CACHE_KEY as well\ntype CacheItem = {\n etag: string;\n value: {\n type: 'entity';\n entity: Entity;\n location: LocationSpec;\n }[];\n};\n\n/** @public */\nexport class UrlReaderProcessor implements CatalogProcessor {\n // This limiter is used for only consuming a limited number of read streams\n // concurrently.\n #limiter: Limit;\n\n constructor(\n private readonly options: {\n reader: UrlReaderService;\n logger: LoggerService;\n },\n ) {\n this.#limiter = limiterFactory(5);\n }\n\n getProcessorName() {\n return 'url-reader';\n }\n\n async readLocation(\n location: LocationSpec,\n optional: boolean,\n emit: CatalogProcessorEmit,\n parser: CatalogProcessorParser,\n cache: CatalogProcessorCache,\n ): Promise<boolean> {\n if (location.type !== 'url') {\n return false;\n }\n\n const cacheItem = await cache.get<CacheItem>(CACHE_KEY);\n\n try {\n const { response, etag: newEtag } = await this.doRead(\n location.target,\n cacheItem?.etag,\n );\n\n const parseResults: CatalogProcessorResult[] = [];\n for (const item of response) {\n for await (const parseResult of parser({\n data: item.data,\n location: { type: location.type, target: item.url },\n })) {\n parseResults.push(parseResult);\n emit(parseResult);\n }\n }\n\n const isOnlyEntities = parseResults.every(r => r.type === 'entity');\n if (newEtag && isOnlyEntities) {\n await cache.set<CacheItem>(CACHE_KEY, {\n etag: newEtag,\n value: parseResults as CatalogProcessorEntityResult[],\n });\n }\n\n emit(processingResult.refresh(`${location.type}:${location.target}`));\n } catch (error) {\n assertError(error);\n const message = `Unable to read ${location.type}, ${error}`.substring(\n 0,\n 5000,\n );\n if (error.name === 'NotModifiedError' && cacheItem) {\n for (const parseResult of cacheItem.value) {\n emit(parseResult);\n }\n emit(processingResult.refresh(`${location.type}:${location.target}`));\n await cache.set(CACHE_KEY, cacheItem);\n } else if (error.name === 'NotFoundError') {\n if (!optional) {\n emit(processingResult.notFoundError(location, message));\n }\n } else {\n emit(processingResult.generalError(location, message));\n }\n }\n\n return true;\n }\n\n private async doRead(\n location: string,\n etag?: string,\n ): Promise<{ response: { data: Buffer; url: string }[]; etag?: string }> {\n // Does it contain globs? I.e. does it contain asterisks or question marks\n // (no curly braces for now)\n\n const { filepath } = parseGitUrl(location);\n if (filepath?.match(/[*?]/)) {\n const response = await this.options.reader.search(location, { etag });\n const output = response.files.map(async file => ({\n url: file.url,\n data: await this.#limiter(file.content),\n }));\n return { response: await Promise.all(output), etag: response.etag };\n }\n\n const data = await this.options.reader.readUrl(location, { etag });\n return {\n response: [{ url: location, data: await data.buffer() }],\n etag: data.etag,\n };\n }\n}\n"],"names":["limiterFactory","processingResult","assertError","parseGitUrl"],"mappings":";;;;;;;;;;;;AAgCA,MAAM,SAAY,GAAA,IAAA;AAaX,MAAM,kBAA+C,CAAA;AAAA,EAK1D,YACmB,OAIjB,EAAA;AAJiB,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAKjB,IAAK,IAAA,CAAA,QAAA,GAAWA,gCAAe,CAAC,CAAA;AAAA;AAClC;AAAA;AAAA,EATA,QAAA;AAAA,EAWA,gBAAmB,GAAA;AACjB,IAAO,OAAA,YAAA;AAAA;AACT,EAEA,MAAM,YACJ,CAAA,QAAA,EACA,QACA,EAAA,IAAA,EACA,QACA,KACkB,EAAA;AAClB,IAAI,IAAA,QAAA,CAAS,SAAS,KAAO,EAAA;AAC3B,MAAO,OAAA,KAAA;AAAA;AAGT,IAAA,MAAM,SAAY,GAAA,MAAM,KAAM,CAAA,GAAA,CAAe,SAAS,CAAA;AAEtD,IAAI,IAAA;AACF,MAAA,MAAM,EAAE,QAAU,EAAA,IAAA,EAAM,OAAQ,EAAA,GAAI,MAAM,IAAK,CAAA,MAAA;AAAA,QAC7C,QAAS,CAAA,MAAA;AAAA,QACT,SAAW,EAAA;AAAA,OACb;AAEA,MAAA,MAAM,eAAyC,EAAC;AAChD,MAAA,KAAA,MAAW,QAAQ,QAAU,EAAA;AAC3B,QAAA,WAAA,MAAiB,eAAe,MAAO,CAAA;AAAA,UACrC,MAAM,IAAK,CAAA,IAAA;AAAA,UACX,UAAU,EAAE,IAAA,EAAM,SAAS,IAAM,EAAA,MAAA,EAAQ,KAAK,GAAI;AAAA,SACnD,CAAG,EAAA;AACF,UAAA,YAAA,CAAa,KAAK,WAAW,CAAA;AAC7B,UAAA,IAAA,CAAK,WAAW,CAAA;AAAA;AACl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,QAAU,EAAA,OAAO,CAAC,CAAA;AAAA;AACvD;AAGF,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,MAAc,MACZ,CAAA,QAAA,EACA,IACuE,EAAA;AAIvE,IAAA,MAAM,EAAE,QAAA,EAAa,GAAAE,4BAAA,CAAY,QAAQ,CAAA;AACzC,IAAI,IAAA,QAAA,EAAU,KAAM,CAAA,MAAM,CAAG,EAAA;AAC3B,MAAM,MAAA,QAAA,GAAW,MAAM,IAAK,CAAA,OAAA,CAAQ,OAAO,MAAO,CAAA,QAAA,EAAU,EAAE,IAAA,EAAM,CAAA;AACpE,MAAA,MAAM,MAAS,GAAA,QAAA,CAAS,KAAM,CAAA,GAAA,CAAI,OAAM,IAAS,MAAA;AAAA,QAC/C,KAAK,IAAK,CAAA,GAAA;AAAA,QACV,IAAM,EAAA,MAAM,IAAK,CAAA,QAAA,CAAS,KAAK,OAAO;AAAA,OACtC,CAAA,CAAA;AACF,MAAO,OAAA,EAAE,UAAU,MAAM,OAAA,CAAQ,IAAI,MAAM,CAAA,EAAG,IAAM,EAAA,QAAA,CAAS,IAAK,EAAA;AAAA;AAGpE,IAAM,MAAA,IAAA,GAAO,MAAM,IAAK,CAAA,OAAA,CAAQ,OAAO,OAAQ,CAAA,QAAA,EAAU,EAAE,IAAA,EAAM,CAAA;AACjE,IAAO,OAAA;AAAA,MACL,QAAA,EAAU,CAAC,EAAE,GAAK,EAAA,QAAA,EAAU,MAAM,MAAM,IAAA,CAAK,MAAO,EAAA,EAAG,CAAA;AAAA,MACvD,MAAM,IAAK,CAAA;AAAA,KACb;AAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"UrlReaderProcessor.cjs.js","sources":["../../src/processors/UrlReaderProcessor.ts"],"sourcesContent":["/*\n * Copyright 2020 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 } from '@backstage/catalog-model';\nimport { assertError } from '@backstage/errors';\nimport limiterFactory, { Limit } from 'p-limit';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\nimport parseGitUrl from 'git-url-parse';\nimport {\n CatalogProcessor,\n CatalogProcessorCache,\n CatalogProcessorEmit,\n CatalogProcessorEntityResult,\n CatalogProcessorParser,\n CatalogProcessorResult,\n processingResult,\n} from '@backstage/plugin-catalog-node';\nimport { LoggerService, UrlReaderService } from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\n\nconst CACHE_KEY = 'v1';\n\n// WARNING: If you change this type, you likely need to bump the CACHE_KEY as well\ntype CacheItem = {\n etag: string;\n value: {\n type: 'entity';\n entity: Entity;\n location: LocationSpec;\n }[];\n};\n\n/** @public */\nexport class UrlReaderProcessor implements CatalogProcessor {\n // This limiter is used for only consuming a limited number of read streams\n // concurrently.\n #limiter: Limit;\n #useUrlReadersSearch: boolean;\n\n constructor(\n private readonly options: {\n reader: UrlReaderService;\n logger: LoggerService;\n config?: Config;\n },\n ) {\n this.#limiter = limiterFactory(5);\n\n this.#useUrlReadersSearch =\n this.options.config?.getOptionalBoolean('catalog.useUrlReadersSearch') ||\n false;\n if (!this.#useUrlReadersSearch) {\n this.options.logger.warn(\n 'UrlReaderProcessor uses the legacy readUrl/search behavior which will be removed in a future release. Set catalog.useUrlReadersSearch to true to adopt the new behavior.',\n );\n }\n }\n\n getProcessorName() {\n return 'url-reader';\n }\n\n async readLocation(\n location: LocationSpec,\n optional: boolean,\n emit: CatalogProcessorEmit,\n parser: CatalogProcessorParser,\n cache: CatalogProcessorCache,\n ): Promise<boolean> {\n if (location.type !== 'url') {\n return false;\n }\n\n const cacheItem = await cache.get<CacheItem>(CACHE_KEY);\n\n try {\n const { response, etag: newEtag } = await this.doRead(\n location.target,\n cacheItem?.etag,\n );\n\n if (response.length === 0 && !optional) {\n emit(\n processingResult.notFoundError(\n location,\n `Unable to read ${location.type}, no matching files found for ${location.target}`,\n ),\n );\n }\n\n const parseResults: CatalogProcessorResult[] = [];\n for (const item of response) {\n for await (const parseResult of parser({\n data: item.data,\n location: { type: location.type, target: item.url },\n })) {\n parseResults.push(parseResult);\n emit(parseResult);\n }\n }\n\n const isOnlyEntities = parseResults.every(r => r.type === 'entity');\n if (newEtag && isOnlyEntities) {\n await cache.set<CacheItem>(CACHE_KEY, {\n etag: newEtag,\n value: parseResults as CatalogProcessorEntityResult[],\n });\n }\n\n emit(processingResult.refresh(`${location.type}:${location.target}`));\n } catch (error) {\n assertError(error);\n const message = `Unable to read ${location.type}, ${error}`.substring(\n 0,\n 5000,\n );\n if (error.name === 'NotModifiedError' && cacheItem) {\n for (const parseResult of cacheItem.value) {\n emit(parseResult);\n }\n emit(processingResult.refresh(`${location.type}:${location.target}`));\n await cache.set(CACHE_KEY, cacheItem);\n } else if (error.name === 'NotFoundError') {\n if (!optional) {\n emit(processingResult.notFoundError(location, message));\n }\n } else {\n emit(processingResult.generalError(location, message));\n }\n }\n\n return true;\n }\n\n private async doRead(\n location: string,\n etag?: string,\n ): Promise<{ response: { data: Buffer; url: string }[]; etag?: string }> {\n // New behavior: always use the search method\n if (this.#useUrlReadersSearch) {\n const response = await this.options.reader.search(location, { etag });\n\n const output = response.files.map(async file => ({\n url: file.url,\n data: await this.#limiter(file.content),\n }));\n\n return { response: await Promise.all(output), etag: response.etag };\n }\n\n // Old behavior: Does it contain globs? I.e. does it contain asterisks or question marks\n // (no curly braces for now)\n\n const { filepath } = parseGitUrl(location);\n if (filepath?.match(/[*?]/)) {\n const response = await this.options.reader.search(location, { etag });\n const output = response.files.map(async file => ({\n url: file.url,\n data: await this.#limiter(file.content),\n }));\n return { response: await Promise.all(output), etag: response.etag };\n }\n\n const data = await this.options.reader.readUrl(location, { etag });\n return {\n response: [{ url: location, data: await data.buffer() }],\n etag: data.etag,\n };\n }\n}\n"],"names":["limiterFactory","processingResult","assertError","parseGitUrl"],"mappings":";;;;;;;;;;;;AAiCA,MAAM,SAAY,GAAA,IAAA;AAaX,MAAM,kBAA+C,CAAA;AAAA,EAM1D,YACmB,OAKjB,EAAA;AALiB,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAMjB,IAAK,IAAA,CAAA,QAAA,GAAWA,gCAAe,CAAC,CAAA;AAEhC,IAAA,IAAA,CAAK,uBACH,IAAK,CAAA,OAAA,CAAQ,MAAQ,EAAA,kBAAA,CAAmB,6BAA6B,CACrE,IAAA,KAAA;AACF,IAAI,IAAA,CAAC,KAAK,oBAAsB,EAAA;AAC9B,MAAA,IAAA,CAAK,QAAQ,MAAO,CAAA,IAAA;AAAA,QAClB;AAAA,OACF;AAAA;AACF;AACF;AAAA;AAAA,EApBA,QAAA;AAAA,EACA,oBAAA;AAAA,EAqBA,gBAAmB,GAAA;AACjB,IAAO,OAAA,YAAA;AAAA;AACT,EAEA,MAAM,YACJ,CAAA,QAAA,EACA,QACA,EAAA,IAAA,EACA,QACA,KACkB,EAAA;AAClB,IAAI,IAAA,QAAA,CAAS,SAAS,KAAO,EAAA;AAC3B,MAAO,OAAA,KAAA;AAAA;AAGT,IAAA,MAAM,SAAY,GAAA,MAAM,KAAM,CAAA,GAAA,CAAe,SAAS,CAAA;AAEtD,IAAI,IAAA;AACF,MAAA,MAAM,EAAE,QAAU,EAAA,IAAA,EAAM,OAAQ,EAAA,GAAI,MAAM,IAAK,CAAA,MAAA;AAAA,QAC7C,QAAS,CAAA,MAAA;AAAA,QACT,SAAW,EAAA;AAAA,OACb;AAEA,MAAA,IAAI,QAAS,CAAA,MAAA,KAAW,CAAK,IAAA,CAAC,QAAU,EAAA;AACtC,QAAA,IAAA;AAAA,UACEC,kCAAiB,CAAA,aAAA;AAAA,YACf,QAAA;AAAA,YACA,CAAkB,eAAA,EAAA,QAAA,CAAS,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,QAAA,EAAU,EAAE,IAAA,EAAM,CAAA;AACpE,MAAA,MAAM,MAAS,GAAA,QAAA,CAAS,KAAM,CAAA,GAAA,CAAI,OAAM,IAAS,MAAA;AAAA,QAC/C,KAAK,IAAK,CAAA,GAAA;AAAA,QACV,IAAM,EAAA,MAAM,IAAK,CAAA,QAAA,CAAS,KAAK,OAAO;AAAA,OACtC,CAAA,CAAA;AACF,MAAO,OAAA,EAAE,UAAU,MAAM,OAAA,CAAQ,IAAI,MAAM,CAAA,EAAG,IAAM,EAAA,QAAA,CAAS,IAAK,EAAA;AAAA;AAGpE,IAAM,MAAA,IAAA,GAAO,MAAM,IAAK,CAAA,OAAA,CAAQ,OAAO,OAAQ,CAAA,QAAA,EAAU,EAAE,IAAA,EAAM,CAAA;AACjE,IAAO,OAAA;AAAA,MACL,QAAA,EAAU,CAAC,EAAE,GAAK,EAAA,QAAA,EAAU,MAAM,MAAM,IAAA,CAAK,MAAO,EAAA,EAAG,CAAA;AAAA,MACvD,MAAM,IAAK,CAAA;AAAA,KACb;AAAA;AAEJ;;;;"}
@@ -47,6 +47,7 @@ var basicEntityFilter = require('./request/basicEntityFilter.cjs.js');
47
47
  require('@backstage/errors');
48
48
  require('./util.cjs.js');
49
49
  var process$1 = require('./response/process.cjs.js');
50
+ var alpha$1 = require('@backstage/plugin-catalog-node/alpha');
50
51
 
51
52
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
52
53
 
@@ -231,7 +232,7 @@ class CatalogBuilder {
231
232
  const integrations = integration.ScmIntegrations.fromConfig(config);
232
233
  return [
233
234
  new FileReaderProcessor.FileReaderProcessor(),
234
- new UrlReaderProcessor.UrlReaderProcessor({ reader, logger }),
235
+ new UrlReaderProcessor.UrlReaderProcessor({ reader, logger, config }),
235
236
  CodeOwnersProcessor.CodeOwnersProcessor.fromConfig(config, { logger, reader }),
236
237
  new AnnotateLocationEntityProcessor.AnnotateLocationEntityProcessor({ integrations })
237
238
  ];
@@ -382,7 +383,11 @@ class CatalogBuilder {
382
383
  const entitiesCatalog = new AuthorizedEntitiesCatalog.AuthorizedEntitiesCatalog(
383
384
  unauthorizedEntitiesCatalog,
384
385
  permissionsService,
385
- pluginPermissionNode.createConditionTransformer(this.permissionRules)
386
+ permissionsRegistry ? pluginPermissionNode.createConditionTransformer(
387
+ permissionsRegistry.getPermissionRuleset(
388
+ alpha$1.catalogEntityPermissionResourceRef
389
+ )
390
+ ) : pluginPermissionNode.createConditionTransformer(this.permissionRules)
386
391
  );
387
392
  const catalogPermissionResource = {
388
393
  resourceType: alpha.RESOURCE_TYPE_CATALOG_ENTITY,
@@ -400,9 +405,8 @@ class CatalogBuilder {
400
405
  })
401
406
  }
402
407
  });
403
- const entitiesByRef = lodash.keyBy(
404
- process$1.entitiesResponseToObjects(entities),
405
- catalogModel.stringifyEntityRef
408
+ const entitiesByRef = Object.fromEntries(
409
+ process$1.entitiesResponseToObjects(entities).filter((x) => Boolean(x)).map((entity) => [catalogModel.stringifyEntityRef(entity), entity])
406
410
  );
407
411
  return resourceRefs.map(
408
412
  (resourceRef) => entitiesByRef[catalogModel.stringifyEntityRef(catalogModel.parseEntityRef(resourceRef))]
@@ -413,7 +417,10 @@ class CatalogBuilder {
413
417
  };
414
418
  let permissionIntegrationRouter;
415
419
  if (permissionsRegistry) {
416
- permissionsRegistry.addResourceType(catalogPermissionResource);
420
+ permissionsRegistry.addResourceType({
421
+ ...catalogPermissionResource,
422
+ resourceRef: alpha$1.catalogEntityPermissionResourceRef
423
+ });
417
424
  } else {
418
425
  permissionIntegrationRouter = pluginPermissionNode.createPermissionIntegrationRouter(
419
426
  catalogPermissionResource
@@ -1 +1 @@
1
- {"version":3,"file":"CatalogBuilder.cjs.js","sources":["../../src/service/CatalogBuilder.ts"],"sourcesContent":["/*\n * Copyright 2020 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 HostDiscovery,\n} from '@backstage/backend-common';\nimport {\n DefaultNamespaceEntityPolicy,\n Entity,\n EntityPolicies,\n EntityPolicy,\n FieldFormatEntityPolicy,\n makeValidator,\n NoForeignRootFieldsEntityPolicy,\n parseEntityRef,\n SchemaValidEntityPolicy,\n stringifyEntityRef,\n Validators,\n} from '@backstage/catalog-model';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { createHash } from 'crypto';\nimport { Router } from 'express';\nimport lodash, { keyBy } from 'lodash';\n\nimport {\n AuditorService,\n AuthService,\n DatabaseService,\n DiscoveryService,\n HttpAuthService,\n LoggerService,\n PermissionsRegistryService,\n PermissionsService,\n RootConfigService,\n SchedulerService,\n UrlReaderService,\n} from '@backstage/backend-plugin-api';\nimport { Config, readDurationFromConfig } from '@backstage/config';\nimport {\n catalogPermissions,\n RESOURCE_TYPE_CATALOG_ENTITY,\n} from '@backstage/plugin-catalog-common/alpha';\nimport {\n CatalogProcessor,\n CatalogProcessorParser,\n EntitiesSearchFilter,\n EntityProvider,\n LocationAnalyzer,\n PlaceholderResolver,\n ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\nimport { EventBroker, EventsService } from '@backstage/plugin-events-node';\nimport {\n Permission,\n PermissionAuthorizer,\n PermissionRuleParams,\n toPermissionEvaluator,\n} from '@backstage/plugin-permission-common';\nimport {\n createConditionTransformer,\n createPermissionIntegrationRouter,\n PermissionRule,\n} from '@backstage/plugin-permission-node';\nimport { durationToMilliseconds } from '@backstage/types';\nimport { DefaultCatalogDatabase } from '../database/DefaultCatalogDatabase';\nimport { DefaultProcessingDatabase } from '../database/DefaultProcessingDatabase';\nimport { DefaultProviderDatabase } from '../database/DefaultProviderDatabase';\nimport { applyDatabaseMigrations } from '../database/migrations';\nimport { DefaultCatalogRulesEnforcer } from '../ingestion/CatalogRules';\nimport { RepoLocationAnalyzer } from '../ingestion/LocationAnalyzer';\nimport { permissionRules as catalogPermissionRules } from '../permissions/rules';\nimport {\n CatalogProcessingEngine,\n createRandomProcessingInterval,\n ProcessingIntervalFunction,\n} from '../processing';\nimport { connectEntityProviders } from '../processing/connectEntityProviders';\nimport { DefaultCatalogProcessingEngine } from '../processing/DefaultCatalogProcessingEngine';\nimport { DefaultCatalogProcessingOrchestrator } from '../processing/DefaultCatalogProcessingOrchestrator';\nimport {\n AnnotateLocationEntityProcessor,\n BuiltinKindsEntityProcessor,\n CodeOwnersProcessor,\n FileReaderProcessor,\n PlaceholderProcessor,\n UrlReaderProcessor,\n} from '../processors';\nimport {\n jsonPlaceholderResolver,\n textPlaceholderResolver,\n yamlPlaceholderResolver,\n} from '../processors/PlaceholderProcessor';\nimport { ConfigLocationEntityProvider } from '../providers/ConfigLocationEntityProvider';\nimport { DefaultLocationStore } from '../providers/DefaultLocationStore';\nimport { DefaultStitcher } from '../stitching/DefaultStitcher';\nimport { defaultEntityDataParser } from '../util/parse';\nimport { AuthorizedEntitiesCatalog } from './AuthorizedEntitiesCatalog';\nimport { AuthorizedLocationAnalyzer } from './AuthorizedLocationAnalyzer';\nimport { AuthorizedLocationService } from './AuthorizedLocationService';\nimport { AuthorizedRefreshService } from './AuthorizedRefreshService';\nimport { createRouter } from './createRouter';\nimport { DefaultEntitiesCatalog } from './DefaultEntitiesCatalog';\nimport { DefaultLocationService } from './DefaultLocationService';\nimport { DefaultRefreshService } from './DefaultRefreshService';\nimport { basicEntityFilter } from './request';\nimport { entitiesResponseToObjects } from './response';\n\n/**\n * This is a duplicate of the alpha `CatalogPermissionRule` type, for use in the stable API.\n *\n * @public\n */\nexport type CatalogPermissionRuleInput<\n TParams extends PermissionRuleParams = PermissionRuleParams,\n> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;\n\n/**\n * @deprecated Please migrate to the new backend system as this will be removed in the future.\n * @public\n */\nexport type CatalogEnvironment = {\n logger: LoggerService;\n database: DatabaseService;\n config: RootConfigService;\n reader: UrlReaderService;\n permissions: PermissionsService | PermissionAuthorizer;\n permissionsRegistry?: PermissionsRegistryService;\n scheduler?: SchedulerService;\n discovery?: DiscoveryService;\n auth?: AuthService;\n httpAuth?: HttpAuthService;\n auditor?: AuditorService;\n};\n\n/**\n * A builder that helps wire up all of the component parts of the catalog.\n *\n * The touch points where you can replace or extend behavior are as follows:\n *\n * - Entity policies can be added or replaced. These are automatically run\n * after the processors' pre-processing steps. All policies are given the\n * chance to inspect the entity, and all of them have to pass in order for\n * the entity to be considered valid from an overall point of view.\n * - Location analyzers can be added. These are responsible for analyzing\n * repositories when onboarding them into the catalog, by finding\n * catalog-info.yaml files and other artifacts that can help automatically\n * register or create catalog data on the user's behalf.\n * - Placeholder resolvers can be replaced or added. These run on the raw\n * structured data between the parsing and pre-processing steps, to replace\n * dollar-prefixed entries with their actual values (like $file).\n * - Field format validators can be replaced. These check the format of\n * individual core fields such as metadata.name, to ensure that they adhere\n * to certain rules.\n * - Processors can be added or replaced. These implement the functionality of\n * reading, parsing, validating, and processing the entity data before it is\n * persisted in the catalog.\n *\n * @public\n * @deprecated Please migrate to the new backend system as this will be removed in the future.\n */\nexport class CatalogBuilder {\n private readonly env: CatalogEnvironment;\n private entityPolicies: EntityPolicy[];\n private entityPoliciesReplace: boolean;\n private placeholderResolvers: Record<string, PlaceholderResolver>;\n private fieldFormatValidators: Partial<Validators>;\n private entityProviders: EntityProvider[];\n private processors: CatalogProcessor[];\n private locationAnalyzers: ScmLocationAnalyzer[];\n private processorsReplace: boolean;\n private parser: CatalogProcessorParser | undefined;\n private onProcessingError?: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void;\n private processingInterval: ProcessingIntervalFunction;\n private locationAnalyzer: LocationAnalyzer | undefined = undefined;\n private readonly permissions: Permission[];\n private readonly permissionRules: CatalogPermissionRuleInput[];\n private allowedLocationType: string[];\n private legacySingleProcessorValidation = false;\n private eventBroker?: EventBroker | EventsService;\n\n /**\n * Creates a catalog builder.\n */\n static create(env: CatalogEnvironment): CatalogBuilder {\n return new CatalogBuilder(env);\n }\n\n private constructor(env: CatalogEnvironment) {\n this.env = env;\n this.entityPolicies = [];\n this.entityPoliciesReplace = false;\n this.placeholderResolvers = {};\n this.fieldFormatValidators = {};\n this.entityProviders = [];\n this.processors = [];\n this.locationAnalyzers = [];\n this.processorsReplace = false;\n this.parser = undefined;\n this.permissions = [...catalogPermissions];\n this.permissionRules = Object.values(catalogPermissionRules);\n this.allowedLocationType = ['url'];\n\n this.processingInterval = CatalogBuilder.getDefaultProcessingInterval(\n env.config,\n );\n }\n\n /**\n * Adds policies that are used to validate entities between the pre-\n * processing and post-processing stages. All such policies must pass for the\n * entity to be considered valid.\n *\n * If what you want to do is to replace the rules for what format is allowed\n * in various core entity fields (such as metadata.name), you may want to use\n * {@link CatalogBuilder#setFieldFormatValidators} instead.\n *\n * @param policies - One or more policies\n */\n addEntityPolicy(\n ...policies: Array<EntityPolicy | Array<EntityPolicy>>\n ): CatalogBuilder {\n this.entityPolicies.push(...policies.flat());\n return this;\n }\n\n /**\n * Processing interval determines how often entities should be processed.\n * Seconds provided will be multiplied by 1.5\n * The default processing interval is 100-150 seconds.\n * setting this too low will potentially deplete request quotas to upstream services.\n */\n setProcessingIntervalSeconds(seconds: number): CatalogBuilder {\n this.processingInterval = createRandomProcessingInterval({\n minSeconds: seconds,\n maxSeconds: seconds * 1.5,\n });\n return this;\n }\n\n /**\n * Overwrites the default processing interval function used to spread\n * entity updates in the catalog.\n */\n setProcessingInterval(\n processingInterval: ProcessingIntervalFunction,\n ): CatalogBuilder {\n this.processingInterval = processingInterval;\n return this;\n }\n\n /**\n * Overwrites the default location analyzer.\n */\n setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): CatalogBuilder {\n this.locationAnalyzer = locationAnalyzer;\n return this;\n }\n\n /**\n * Sets what policies to use for validation of entities between the pre-\n * processing and post-processing stages. All such policies must pass for the\n * entity to be considered valid.\n *\n * If what you want to do is to replace the rules for what format is allowed\n * in various core entity fields (such as metadata.name), you may want to use\n * {@link CatalogBuilder#setFieldFormatValidators} instead.\n *\n * This function replaces the default set of policies; use with care.\n *\n * @param policies - One or more policies\n */\n replaceEntityPolicies(policies: EntityPolicy[]): CatalogBuilder {\n this.entityPolicies = [...policies];\n this.entityPoliciesReplace = true;\n return this;\n }\n\n /**\n * Adds, or overwrites, a handler for placeholders (e.g. $file) in entity\n * definition files.\n *\n * @param key - The key that identifies the placeholder, e.g. \"file\"\n * @param resolver - The resolver that gets values for this placeholder\n */\n setPlaceholderResolver(\n key: string,\n resolver: PlaceholderResolver,\n ): CatalogBuilder {\n this.placeholderResolvers[key] = resolver;\n return this;\n }\n\n /**\n * Sets the validator function to use for one or more special fields of an\n * entity. This is useful if the default rules for formatting of fields are\n * not sufficient.\n *\n * This function has no effect if used together with\n * {@link CatalogBuilder#replaceEntityPolicies}.\n *\n * @param validators - The (subset of) validators to set\n */\n setFieldFormatValidators(validators: Partial<Validators>): CatalogBuilder {\n lodash.merge(this.fieldFormatValidators, validators);\n return this;\n }\n\n /**\n * Adds or replaces entity providers. These are responsible for bootstrapping\n * the list of entities out of original data sources. For example, there is\n * one entity source for the config locations, and one for the database\n * stored locations. If you ingest entities out of a third party system, you\n * may want to implement that in terms of an entity provider as well.\n *\n * @param providers - One or more entity providers\n */\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): CatalogBuilder {\n this.entityProviders.push(...providers.flat());\n return this;\n }\n\n /**\n * Adds entity processors. These are responsible for reading, parsing, and\n * processing entities before they are persisted in the catalog.\n *\n * @param processors - One or more processors\n */\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): CatalogBuilder {\n this.processors.push(...processors.flat());\n return this;\n }\n\n /**\n * Sets what entity processors to use. These are responsible for reading,\n * parsing, and processing entities before they are persisted in the catalog.\n *\n * This function replaces the default set of processors, consider using with\n * {@link CatalogBuilder#getDefaultProcessors}; use with care.\n *\n * @param processors - One or more processors\n */\n replaceProcessors(processors: CatalogProcessor[]): CatalogBuilder {\n this.processors = [...processors];\n this.processorsReplace = true;\n return this;\n }\n\n /**\n * Returns the default list of entity processors. These are responsible for reading,\n * parsing, and processing entities before they are persisted in the catalog. Changing\n * the order of processing can give more control to custom processors.\n *\n * Consider using with {@link CatalogBuilder#replaceProcessors}\n *\n */\n getDefaultProcessors(): CatalogProcessor[] {\n const { config, logger, reader } = this.env;\n const integrations = ScmIntegrations.fromConfig(config);\n\n return [\n new FileReaderProcessor(),\n new UrlReaderProcessor({ reader, logger }),\n CodeOwnersProcessor.fromConfig(config, { logger, reader }),\n new AnnotateLocationEntityProcessor({ integrations }),\n ];\n }\n\n /**\n * Adds Location Analyzers. These are responsible for analyzing\n * repositories when onboarding them into the catalog, by finding\n * catalog-info.yaml files and other artifacts that can help automatically\n * register or create catalog data on the user's behalf.\n *\n * @param locationAnalyzers - One or more location analyzers\n */\n addLocationAnalyzers(\n ...analyzers: Array<ScmLocationAnalyzer | Array<ScmLocationAnalyzer>>\n ): CatalogBuilder {\n this.locationAnalyzers.push(...analyzers.flat());\n return this;\n }\n\n /**\n * Sets up the catalog to use a custom parser for entity data.\n *\n * This is the function that gets called immediately after some raw entity\n * specification data has been read from a remote source, and needs to be\n * parsed and emitted as structured data.\n *\n * @param parser - The custom parser\n */\n setEntityDataParser(parser: CatalogProcessorParser): CatalogBuilder {\n this.parser = parser;\n return this;\n }\n\n /**\n * Adds additional permissions. See\n * {@link @backstage/plugin-permission-node#Permission}.\n *\n * @param permissions - Additional permissions\n */\n addPermissions(...permissions: Array<Permission | Array<Permission>>) {\n this.permissions.push(...permissions.flat());\n return this;\n }\n\n /**\n * Adds additional permission rules. Permission rules are used to evaluate\n * catalog resources against queries. See\n * {@link @backstage/plugin-permission-node#PermissionRule}.\n *\n * @param permissionRules - Additional permission rules\n */\n addPermissionRules(\n ...permissionRules: Array<\n CatalogPermissionRuleInput | Array<CatalogPermissionRuleInput>\n >\n ) {\n this.permissionRules.push(...permissionRules.flat());\n return this;\n }\n\n /**\n * Sets up the allowed location types from being registered via the location service.\n *\n * @param allowedLocationTypes - the allowed location types\n */\n setAllowedLocationTypes(allowedLocationTypes: string[]): CatalogBuilder {\n this.allowedLocationType = allowedLocationTypes;\n return this;\n }\n\n /**\n * Enables the legacy behaviour of canceling validation early whenever only a\n * single processor declares an entity kind to be valid.\n */\n useLegacySingleProcessorValidation(): this {\n this.legacySingleProcessorValidation = true;\n return this;\n }\n\n /**\n * Enables the publishing of events for conflicts in the DefaultProcessingDatabase\n */\n setEventBroker(broker: EventBroker | EventsService): CatalogBuilder {\n this.eventBroker = broker;\n return this;\n }\n\n /**\n * Wires up and returns all of the component parts of the catalog\n */\n async build(): Promise<{\n processingEngine: CatalogProcessingEngine;\n router: Router;\n }> {\n const {\n config,\n database,\n logger,\n permissions,\n scheduler,\n permissionsRegistry,\n discovery = HostDiscovery.fromConfig(config),\n auditor,\n } = this.env;\n\n const { auth, httpAuth } = createLegacyAuthAdapters({\n ...this.env,\n discovery,\n });\n\n const disableRelationsCompatibility = config.getOptionalBoolean(\n 'catalog.disableRelationsCompatibility',\n );\n\n const policy = this.buildEntityPolicy();\n const processors = this.buildProcessors();\n const parser = this.parser || defaultEntityDataParser;\n\n const dbClient = await database.getClient();\n if (!database.migrations?.skip) {\n logger.info('Performing database migration');\n await applyDatabaseMigrations(dbClient);\n }\n\n const stitcher = DefaultStitcher.fromConfig(config, {\n knex: dbClient,\n logger,\n });\n\n const processingDatabase = new DefaultProcessingDatabase({\n database: dbClient,\n logger,\n refreshInterval: this.processingInterval,\n eventBroker: this.eventBroker,\n });\n const providerDatabase = new DefaultProviderDatabase({\n database: dbClient,\n logger,\n });\n const catalogDatabase = new DefaultCatalogDatabase({\n database: dbClient,\n logger,\n });\n const integrations = ScmIntegrations.fromConfig(config);\n const rulesEnforcer = DefaultCatalogRulesEnforcer.fromConfig(config);\n\n const unauthorizedEntitiesCatalog = new DefaultEntitiesCatalog({\n database: dbClient,\n logger,\n stitcher,\n disableRelationsCompatibility,\n });\n\n let permissionsService: PermissionsService;\n if ('authorizeConditional' in permissions) {\n permissionsService = permissions as PermissionsService;\n } else {\n logger.warn(\n 'PermissionAuthorizer is deprecated. Please use an instance of PermissionEvaluator instead of PermissionAuthorizer in PluginEnvironment#permissions',\n );\n permissionsService = toPermissionEvaluator(permissions);\n }\n\n const orchestrator = new DefaultCatalogProcessingOrchestrator({\n processors,\n integrations,\n rulesEnforcer,\n logger,\n parser,\n policy,\n legacySingleProcessorValidation: this.legacySingleProcessorValidation,\n });\n\n const entitiesCatalog = new AuthorizedEntitiesCatalog(\n unauthorizedEntitiesCatalog,\n permissionsService,\n createConditionTransformer(this.permissionRules),\n );\n\n const catalogPermissionResource = {\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n getResources: async (resourceRefs: string[]) => {\n const { entities } = await unauthorizedEntitiesCatalog.entities({\n credentials: await auth.getOwnServiceCredentials(),\n filter: {\n anyOf: resourceRefs.map(resourceRef => {\n const { kind, namespace, name } = parseEntityRef(resourceRef);\n\n return basicEntityFilter({\n kind,\n 'metadata.namespace': namespace,\n 'metadata.name': name,\n });\n }),\n },\n });\n\n const entitiesByRef = keyBy(\n entitiesResponseToObjects(entities),\n stringifyEntityRef,\n );\n\n return resourceRefs.map(\n resourceRef =>\n entitiesByRef[stringifyEntityRef(parseEntityRef(resourceRef))],\n );\n },\n permissions: this.permissions,\n rules: this.permissionRules,\n } as const;\n\n let permissionIntegrationRouter:\n | ReturnType<typeof createPermissionIntegrationRouter>\n | undefined;\n if (permissionsRegistry) {\n permissionsRegistry.addResourceType(catalogPermissionResource);\n } else {\n permissionIntegrationRouter = createPermissionIntegrationRouter(\n catalogPermissionResource,\n );\n }\n\n const locationStore = new DefaultLocationStore(dbClient);\n const configLocationProvider = new ConfigLocationEntityProvider(config);\n const entityProviders = lodash.uniqBy(\n [...this.entityProviders, locationStore, configLocationProvider],\n provider => provider.getProviderName(),\n );\n\n const processingEngine = new DefaultCatalogProcessingEngine({\n config,\n scheduler,\n logger,\n knex: dbClient,\n processingDatabase,\n orchestrator,\n stitcher,\n createHash: () => createHash('sha1'),\n pollingIntervalMs: 1000,\n onProcessingError: event => {\n this.onProcessingError?.(event);\n },\n eventBroker: this.eventBroker,\n });\n\n const locationAnalyzer =\n this.locationAnalyzer ??\n new AuthorizedLocationAnalyzer(\n new RepoLocationAnalyzer(logger, integrations, this.locationAnalyzers),\n permissionsService,\n );\n const locationService = new AuthorizedLocationService(\n new DefaultLocationService(locationStore, orchestrator, {\n allowedLocationTypes: this.allowedLocationType,\n }),\n permissionsService,\n );\n const refreshService = new AuthorizedRefreshService(\n new DefaultRefreshService({ database: catalogDatabase }),\n permissionsService,\n );\n\n const router = await createRouter({\n entitiesCatalog,\n locationAnalyzer,\n locationService,\n orchestrator,\n refreshService,\n logger,\n config,\n permissionIntegrationRouter,\n auth,\n httpAuth,\n permissionsService,\n auditor,\n disableRelationsCompatibility,\n });\n\n await connectEntityProviders(providerDatabase, entityProviders);\n\n return {\n processingEngine: {\n async start() {\n await processingEngine.start();\n await stitcher.start();\n },\n async stop() {\n await processingEngine.stop();\n await stitcher.stop();\n },\n },\n router,\n };\n }\n\n subscribe(options: {\n onProcessingError: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void;\n }) {\n this.onProcessingError = options.onProcessingError;\n }\n\n private buildEntityPolicy(): EntityPolicy {\n const entityPolicies: EntityPolicy[] = this.entityPoliciesReplace\n ? [new SchemaValidEntityPolicy(), ...this.entityPolicies]\n : [\n new SchemaValidEntityPolicy(),\n new DefaultNamespaceEntityPolicy(),\n new NoForeignRootFieldsEntityPolicy(),\n new FieldFormatEntityPolicy(\n makeValidator(this.fieldFormatValidators),\n ),\n ...this.entityPolicies,\n ];\n\n return EntityPolicies.allOf(entityPolicies);\n }\n\n private buildProcessors(): CatalogProcessor[] {\n const { config, reader } = this.env;\n const integrations = ScmIntegrations.fromConfig(config);\n\n this.checkDeprecatedReaderProcessors();\n\n const placeholderResolvers: Record<string, PlaceholderResolver> = {\n json: jsonPlaceholderResolver,\n yaml: yamlPlaceholderResolver,\n text: textPlaceholderResolver,\n ...this.placeholderResolvers,\n };\n\n // The placeholder is always there no matter what\n const processors: CatalogProcessor[] = [\n new PlaceholderProcessor({\n resolvers: placeholderResolvers,\n reader,\n integrations,\n }),\n ];\n\n const builtinKindsEntityProcessor = new BuiltinKindsEntityProcessor();\n // If the user adds a processor named 'BuiltinKindsEntityProcessor',\n // skip inclusion of the catalog-backend version.\n if (\n !this.processors.some(\n processor =>\n processor.getProcessorName() ===\n builtinKindsEntityProcessor.getProcessorName(),\n )\n ) {\n processors.push(builtinKindsEntityProcessor);\n }\n\n // These are only added unless the user replaced them all\n if (!this.processorsReplace) {\n processors.push(...this.getDefaultProcessors());\n }\n\n // Add the ones (if any) that the user added\n processors.push(...this.processors);\n\n this.checkMissingExternalProcessors(processors);\n\n return processors;\n }\n\n // TODO(Rugvip): These old processors are removed, for a while we'll be throwing\n // errors here to make sure people know where to move the config\n private checkDeprecatedReaderProcessors() {\n const pc = this.env.config.getOptionalConfig('catalog.processors');\n if (pc?.has('github')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.github, move to using integrations.github instead`,\n );\n }\n if (pc?.has('gitlabApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.gitlabApi, move to using integrations.gitlab instead`,\n );\n }\n if (pc?.has('bitbucketApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.bitbucketApi, move to using integrations.bitbucket instead`,\n );\n }\n if (pc?.has('azureApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.azureApi, move to using integrations.azure instead`,\n );\n }\n }\n\n // TODO(freben): This can be removed no sooner than June 2022, after adopters have had some time to adapt to the new package structure\n private checkMissingExternalProcessors(processors: CatalogProcessor[]) {\n const skipCheckVarName = 'BACKSTAGE_CATALOG_SKIP_MISSING_PROCESSORS_CHECK';\n if (process.env[skipCheckVarName]) {\n return;\n }\n\n const locationTypes = new Set(\n this.env.config\n .getOptionalConfigArray('catalog.locations')\n ?.map(l => l.getString('type')) ?? [],\n );\n const processorNames = new Set(processors.map(p => p.getProcessorName()));\n\n function check(\n locationType: string,\n processorName: string,\n installationUrl: string,\n ) {\n if (\n locationTypes.has(locationType) &&\n !processorNames.has(processorName)\n ) {\n throw new Error(\n [\n `Your config contains a \"catalog.locations\" entry of type ${locationType},`,\n `but does not have the corresponding catalog processor ${processorName} installed.`,\n `This processor used to be built into the catalog itself, but is now moved to an`,\n `external module that has to be installed manually. Please follow the installation`,\n `instructions at ${installationUrl} if you are using this ability, or remove the`,\n `location from your app config if you do not. You can also silence this check entirely`,\n `by setting the environment variable ${skipCheckVarName} to 'true'.`,\n ].join(' '),\n );\n }\n }\n\n check(\n 'aws-cloud-accounts',\n 'AwsOrganizationCloudAccountProcessor',\n 'https://backstage.io/docs/integrations',\n );\n check(\n 's3-discovery',\n 'AwsS3DiscoveryProcessor',\n 'https://backstage.io/docs/integrations/aws-s3/discovery',\n );\n check(\n 'azure-discovery',\n 'AzureDevOpsDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/azure/discovery',\n );\n check(\n 'bitbucket-discovery',\n 'BitbucketDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/bitbucket/discovery',\n );\n check(\n 'github-discovery',\n 'GithubDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/github/discovery',\n );\n check(\n 'github-org',\n 'GithubOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/github/org',\n );\n check(\n 'gitlab-discovery',\n 'GitLabDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/gitlab/discovery',\n );\n check(\n 'ldap-org',\n 'LdapOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/ldap/org',\n );\n check(\n 'microsoft-graph-org',\n 'MicrosoftGraphOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/azure/org',\n );\n }\n\n private static getDefaultProcessingInterval(\n config: Config,\n ): ProcessingIntervalFunction {\n const processingIntervalKey = 'catalog.processingInterval';\n\n if (!config.has(processingIntervalKey)) {\n return createRandomProcessingInterval({\n minSeconds: 100,\n maxSeconds: 150,\n });\n }\n\n if (!Boolean(config.get('catalog.processingInterval'))) {\n return () => {\n throw new Error(\n 'catalog.processingInterval is set to false, processing is disabled.',\n );\n };\n }\n\n const duration = readDurationFromConfig(config, {\n key: processingIntervalKey,\n });\n\n const seconds = Math.max(\n 1,\n Math.round(durationToMilliseconds(duration) / 1000),\n );\n\n return createRandomProcessingInterval({\n minSeconds: seconds,\n maxSeconds: seconds * 1.5,\n });\n }\n}\n"],"names":["catalogPermissions","catalogPermissionRules","createRandomProcessingInterval","lodash","ScmIntegrations","FileReaderProcessor","UrlReaderProcessor","CodeOwnersProcessor","AnnotateLocationEntityProcessor","HostDiscovery","createLegacyAuthAdapters","defaultEntityDataParser","applyDatabaseMigrations","DefaultStitcher","DefaultProcessingDatabase","DefaultProviderDatabase","DefaultCatalogDatabase","DefaultCatalogRulesEnforcer","DefaultEntitiesCatalog","toPermissionEvaluator","DefaultCatalogProcessingOrchestrator","AuthorizedEntitiesCatalog","createConditionTransformer","RESOURCE_TYPE_CATALOG_ENTITY","parseEntityRef","basicEntityFilter","keyBy","entitiesResponseToObjects","stringifyEntityRef","createPermissionIntegrationRouter","DefaultLocationStore","ConfigLocationEntityProvider","DefaultCatalogProcessingEngine","createHash","AuthorizedLocationAnalyzer","RepoLocationAnalyzer","AuthorizedLocationService","DefaultLocationService","AuthorizedRefreshService","DefaultRefreshService","createRouter","connectEntityProviders","SchemaValidEntityPolicy","DefaultNamespaceEntityPolicy","NoForeignRootFieldsEntityPolicy","FieldFormatEntityPolicy","makeValidator","EntityPolicies","jsonPlaceholderResolver","yamlPlaceholderResolver","textPlaceholderResolver","PlaceholderProcessor","BuiltinKindsEnt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,KAAA;AAAA,MACE,YAAA;AAAA,MACA,0BAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,KAAA;AAAA,MACE,kBAAA;AAAA,MACA,0BAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,KAAA;AAAA,MACE,UAAA;AAAA,MACA,wBAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,KAAA;AAAA,MACE,qBAAA;AAAA,MACA,kCAAA;AAAA,MACA;AAAA,KACF;AAAA;AACF,EAEA,OAAe,6BACbC,QAC4B,EAAA;AAC5B,IAAA,MAAM,qBAAwB,GAAA,4BAAA;AAE9B,IAAA,IAAI,CAACA,QAAA,CAAO,GAAI,CAAA,qBAAqB,CAAG,EAAA;AACtC,MAAA,OAAOnD,sCAA+B,CAAA;AAAA,QACpC,UAAY,EAAA,GAAA;AAAA,QACZ,UAAY,EAAA;AAAA,OACb,CAAA;AAAA;AAGH,IAAA,IAAI,CAAC,OAAQ,CAAAmD,QAAA,CAAO,GAAI,CAAA,4BAA4B,CAAC,CAAG,EAAA;AACtD,MAAA,OAAO,MAAM;AACX,QAAA,MAAM,IAAI,KAAA;AAAA,UACR;AAAA,SACF;AAAA,OACF;AAAA;AAGF,IAAM,MAAA,QAAA,GAAWC,8BAAuBD,QAAQ,EAAA;AAAA,MAC9C,GAAK,EAAA;AAAA,KACN,CAAA;AAED,IAAA,MAAM,UAAU,IAAK,CAAA,GAAA;AAAA,MACnB,CAAA;AAAA,MACA,IAAK,CAAA,KAAA,CAAME,4BAAuB,CAAA,QAAQ,IAAI,GAAI;AAAA,KACpD;AAEA,IAAA,OAAOrD,sCAA+B,CAAA;AAAA,MACpC,UAAY,EAAA,OAAA;AAAA,MACZ,YAAY,OAAU,GAAA;AAAA,KACvB,CAAA;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"CatalogBuilder.cjs.js","sources":["../../src/service/CatalogBuilder.ts"],"sourcesContent":["/*\n * Copyright 2020 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 HostDiscovery,\n} from '@backstage/backend-common';\nimport {\n DefaultNamespaceEntityPolicy,\n Entity,\n EntityPolicies,\n EntityPolicy,\n FieldFormatEntityPolicy,\n makeValidator,\n NoForeignRootFieldsEntityPolicy,\n parseEntityRef,\n SchemaValidEntityPolicy,\n stringifyEntityRef,\n Validators,\n} from '@backstage/catalog-model';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { createHash } from 'crypto';\nimport { Router } from 'express';\nimport lodash from 'lodash';\n\nimport {\n AuditorService,\n AuthService,\n DatabaseService,\n DiscoveryService,\n HttpAuthService,\n LoggerService,\n PermissionsRegistryService,\n PermissionsService,\n RootConfigService,\n SchedulerService,\n UrlReaderService,\n} from '@backstage/backend-plugin-api';\nimport { Config, readDurationFromConfig } from '@backstage/config';\nimport {\n catalogPermissions,\n RESOURCE_TYPE_CATALOG_ENTITY,\n} from '@backstage/plugin-catalog-common/alpha';\nimport {\n CatalogProcessor,\n CatalogProcessorParser,\n EntitiesSearchFilter,\n EntityProvider,\n LocationAnalyzer,\n PlaceholderResolver,\n ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\nimport { EventBroker, EventsService } from '@backstage/plugin-events-node';\nimport {\n Permission,\n PermissionAuthorizer,\n PermissionRuleParams,\n toPermissionEvaluator,\n} from '@backstage/plugin-permission-common';\nimport {\n createConditionTransformer,\n createPermissionIntegrationRouter,\n PermissionRule,\n} from '@backstage/plugin-permission-node';\nimport { durationToMilliseconds } from '@backstage/types';\nimport { DefaultCatalogDatabase } from '../database/DefaultCatalogDatabase';\nimport { DefaultProcessingDatabase } from '../database/DefaultProcessingDatabase';\nimport { DefaultProviderDatabase } from '../database/DefaultProviderDatabase';\nimport { applyDatabaseMigrations } from '../database/migrations';\nimport { DefaultCatalogRulesEnforcer } from '../ingestion/CatalogRules';\nimport { RepoLocationAnalyzer } from '../ingestion/LocationAnalyzer';\nimport { permissionRules as catalogPermissionRules } from '../permissions/rules';\nimport {\n CatalogProcessingEngine,\n createRandomProcessingInterval,\n ProcessingIntervalFunction,\n} from '../processing';\nimport { connectEntityProviders } from '../processing/connectEntityProviders';\nimport { DefaultCatalogProcessingEngine } from '../processing/DefaultCatalogProcessingEngine';\nimport { DefaultCatalogProcessingOrchestrator } from '../processing/DefaultCatalogProcessingOrchestrator';\nimport {\n AnnotateLocationEntityProcessor,\n BuiltinKindsEntityProcessor,\n CodeOwnersProcessor,\n FileReaderProcessor,\n PlaceholderProcessor,\n UrlReaderProcessor,\n} from '../processors';\nimport {\n jsonPlaceholderResolver,\n textPlaceholderResolver,\n yamlPlaceholderResolver,\n} from '../processors/PlaceholderProcessor';\nimport { ConfigLocationEntityProvider } from '../providers/ConfigLocationEntityProvider';\nimport { DefaultLocationStore } from '../providers/DefaultLocationStore';\nimport { DefaultStitcher } from '../stitching/DefaultStitcher';\nimport { defaultEntityDataParser } from '../util/parse';\nimport { AuthorizedEntitiesCatalog } from './AuthorizedEntitiesCatalog';\nimport { AuthorizedLocationAnalyzer } from './AuthorizedLocationAnalyzer';\nimport { AuthorizedLocationService } from './AuthorizedLocationService';\nimport { AuthorizedRefreshService } from './AuthorizedRefreshService';\nimport { createRouter } from './createRouter';\nimport { DefaultEntitiesCatalog } from './DefaultEntitiesCatalog';\nimport { DefaultLocationService } from './DefaultLocationService';\nimport { DefaultRefreshService } from './DefaultRefreshService';\nimport { basicEntityFilter } from './request';\nimport { entitiesResponseToObjects } from './response';\nimport { catalogEntityPermissionResourceRef } from '@backstage/plugin-catalog-node/alpha';\n\n/**\n * This is a duplicate of the alpha `CatalogPermissionRule` type, for use in the stable API.\n *\n * @public\n */\nexport type CatalogPermissionRuleInput<\n TParams extends PermissionRuleParams = PermissionRuleParams,\n> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;\n\n/**\n * @deprecated Please migrate to the new backend system as this will be removed in the future.\n * @public\n */\nexport type CatalogEnvironment = {\n logger: LoggerService;\n database: DatabaseService;\n config: RootConfigService;\n reader: UrlReaderService;\n permissions: PermissionsService | PermissionAuthorizer;\n permissionsRegistry?: PermissionsRegistryService;\n scheduler?: SchedulerService;\n discovery?: DiscoveryService;\n auth?: AuthService;\n httpAuth?: HttpAuthService;\n auditor?: AuditorService;\n};\n\n/**\n * A builder that helps wire up all of the component parts of the catalog.\n *\n * The touch points where you can replace or extend behavior are as follows:\n *\n * - Entity policies can be added or replaced. These are automatically run\n * after the processors' pre-processing steps. All policies are given the\n * chance to inspect the entity, and all of them have to pass in order for\n * the entity to be considered valid from an overall point of view.\n * - Location analyzers can be added. These are responsible for analyzing\n * repositories when onboarding them into the catalog, by finding\n * catalog-info.yaml files and other artifacts that can help automatically\n * register or create catalog data on the user's behalf.\n * - Placeholder resolvers can be replaced or added. These run on the raw\n * structured data between the parsing and pre-processing steps, to replace\n * dollar-prefixed entries with their actual values (like $file).\n * - Field format validators can be replaced. These check the format of\n * individual core fields such as metadata.name, to ensure that they adhere\n * to certain rules.\n * - Processors can be added or replaced. These implement the functionality of\n * reading, parsing, validating, and processing the entity data before it is\n * persisted in the catalog.\n *\n * @public\n * @deprecated Please migrate to the new backend system as this will be removed in the future.\n */\nexport class CatalogBuilder {\n private readonly env: CatalogEnvironment;\n private entityPolicies: EntityPolicy[];\n private entityPoliciesReplace: boolean;\n private placeholderResolvers: Record<string, PlaceholderResolver>;\n private fieldFormatValidators: Partial<Validators>;\n private entityProviders: EntityProvider[];\n private processors: CatalogProcessor[];\n private locationAnalyzers: ScmLocationAnalyzer[];\n private processorsReplace: boolean;\n private parser: CatalogProcessorParser | undefined;\n private onProcessingError?: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void;\n private processingInterval: ProcessingIntervalFunction;\n private locationAnalyzer: LocationAnalyzer | undefined = undefined;\n private readonly permissions: Permission[];\n private readonly permissionRules: CatalogPermissionRuleInput[];\n private allowedLocationType: string[];\n private legacySingleProcessorValidation = false;\n private eventBroker?: EventBroker | EventsService;\n\n /**\n * Creates a catalog builder.\n */\n static create(env: CatalogEnvironment): CatalogBuilder {\n return new CatalogBuilder(env);\n }\n\n private constructor(env: CatalogEnvironment) {\n this.env = env;\n this.entityPolicies = [];\n this.entityPoliciesReplace = false;\n this.placeholderResolvers = {};\n this.fieldFormatValidators = {};\n this.entityProviders = [];\n this.processors = [];\n this.locationAnalyzers = [];\n this.processorsReplace = false;\n this.parser = undefined;\n this.permissions = [...catalogPermissions];\n this.permissionRules = Object.values(catalogPermissionRules);\n this.allowedLocationType = ['url'];\n\n this.processingInterval = CatalogBuilder.getDefaultProcessingInterval(\n env.config,\n );\n }\n\n /**\n * Adds policies that are used to validate entities between the pre-\n * processing and post-processing stages. All such policies must pass for the\n * entity to be considered valid.\n *\n * If what you want to do is to replace the rules for what format is allowed\n * in various core entity fields (such as metadata.name), you may want to use\n * {@link CatalogBuilder#setFieldFormatValidators} instead.\n *\n * @param policies - One or more policies\n */\n addEntityPolicy(\n ...policies: Array<EntityPolicy | Array<EntityPolicy>>\n ): CatalogBuilder {\n this.entityPolicies.push(...policies.flat());\n return this;\n }\n\n /**\n * Processing interval determines how often entities should be processed.\n * Seconds provided will be multiplied by 1.5\n * The default processing interval is 100-150 seconds.\n * setting this too low will potentially deplete request quotas to upstream services.\n */\n setProcessingIntervalSeconds(seconds: number): CatalogBuilder {\n this.processingInterval = createRandomProcessingInterval({\n minSeconds: seconds,\n maxSeconds: seconds * 1.5,\n });\n return this;\n }\n\n /**\n * Overwrites the default processing interval function used to spread\n * entity updates in the catalog.\n */\n setProcessingInterval(\n processingInterval: ProcessingIntervalFunction,\n ): CatalogBuilder {\n this.processingInterval = processingInterval;\n return this;\n }\n\n /**\n * Overwrites the default location analyzer.\n */\n setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): CatalogBuilder {\n this.locationAnalyzer = locationAnalyzer;\n return this;\n }\n\n /**\n * Sets what policies to use for validation of entities between the pre-\n * processing and post-processing stages. All such policies must pass for the\n * entity to be considered valid.\n *\n * If what you want to do is to replace the rules for what format is allowed\n * in various core entity fields (such as metadata.name), you may want to use\n * {@link CatalogBuilder#setFieldFormatValidators} instead.\n *\n * This function replaces the default set of policies; use with care.\n *\n * @param policies - One or more policies\n */\n replaceEntityPolicies(policies: EntityPolicy[]): CatalogBuilder {\n this.entityPolicies = [...policies];\n this.entityPoliciesReplace = true;\n return this;\n }\n\n /**\n * Adds, or overwrites, a handler for placeholders (e.g. $file) in entity\n * definition files.\n *\n * @param key - The key that identifies the placeholder, e.g. \"file\"\n * @param resolver - The resolver that gets values for this placeholder\n */\n setPlaceholderResolver(\n key: string,\n resolver: PlaceholderResolver,\n ): CatalogBuilder {\n this.placeholderResolvers[key] = resolver;\n return this;\n }\n\n /**\n * Sets the validator function to use for one or more special fields of an\n * entity. This is useful if the default rules for formatting of fields are\n * not sufficient.\n *\n * This function has no effect if used together with\n * {@link CatalogBuilder#replaceEntityPolicies}.\n *\n * @param validators - The (subset of) validators to set\n */\n setFieldFormatValidators(validators: Partial<Validators>): CatalogBuilder {\n lodash.merge(this.fieldFormatValidators, validators);\n return this;\n }\n\n /**\n * Adds or replaces entity providers. These are responsible for bootstrapping\n * the list of entities out of original data sources. For example, there is\n * one entity source for the config locations, and one for the database\n * stored locations. If you ingest entities out of a third party system, you\n * may want to implement that in terms of an entity provider as well.\n *\n * @param providers - One or more entity providers\n */\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): CatalogBuilder {\n this.entityProviders.push(...providers.flat());\n return this;\n }\n\n /**\n * Adds entity processors. These are responsible for reading, parsing, and\n * processing entities before they are persisted in the catalog.\n *\n * @param processors - One or more processors\n */\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): CatalogBuilder {\n this.processors.push(...processors.flat());\n return this;\n }\n\n /**\n * Sets what entity processors to use. These are responsible for reading,\n * parsing, and processing entities before they are persisted in the catalog.\n *\n * This function replaces the default set of processors, consider using with\n * {@link CatalogBuilder#getDefaultProcessors}; use with care.\n *\n * @param processors - One or more processors\n */\n replaceProcessors(processors: CatalogProcessor[]): CatalogBuilder {\n this.processors = [...processors];\n this.processorsReplace = true;\n return this;\n }\n\n /**\n * Returns the default list of entity processors. These are responsible for reading,\n * parsing, and processing entities before they are persisted in the catalog. Changing\n * the order of processing can give more control to custom processors.\n *\n * Consider using with {@link CatalogBuilder#replaceProcessors}\n *\n */\n getDefaultProcessors(): CatalogProcessor[] {\n const { config, logger, reader } = this.env;\n const integrations = ScmIntegrations.fromConfig(config);\n\n return [\n new FileReaderProcessor(),\n new UrlReaderProcessor({ reader, logger, config }),\n CodeOwnersProcessor.fromConfig(config, { logger, reader }),\n new AnnotateLocationEntityProcessor({ integrations }),\n ];\n }\n\n /**\n * Adds Location Analyzers. These are responsible for analyzing\n * repositories when onboarding them into the catalog, by finding\n * catalog-info.yaml files and other artifacts that can help automatically\n * register or create catalog data on the user's behalf.\n *\n * @param locationAnalyzers - One or more location analyzers\n */\n addLocationAnalyzers(\n ...analyzers: Array<ScmLocationAnalyzer | Array<ScmLocationAnalyzer>>\n ): CatalogBuilder {\n this.locationAnalyzers.push(...analyzers.flat());\n return this;\n }\n\n /**\n * Sets up the catalog to use a custom parser for entity data.\n *\n * This is the function that gets called immediately after some raw entity\n * specification data has been read from a remote source, and needs to be\n * parsed and emitted as structured data.\n *\n * @param parser - The custom parser\n */\n setEntityDataParser(parser: CatalogProcessorParser): CatalogBuilder {\n this.parser = parser;\n return this;\n }\n\n /**\n * Adds additional permissions. See\n * {@link @backstage/plugin-permission-node#Permission}.\n *\n * @param permissions - Additional permissions\n */\n addPermissions(...permissions: Array<Permission | Array<Permission>>) {\n this.permissions.push(...permissions.flat());\n return this;\n }\n\n /**\n * Adds additional permission rules. Permission rules are used to evaluate\n * catalog resources against queries. See\n * {@link @backstage/plugin-permission-node#PermissionRule}.\n *\n * @param permissionRules - Additional permission rules\n */\n addPermissionRules(\n ...permissionRules: Array<\n CatalogPermissionRuleInput | Array<CatalogPermissionRuleInput>\n >\n ) {\n this.permissionRules.push(...permissionRules.flat());\n return this;\n }\n\n /**\n * Sets up the allowed location types from being registered via the location service.\n *\n * @param allowedLocationTypes - the allowed location types\n */\n setAllowedLocationTypes(allowedLocationTypes: string[]): CatalogBuilder {\n this.allowedLocationType = allowedLocationTypes;\n return this;\n }\n\n /**\n * Enables the legacy behaviour of canceling validation early whenever only a\n * single processor declares an entity kind to be valid.\n */\n useLegacySingleProcessorValidation(): this {\n this.legacySingleProcessorValidation = true;\n return this;\n }\n\n /**\n * Enables the publishing of events for conflicts in the DefaultProcessingDatabase\n */\n setEventBroker(broker: EventBroker | EventsService): CatalogBuilder {\n this.eventBroker = broker;\n return this;\n }\n\n /**\n * Wires up and returns all of the component parts of the catalog\n */\n async build(): Promise<{\n processingEngine: CatalogProcessingEngine;\n router: Router;\n }> {\n const {\n config,\n database,\n logger,\n permissions,\n scheduler,\n permissionsRegistry,\n discovery = HostDiscovery.fromConfig(config),\n auditor,\n } = this.env;\n\n const { auth, httpAuth } = createLegacyAuthAdapters({\n ...this.env,\n discovery,\n });\n\n const disableRelationsCompatibility = config.getOptionalBoolean(\n 'catalog.disableRelationsCompatibility',\n );\n\n const policy = this.buildEntityPolicy();\n const processors = this.buildProcessors();\n const parser = this.parser || defaultEntityDataParser;\n\n const dbClient = await database.getClient();\n if (!database.migrations?.skip) {\n logger.info('Performing database migration');\n await applyDatabaseMigrations(dbClient);\n }\n\n const stitcher = DefaultStitcher.fromConfig(config, {\n knex: dbClient,\n logger,\n });\n\n const processingDatabase = new DefaultProcessingDatabase({\n database: dbClient,\n logger,\n refreshInterval: this.processingInterval,\n eventBroker: this.eventBroker,\n });\n const providerDatabase = new DefaultProviderDatabase({\n database: dbClient,\n logger,\n });\n const catalogDatabase = new DefaultCatalogDatabase({\n database: dbClient,\n logger,\n });\n const integrations = ScmIntegrations.fromConfig(config);\n const rulesEnforcer = DefaultCatalogRulesEnforcer.fromConfig(config);\n\n const unauthorizedEntitiesCatalog = new DefaultEntitiesCatalog({\n database: dbClient,\n logger,\n stitcher,\n disableRelationsCompatibility,\n });\n\n let permissionsService: PermissionsService;\n if ('authorizeConditional' in permissions) {\n permissionsService = permissions as PermissionsService;\n } else {\n logger.warn(\n 'PermissionAuthorizer is deprecated. Please use an instance of PermissionEvaluator instead of PermissionAuthorizer in PluginEnvironment#permissions',\n );\n permissionsService = toPermissionEvaluator(permissions);\n }\n\n const orchestrator = new DefaultCatalogProcessingOrchestrator({\n processors,\n integrations,\n rulesEnforcer,\n logger,\n parser,\n policy,\n legacySingleProcessorValidation: this.legacySingleProcessorValidation,\n });\n\n const entitiesCatalog = new AuthorizedEntitiesCatalog(\n unauthorizedEntitiesCatalog,\n permissionsService,\n permissionsRegistry\n ? createConditionTransformer(\n permissionsRegistry.getPermissionRuleset(\n catalogEntityPermissionResourceRef,\n ),\n )\n : createConditionTransformer(this.permissionRules),\n );\n\n const catalogPermissionResource = {\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n getResources: async (resourceRefs: string[]) => {\n const { entities } = await unauthorizedEntitiesCatalog.entities({\n credentials: await auth.getOwnServiceCredentials(),\n filter: {\n anyOf: resourceRefs.map(resourceRef => {\n const { kind, namespace, name } = parseEntityRef(resourceRef);\n\n return basicEntityFilter({\n kind,\n 'metadata.namespace': namespace,\n 'metadata.name': name,\n });\n }),\n },\n });\n\n const entitiesByRef = Object.fromEntries(\n entitiesResponseToObjects(entities)\n .filter((x): x is Entity => Boolean(x))\n .map(entity => [stringifyEntityRef(entity), entity]),\n );\n\n return resourceRefs.map(\n resourceRef =>\n entitiesByRef[stringifyEntityRef(parseEntityRef(resourceRef))],\n );\n },\n permissions: this.permissions,\n rules: this.permissionRules,\n } as const;\n\n let permissionIntegrationRouter:\n | ReturnType<typeof createPermissionIntegrationRouter>\n | undefined;\n if (permissionsRegistry) {\n permissionsRegistry.addResourceType({\n ...catalogPermissionResource,\n resourceRef: catalogEntityPermissionResourceRef,\n });\n } else {\n permissionIntegrationRouter = createPermissionIntegrationRouter(\n catalogPermissionResource,\n );\n }\n\n const locationStore = new DefaultLocationStore(dbClient);\n const configLocationProvider = new ConfigLocationEntityProvider(config);\n const entityProviders = lodash.uniqBy(\n [...this.entityProviders, locationStore, configLocationProvider],\n provider => provider.getProviderName(),\n );\n\n const processingEngine = new DefaultCatalogProcessingEngine({\n config,\n scheduler,\n logger,\n knex: dbClient,\n processingDatabase,\n orchestrator,\n stitcher,\n createHash: () => createHash('sha1'),\n pollingIntervalMs: 1000,\n onProcessingError: event => {\n this.onProcessingError?.(event);\n },\n eventBroker: this.eventBroker,\n });\n\n const locationAnalyzer =\n this.locationAnalyzer ??\n new AuthorizedLocationAnalyzer(\n new RepoLocationAnalyzer(logger, integrations, this.locationAnalyzers),\n permissionsService,\n );\n const locationService = new AuthorizedLocationService(\n new DefaultLocationService(locationStore, orchestrator, {\n allowedLocationTypes: this.allowedLocationType,\n }),\n permissionsService,\n );\n const refreshService = new AuthorizedRefreshService(\n new DefaultRefreshService({ database: catalogDatabase }),\n permissionsService,\n );\n\n const router = await createRouter({\n entitiesCatalog,\n locationAnalyzer,\n locationService,\n orchestrator,\n refreshService,\n logger,\n config,\n permissionIntegrationRouter,\n auth,\n httpAuth,\n permissionsService,\n auditor,\n disableRelationsCompatibility,\n });\n\n await connectEntityProviders(providerDatabase, entityProviders);\n\n return {\n processingEngine: {\n async start() {\n await processingEngine.start();\n await stitcher.start();\n },\n async stop() {\n await processingEngine.stop();\n await stitcher.stop();\n },\n },\n router,\n };\n }\n\n subscribe(options: {\n onProcessingError: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void;\n }) {\n this.onProcessingError = options.onProcessingError;\n }\n\n private buildEntityPolicy(): EntityPolicy {\n const entityPolicies: EntityPolicy[] = this.entityPoliciesReplace\n ? [new SchemaValidEntityPolicy(), ...this.entityPolicies]\n : [\n new SchemaValidEntityPolicy(),\n new DefaultNamespaceEntityPolicy(),\n new NoForeignRootFieldsEntityPolicy(),\n new FieldFormatEntityPolicy(\n makeValidator(this.fieldFormatValidators),\n ),\n ...this.entityPolicies,\n ];\n\n return EntityPolicies.allOf(entityPolicies);\n }\n\n private buildProcessors(): CatalogProcessor[] {\n const { config, reader } = this.env;\n const integrations = ScmIntegrations.fromConfig(config);\n\n this.checkDeprecatedReaderProcessors();\n\n const placeholderResolvers: Record<string, PlaceholderResolver> = {\n json: jsonPlaceholderResolver,\n yaml: yamlPlaceholderResolver,\n text: textPlaceholderResolver,\n ...this.placeholderResolvers,\n };\n\n // The placeholder is always there no matter what\n const processors: CatalogProcessor[] = [\n new PlaceholderProcessor({\n resolvers: placeholderResolvers,\n reader,\n integrations,\n }),\n ];\n\n const builtinKindsEntityProcessor = new BuiltinKindsEntityProcessor();\n // If the user adds a processor named 'BuiltinKindsEntityProcessor',\n // skip inclusion of the catalog-backend version.\n if (\n !this.processors.some(\n processor =>\n processor.getProcessorName() ===\n builtinKindsEntityProcessor.getProcessorName(),\n )\n ) {\n processors.push(builtinKindsEntityProcessor);\n }\n\n // These are only added unless the user replaced them all\n if (!this.processorsReplace) {\n processors.push(...this.getDefaultProcessors());\n }\n\n // Add the ones (if any) that the user added\n processors.push(...this.processors);\n\n this.checkMissingExternalProcessors(processors);\n\n return processors;\n }\n\n // TODO(Rugvip): These old processors are removed, for a while we'll be throwing\n // errors here to make sure people know where to move the config\n private checkDeprecatedReaderProcessors() {\n const pc = this.env.config.getOptionalConfig('catalog.processors');\n if (pc?.has('github')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.github, move to using integrations.github instead`,\n );\n }\n if (pc?.has('gitlabApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.gitlabApi, move to using integrations.gitlab instead`,\n );\n }\n if (pc?.has('bitbucketApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.bitbucketApi, move to using integrations.bitbucket instead`,\n );\n }\n if (pc?.has('azureApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.azureApi, move to using integrations.azure instead`,\n );\n }\n }\n\n // TODO(freben): This can be removed no sooner than June 2022, after adopters have had some time to adapt to the new package structure\n private checkMissingExternalProcessors(processors: CatalogProcessor[]) {\n const skipCheckVarName = 'BACKSTAGE_CATALOG_SKIP_MISSING_PROCESSORS_CHECK';\n if (process.env[skipCheckVarName]) {\n return;\n }\n\n const locationTypes = new Set(\n this.env.config\n .getOptionalConfigArray('catalog.locations')\n ?.map(l => l.getString('type')) ?? [],\n );\n const processorNames = new Set(processors.map(p => p.getProcessorName()));\n\n function check(\n locationType: string,\n processorName: string,\n installationUrl: string,\n ) {\n if (\n locationTypes.has(locationType) &&\n !processorNames.has(processorName)\n ) {\n throw new Error(\n [\n `Your config contains a \"catalog.locations\" entry of type ${locationType},`,\n `but does not have the corresponding catalog processor ${processorName} installed.`,\n `This processor used to be built into the catalog itself, but is now moved to an`,\n `external module that has to be installed manually. Please follow the installation`,\n `instructions at ${installationUrl} if you are using this ability, or remove the`,\n `location from your app config if you do not. You can also silence this check entirely`,\n `by setting the environment variable ${skipCheckVarName} to 'true'.`,\n ].join(' '),\n );\n }\n }\n\n check(\n 'aws-cloud-accounts',\n 'AwsOrganizationCloudAccountProcessor',\n 'https://backstage.io/docs/integrations',\n );\n check(\n 's3-discovery',\n 'AwsS3DiscoveryProcessor',\n 'https://backstage.io/docs/integrations/aws-s3/discovery',\n );\n check(\n 'azure-discovery',\n 'AzureDevOpsDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/azure/discovery',\n );\n check(\n 'bitbucket-discovery',\n 'BitbucketDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/bitbucket/discovery',\n );\n check(\n 'github-discovery',\n 'GithubDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/github/discovery',\n );\n check(\n 'github-org',\n 'GithubOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/github/org',\n );\n check(\n 'gitlab-discovery',\n 'GitLabDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/gitlab/discovery',\n );\n check(\n 'ldap-org',\n 'LdapOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/ldap/org',\n );\n check(\n 'microsoft-graph-org',\n 'MicrosoftGraphOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/azure/org',\n );\n }\n\n private static getDefaultProcessingInterval(\n config: Config,\n ): ProcessingIntervalFunction {\n const processingIntervalKey = 'catalog.processingInterval';\n\n if (!config.has(processingIntervalKey)) {\n return createRandomProcessingInterval({\n minSeconds: 100,\n maxSeconds: 150,\n });\n }\n\n if (!Boolean(config.get('catalog.processingInterval'))) {\n return () => {\n throw new Error(\n 'catalog.processingInterval is set to false, processing is disabled.',\n );\n };\n }\n\n const duration = readDurationFromConfig(config, {\n key: processingIntervalKey,\n });\n\n const seconds = Math.max(\n 1,\n Math.round(durationToMilliseconds(duration) / 1000),\n );\n\n return createRandomProcessingInterval({\n minSeconds: seconds,\n maxSeconds: seconds * 1.5,\n });\n }\n}\n"],"names":["catalogPermissions","catalogPermissionRules","createRandomProcessingInterval","lodash","ScmIntegrations","FileReaderProcessor","UrlReaderProcessor","CodeOwnersProcessor","AnnotateLocationEntityProcessor","HostDiscovery","createLegacyAuthAdapters","defaultEntityDataParser","applyDatabaseMigrations","DefaultStitcher","DefaultProcessingDatabase","DefaultProviderDatabase","DefaultCatalogDatabase","DefaultCatalogRulesEnforcer","DefaultEntitiesCatalog","toPermissionEvaluator","DefaultCatalogProcessingOrchestrator","AuthorizedEntitiesCatalog","createConditionTransformer","catalogEntityPermissionResourceRef","RESOURCE_TYPE_CATALOG_ENTITY","parseEntityRef","basicEntityFilter","entitiesResponseToObjects","stringifyEntityRef","createPermissionIntegrationRouter","DefaultLocationStore","ConfigLocationEntityProvider","DefaultCatalogProcessingEngine","createHash","AuthorizedLocationAnalyzer","RepoLocationAnalyzer","AuthorizedLocationService","DefaultLocationService","AuthorizedRefreshService","DefaultRefreshService","createRouter","connectEntityProviders","SchemaValidEntityPolicy","DefaultNamespaceEntityPolicy","NoForeignRootFieldsEntityPolicy","FieldFormatEntityPolicy","makeValidator","EntityPolicies","jsonPlaceholderResolver","yamlPlaceholderResolver","textPlaceholderResolver","PlaceholderProcessor","BuiltinKindsEntityProcessor","config","readDurationFromConfig","durationToMilliseconds"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+KO,MAAM,cAAe,CAAA;AAAA,EACT,GAAA;AAAA,EACT,cAAA;AAAA,EACA,qBAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,eAAA;AAAA,EACA,UAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA,MAAA;AAAA,EACA,iBAAA;AAAA,EAIA,kBAAA;AAAA,EACA,gBAAiD,GAAA,KAAA,CAAA;AAAA,EACxC,WAAA;AAAA,EACA,eAAA;AAAA,EACT,mBAAA;AAAA,EACA,+BAAkC,GAAA,KAAA;AAAA,EAClC,WAAA;AAAA;AAAA;AAAA;AAAA,EAKR,OAAO,OAAO,GAAyC,EAAA;AACrD,IAAO,OAAA,IAAI,eAAe,GAAG,CAAA;AAAA;AAC/B,EAEQ,YAAY,GAAyB,EAAA;AAC3C,IAAA,IAAA,CAAK,GAAM,GAAA,GAAA;AACX,IAAA,IAAA,CAAK,iBAAiB,EAAC;AACvB,IAAA,IAAA,CAAK,qBAAwB,GAAA,KAAA;AAC7B,IAAA,IAAA,CAAK,uBAAuB,EAAC;AAC7B,IAAA,IAAA,CAAK,wBAAwB,EAAC;AAC9B,IAAA,IAAA,CAAK,kBAAkB,EAAC;AACxB,IAAA,IAAA,CAAK,aAAa,EAAC;AACnB,IAAA,IAAA,CAAK,oBAAoB,EAAC;AA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,MAAA,OAAO,MAAM;AACX,QAAA,MAAM,IAAI,KAAA;AAAA,UACR;AAAA,SACF;AAAA,OACF;AAAA;AAGF,IAAM,MAAA,QAAA,GAAWC,8BAAuBD,QAAQ,EAAA;AAAA,MAC9C,GAAK,EAAA;AAAA,KACN,CAAA;AAED,IAAA,MAAM,UAAU,IAAK,CAAA,GAAA;AAAA,MACnB,CAAA;AAAA,MACA,IAAK,CAAA,KAAA,CAAME,4BAAuB,CAAA,QAAQ,IAAI,GAAI;AAAA,KACpD;AAEA,IAAA,OAAOrD,sCAA+B,CAAA;AAAA,MACpC,UAAY,EAAA,OAAA;AAAA,MACZ,YAAY,OAAU,GAAA;AAAA,KACvB,CAAA;AAAA;AAEL;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend",
3
- "version": "1.31.0-next.1",
3
+ "version": "1.31.0-next.3",
4
4
  "description": "The Backstage backend plugin that provides the Backstage catalog",
5
5
  "backstage": {
6
6
  "role": "backend-plugin",
@@ -11,7 +11,11 @@
11
11
  "@backstage/plugin-catalog-common",
12
12
  "@backstage/plugin-catalog-node",
13
13
  "@backstage/plugin-catalog-react"
14
- ]
14
+ ],
15
+ "features": {
16
+ ".": "@backstage/BackendFeature",
17
+ "./alpha": "@backstage/BackendFeature"
18
+ }
15
19
  },
16
20
  "publishConfig": {
17
21
  "access": "public"
@@ -72,19 +76,19 @@
72
76
  },
73
77
  "dependencies": {
74
78
  "@backstage/backend-common": "^0.25.0",
75
- "@backstage/backend-openapi-utils": "0.5.0-next.1",
76
- "@backstage/backend-plugin-api": "1.2.0-next.0",
79
+ "@backstage/backend-openapi-utils": "0.5.0-next.3",
80
+ "@backstage/backend-plugin-api": "1.2.0-next.2",
77
81
  "@backstage/catalog-client": "1.9.1",
78
82
  "@backstage/catalog-model": "1.7.3",
79
83
  "@backstage/config": "1.3.2",
80
84
  "@backstage/errors": "1.2.7",
81
85
  "@backstage/integration": "1.16.1",
82
86
  "@backstage/plugin-catalog-common": "1.1.3",
83
- "@backstage/plugin-catalog-node": "1.16.0-next.1",
84
- "@backstage/plugin-events-node": "0.4.8-next.0",
87
+ "@backstage/plugin-catalog-node": "1.16.0-next.3",
88
+ "@backstage/plugin-events-node": "0.4.8-next.2",
85
89
  "@backstage/plugin-permission-common": "0.8.4",
86
- "@backstage/plugin-permission-node": "0.8.8-next.0",
87
- "@backstage/plugin-search-backend-module-catalog": "0.3.1-next.1",
90
+ "@backstage/plugin-permission-node": "0.8.8-next.2",
91
+ "@backstage/plugin-search-backend-module-catalog": "0.3.1-next.3",
88
92
  "@backstage/plugin-search-common": "1.2.17",
89
93
  "@backstage/types": "1.2.1",
90
94
  "@opentelemetry/api": "^1.9.0",
@@ -108,11 +112,12 @@
108
112
  "zod": "^3.22.4"
109
113
  },
110
114
  "devDependencies": {
111
- "@backstage/backend-defaults": "0.8.0-next.1",
112
- "@backstage/backend-test-utils": "1.3.0-next.1",
113
- "@backstage/cli": "0.30.0-next.1",
115
+ "@backstage/backend-defaults": "0.8.0-next.3",
116
+ "@backstage/backend-test-utils": "1.3.0-next.3",
117
+ "@backstage/cli": "0.30.0-next.3",
114
118
  "@backstage/plugin-permission-common": "0.8.4",
115
- "@backstage/repo-tools": "0.12.2-next.1",
119
+ "@backstage/repo-tools": "0.12.2-next.3",
120
+ "@backstage/test-utils": "1.7.5-next.0",
116
121
  "@types/core-js": "^2.5.4",
117
122
  "@types/git-url-parse": "^9.0.0",
118
123
  "@types/glob": "^8.0.0",