@backstage/plugin-catalog-backend 1.8.1-next.1 → 1.9.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 +49 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +1 -2
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/alpha.d.ts +4 -4
- package/dist/cjs/{CatalogBuilder-adbbf6ff.cjs.js → CatalogBuilder-c295413f.cjs.js} +23 -25
- package/dist/cjs/CatalogBuilder-c295413f.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +37 -37
- package/dist/types/{types.d-681f9283.d.ts → types.d-c2093007.d.ts} +2 -2
- package/package.json +14 -13
- package/dist/cjs/CatalogBuilder-adbbf6ff.cjs.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend
|
|
2
2
|
|
|
3
|
+
## 1.9.0-next.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 92a4590fc3a: Add monorepo support to CodeOwnersProccesor.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- be5aca50114: Updates and moves OpenAPI spec to `src/schema/openapi.yaml` and uses `ApiRouter` type from `@backstage/backend-openapi-utils` to handle automatic types from the OpenAPI spec file.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- @backstage/catalog-model@1.3.0-next.0
|
|
14
|
+
- @backstage/backend-common@0.18.4-next.2
|
|
15
|
+
- @backstage/backend-plugin-api@0.5.1-next.2
|
|
16
|
+
- @backstage/catalog-client@1.4.1-next.1
|
|
17
|
+
- @backstage/config@1.0.7
|
|
18
|
+
- @backstage/errors@1.1.5
|
|
19
|
+
- @backstage/integration@1.4.4-next.0
|
|
20
|
+
- @backstage/types@1.0.2
|
|
21
|
+
- @backstage/plugin-catalog-common@1.0.13-next.1
|
|
22
|
+
- @backstage/plugin-catalog-node@1.3.5-next.3
|
|
23
|
+
- @backstage/plugin-permission-common@0.7.5-next.0
|
|
24
|
+
- @backstage/plugin-permission-node@0.7.7-next.2
|
|
25
|
+
- @backstage/plugin-scaffolder-common@1.2.7-next.2
|
|
26
|
+
- @backstage/plugin-search-backend-module-catalog@0.1.0-next.2
|
|
27
|
+
- @backstage/plugin-search-common@1.2.3-next.0
|
|
28
|
+
|
|
29
|
+
## 1.8.1-next.2
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- 62a725e3a94: Use the `LocationSpec` type from the `catalog-common` package in place of the deprecated `LocationSpec` from the `catalog-node` package.
|
|
34
|
+
- c36b89f2af3: Fixed bug in the `DefaultCatalogProcessingEngine` where entities that contained multiple different types of relations for the same source entity would not properly trigger stitching for that source entity.
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
- @backstage/backend-common@0.18.4-next.2
|
|
37
|
+
- @backstage/catalog-client@1.4.1-next.0
|
|
38
|
+
- @backstage/plugin-permission-node@0.7.7-next.2
|
|
39
|
+
- @backstage/backend-plugin-api@0.5.1-next.2
|
|
40
|
+
- @backstage/catalog-model@1.2.1
|
|
41
|
+
- @backstage/config@1.0.7
|
|
42
|
+
- @backstage/errors@1.1.5
|
|
43
|
+
- @backstage/integration@1.4.4-next.0
|
|
44
|
+
- @backstage/types@1.0.2
|
|
45
|
+
- @backstage/plugin-catalog-common@1.0.13-next.0
|
|
46
|
+
- @backstage/plugin-catalog-node@1.3.5-next.2
|
|
47
|
+
- @backstage/plugin-permission-common@0.7.5-next.0
|
|
48
|
+
- @backstage/plugin-scaffolder-common@1.2.7-next.1
|
|
49
|
+
- @backstage/plugin-search-backend-module-catalog@0.1.0-next.1
|
|
50
|
+
- @backstage/plugin-search-common@1.2.3-next.0
|
|
51
|
+
|
|
3
52
|
## 1.8.1-next.1
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var alpha = require('@backstage/plugin-catalog-common/alpha');
|
|
6
6
|
var pluginPermissionNode = require('@backstage/plugin-permission-node');
|
|
7
|
-
var CatalogBuilder = require('./cjs/CatalogBuilder-
|
|
7
|
+
var CatalogBuilder = require('./cjs/CatalogBuilder-c295413f.cjs.js');
|
|
8
8
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
9
9
|
var alpha$1 = require('@backstage/plugin-catalog-node/alpha');
|
|
10
10
|
var backendCommon = require('@backstage/backend-common');
|
|
@@ -15,7 +15,6 @@ require('lodash');
|
|
|
15
15
|
require('@backstage/errors');
|
|
16
16
|
require('core-js/features/promise');
|
|
17
17
|
require('codeowners-utils');
|
|
18
|
-
require('lodash/fp');
|
|
19
18
|
require('git-url-parse');
|
|
20
19
|
require('@backstage/plugin-catalog-node');
|
|
21
20
|
require('fs-extra');
|
package/dist/alpha.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.cjs.js","sources":["../src/permissions/conditionExports.ts","../src/service/CatalogPlugin.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","/*\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 */\nimport {\n createBackendPlugin,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { CatalogBuilder } from './CatalogBuilder';\nimport {\n CatalogProcessingExtensionPoint,\n catalogProcessingExtensionPoint,\n} from '@backstage/plugin-catalog-node/alpha';\nimport {\n CatalogProcessor,\n EntityProvider,\n} from '@backstage/plugin-catalog-node';\nimport { loggerToWinstonLogger } from '@backstage/backend-common';\n\nclass CatalogExtensionPointImpl implements CatalogProcessingExtensionPoint {\n #processors = new Array<CatalogProcessor>();\n #entityProviders = new Array<EntityProvider>();\n\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void {\n this.#processors.push(...processors.flat());\n }\n\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void {\n this.#entityProviders.push(...providers.flat());\n }\n\n get processors() {\n return this.#processors;\n }\n\n get entityProviders() {\n return this.#entityProviders;\n }\n}\n\n/**\n * Catalog plugin\n * @alpha\n */\nexport const catalogPlugin = createBackendPlugin({\n pluginId: 'catalog',\n register(env) {\n const processingExtensions = new CatalogExtensionPointImpl();\n // plugins depending on this API will be initialized before this plugins init method is executed.\n env.registerExtensionPoint(\n catalogProcessingExtensionPoint,\n processingExtensions,\n );\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.config,\n reader: coreServices.urlReader,\n permissions: coreServices.permissions,\n database: coreServices.database,\n httpRouter: coreServices.httpRouter,\n lifecycle: coreServices.lifecycle,\n },\n async init({\n logger,\n config,\n reader,\n database,\n permissions,\n httpRouter,\n lifecycle,\n }) {\n const winstonLogger = loggerToWinstonLogger(logger);\n const builder = await CatalogBuilder.create({\n config,\n reader,\n permissions,\n database,\n logger: winstonLogger,\n });\n builder.addProcessor(...processingExtensions.processors);\n builder.addEntityProvider(...processingExtensions.entityProviders);\n const { processingEngine, router } = await builder.build();\n\n await processingEngine.start();\n lifecycle.addShutdownHook(() => processingEngine.stop());\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["createConditionExports","RESOURCE_TYPE_CATALOG_ENTITY","permissionRules","createBackendPlugin","catalogProcessingExtensionPoint","coreServices","loggerToWinstonLogger","CatalogBuilder"],"mappings":"
|
|
1
|
+
{"version":3,"file":"alpha.cjs.js","sources":["../src/permissions/conditionExports.ts","../src/service/CatalogPlugin.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","/*\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 */\nimport {\n createBackendPlugin,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { CatalogBuilder } from './CatalogBuilder';\nimport {\n CatalogProcessingExtensionPoint,\n catalogProcessingExtensionPoint,\n} from '@backstage/plugin-catalog-node/alpha';\nimport {\n CatalogProcessor,\n EntityProvider,\n} from '@backstage/plugin-catalog-node';\nimport { loggerToWinstonLogger } from '@backstage/backend-common';\n\nclass CatalogExtensionPointImpl implements CatalogProcessingExtensionPoint {\n #processors = new Array<CatalogProcessor>();\n #entityProviders = new Array<EntityProvider>();\n\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void {\n this.#processors.push(...processors.flat());\n }\n\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void {\n this.#entityProviders.push(...providers.flat());\n }\n\n get processors() {\n return this.#processors;\n }\n\n get entityProviders() {\n return this.#entityProviders;\n }\n}\n\n/**\n * Catalog plugin\n * @alpha\n */\nexport const catalogPlugin = createBackendPlugin({\n pluginId: 'catalog',\n register(env) {\n const processingExtensions = new CatalogExtensionPointImpl();\n // plugins depending on this API will be initialized before this plugins init method is executed.\n env.registerExtensionPoint(\n catalogProcessingExtensionPoint,\n processingExtensions,\n );\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.config,\n reader: coreServices.urlReader,\n permissions: coreServices.permissions,\n database: coreServices.database,\n httpRouter: coreServices.httpRouter,\n lifecycle: coreServices.lifecycle,\n },\n async init({\n logger,\n config,\n reader,\n database,\n permissions,\n httpRouter,\n lifecycle,\n }) {\n const winstonLogger = loggerToWinstonLogger(logger);\n const builder = await CatalogBuilder.create({\n config,\n reader,\n permissions,\n database,\n logger: winstonLogger,\n });\n builder.addProcessor(...processingExtensions.processors);\n builder.addEntityProvider(...processingExtensions.entityProviders);\n const { processingEngine, router } = await builder.build();\n\n await processingEngine.start();\n lifecycle.addShutdownHook(() => processingEngine.stop());\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["createConditionExports","RESOURCE_TYPE_CATALOG_ENTITY","permissionRules","createBackendPlugin","catalogProcessingExtensionPoint","coreServices","loggerToWinstonLogger","CatalogBuilder"],"mappings":"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"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EntitiesSearchFilter } from './types/types.d-
|
|
2
|
-
export { E as EntitiesSearchFilter } from './types/types.d-
|
|
1
|
+
import { E as EntitiesSearchFilter } from './types/types.d-c2093007.js';
|
|
2
|
+
export { E as EntitiesSearchFilter } from './types/types.d-c2093007.js';
|
|
3
3
|
import * as _backstage_plugin_permission_common from '@backstage/plugin-permission-common';
|
|
4
4
|
import { PermissionRuleParams } from '@backstage/plugin-permission-common';
|
|
5
5
|
import * as _backstage_plugin_permission_node from '@backstage/plugin-permission-node';
|
|
@@ -68,7 +68,7 @@ declare const catalogConditions: _backstage_plugin_permission_node.Conditions<{
|
|
|
68
68
|
*
|
|
69
69
|
* @alpha
|
|
70
70
|
*/
|
|
71
|
-
declare const createCatalogConditionalDecision: (permission: _backstage_plugin_permission_common.ResourcePermission<"catalog-entity">, conditions: _backstage_plugin_permission_common.PermissionCriteria<_backstage_plugin_permission_common.PermissionCondition<"catalog-entity"
|
|
71
|
+
declare const createCatalogConditionalDecision: (permission: _backstage_plugin_permission_common.ResourcePermission<"catalog-entity">, conditions: _backstage_plugin_permission_common.PermissionCriteria<_backstage_plugin_permission_common.PermissionCondition<"catalog-entity">>) => _backstage_plugin_permission_common.ConditionalPolicyDecision;
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* Convenience type for {@link @backstage/plugin-permission-node#PermissionRule}
|
|
@@ -77,7 +77,7 @@ declare const createCatalogConditionalDecision: (permission: _backstage_plugin_p
|
|
|
77
77
|
*
|
|
78
78
|
* @alpha
|
|
79
79
|
*/
|
|
80
|
-
|
|
80
|
+
type CatalogPermissionRule<TParams extends PermissionRuleParams = PermissionRuleParams> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
|
|
81
81
|
/**
|
|
82
82
|
* Helper function for creating correctly-typed
|
|
83
83
|
* {@link @backstage/plugin-permission-node#PermissionRule}s for the
|
|
@@ -7,7 +7,6 @@ var lodash = require('lodash');
|
|
|
7
7
|
var errors = require('@backstage/errors');
|
|
8
8
|
require('core-js/features/promise');
|
|
9
9
|
var codeowners = require('codeowners-utils');
|
|
10
|
-
var fp = require('lodash/fp');
|
|
11
10
|
var parseGitUrl = require('git-url-parse');
|
|
12
11
|
var pluginCatalogNode = require('@backstage/plugin-catalog-node');
|
|
13
12
|
var fs = require('fs-extra');
|
|
@@ -69,16 +68,11 @@ var minimatch__default = /*#__PURE__*/_interopDefaultLegacy(minimatch);
|
|
|
69
68
|
const USER_PATTERN = /^@.*/;
|
|
70
69
|
const GROUP_PATTERN = /^@.*\/.*/;
|
|
71
70
|
const EMAIL_PATTERN = /^.*@.*\..*$/;
|
|
72
|
-
function resolveCodeOwner(contents,
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
fp.head,
|
|
78
|
-
fp.get("owners"),
|
|
79
|
-
fp.head,
|
|
80
|
-
normalizeCodeOwner
|
|
81
|
-
)(owners);
|
|
71
|
+
function resolveCodeOwner(contents, catalogInfoFileUrl) {
|
|
72
|
+
const codeOwnerEntries = codeowners__namespace.parse(contents);
|
|
73
|
+
const { filepath } = parseGitUrl__default["default"](catalogInfoFileUrl);
|
|
74
|
+
const match = codeowners__namespace.matchFile(filepath, codeOwnerEntries);
|
|
75
|
+
return match ? normalizeCodeOwner(match.owners[0]) : void 0;
|
|
82
76
|
}
|
|
83
77
|
function normalizeCodeOwner(owner) {
|
|
84
78
|
if (owner.match(GROUP_PATTERN)) {
|
|
@@ -133,7 +127,7 @@ async function findCodeOwnerByTarget(reader, targetUrl, scmIntegration) {
|
|
|
133
127
|
if (!contents) {
|
|
134
128
|
return void 0;
|
|
135
129
|
}
|
|
136
|
-
const owner = resolveCodeOwner(contents);
|
|
130
|
+
const owner = resolveCodeOwner(contents, targetUrl);
|
|
137
131
|
return owner;
|
|
138
132
|
}
|
|
139
133
|
|
|
@@ -1589,26 +1583,30 @@ class DefaultCatalogProcessingEngine {
|
|
|
1589
1583
|
locationKey,
|
|
1590
1584
|
refreshKeys: result.refreshKeys
|
|
1591
1585
|
});
|
|
1592
|
-
oldRelationSources = new
|
|
1593
|
-
previous.relations.map((r) =>
|
|
1586
|
+
oldRelationSources = new Map(
|
|
1587
|
+
previous.relations.map((r) => [
|
|
1588
|
+
`${r.source_entity_ref}:${r.type}`,
|
|
1589
|
+
r.source_entity_ref
|
|
1590
|
+
])
|
|
1594
1591
|
);
|
|
1595
1592
|
});
|
|
1596
|
-
const newRelationSources = new
|
|
1597
|
-
result.relations.map(
|
|
1598
|
-
|
|
1599
|
-
|
|
1593
|
+
const newRelationSources = new Map(
|
|
1594
|
+
result.relations.map((relation) => {
|
|
1595
|
+
const sourceEntityRef = catalogModel.stringifyEntityRef(relation.source);
|
|
1596
|
+
return [`${sourceEntityRef}:${relation.type}`, sourceEntityRef];
|
|
1597
|
+
})
|
|
1600
1598
|
);
|
|
1601
1599
|
const setOfThingsToStitch = /* @__PURE__ */ new Set([
|
|
1602
1600
|
catalogModel.stringifyEntityRef(result.completedEntity)
|
|
1603
1601
|
]);
|
|
1604
|
-
newRelationSources.forEach((
|
|
1605
|
-
if (!oldRelationSources.has(
|
|
1606
|
-
setOfThingsToStitch.add(
|
|
1602
|
+
newRelationSources.forEach((sourceEntityRef, uniqueKey) => {
|
|
1603
|
+
if (!oldRelationSources.has(uniqueKey)) {
|
|
1604
|
+
setOfThingsToStitch.add(sourceEntityRef);
|
|
1607
1605
|
}
|
|
1608
1606
|
});
|
|
1609
|
-
oldRelationSources.forEach((
|
|
1610
|
-
if (!newRelationSources.has(
|
|
1611
|
-
setOfThingsToStitch.add(
|
|
1607
|
+
oldRelationSources.forEach((sourceEntityRef, uniqueKey) => {
|
|
1608
|
+
if (!newRelationSources.has(uniqueKey)) {
|
|
1609
|
+
setOfThingsToStitch.add(sourceEntityRef);
|
|
1612
1610
|
}
|
|
1613
1611
|
});
|
|
1614
1612
|
await this.stitcher.stitch(setOfThingsToStitch);
|
|
@@ -4962,4 +4960,4 @@ exports.createCatalogPermissionRule = createCatalogPermissionRule;
|
|
|
4962
4960
|
exports.createRandomProcessingInterval = createRandomProcessingInterval;
|
|
4963
4961
|
exports.parseEntityYaml = parseEntityYaml;
|
|
4964
4962
|
exports.permissionRules = permissionRules;
|
|
4965
|
-
//# sourceMappingURL=CatalogBuilder-
|
|
4963
|
+
//# sourceMappingURL=CatalogBuilder-c295413f.cjs.js.map
|