@backstage/plugin-catalog-backend 3.2.1-next.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/actions/createRegisterCatalogEntitiesAction.cjs.js +64 -0
- package/dist/actions/createRegisterCatalogEntitiesAction.cjs.js.map +1 -0
- package/dist/actions/createUnregisterCatalogEntitiesAction.cjs.js +73 -0
- package/dist/actions/createUnregisterCatalogEntitiesAction.cjs.js.map +1 -0
- package/dist/actions/index.cjs.js +4 -0
- package/dist/actions/index.cjs.js.map +1 -1
- package/dist/alpha.d.ts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/service/DefaultRefreshService.cjs.js +4 -8
- package/dist/service/DefaultRefreshService.cjs.js.map +1 -1
- package/package.json +20 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend
|
|
2
2
|
|
|
3
|
+
## 3.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dce1824: Added `ActionsRegistry` actions for `register-entity` and `unregister-entity`
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- de96a60: chore(deps): bump `express` from 4.21.2 to 4.22.0
|
|
12
|
+
- 8101ec1: Fixed default refresh service to go through the whole ancestry of the entity.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @backstage/integration@1.19.0
|
|
15
|
+
- @backstage/backend-openapi-utils@0.6.4
|
|
16
|
+
- @backstage/plugin-events-node@0.4.18
|
|
17
|
+
- @backstage/plugin-permission-node@0.10.7
|
|
18
|
+
- @backstage/backend-plugin-api@1.6.0
|
|
19
|
+
- @backstage/plugin-catalog-node@1.20.1
|
|
20
|
+
|
|
21
|
+
## 3.2.1-next.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- de96a60: chore(deps): bump `express` from 4.21.2 to 4.22.0
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
- @backstage/backend-openapi-utils@0.6.4-next.1
|
|
28
|
+
- @backstage/plugin-events-node@0.4.18-next.1
|
|
29
|
+
- @backstage/plugin-permission-node@0.10.7-next.1
|
|
30
|
+
- @backstage/integration@1.18.3-next.1
|
|
31
|
+
- @backstage/backend-plugin-api@1.6.0-next.1
|
|
32
|
+
- @backstage/catalog-client@1.12.1
|
|
33
|
+
- @backstage/catalog-model@1.7.6
|
|
34
|
+
- @backstage/config@1.3.6
|
|
35
|
+
- @backstage/errors@1.2.7
|
|
36
|
+
- @backstage/types@1.2.2
|
|
37
|
+
- @backstage/plugin-catalog-common@1.1.7
|
|
38
|
+
- @backstage/plugin-catalog-node@1.20.1-next.1
|
|
39
|
+
- @backstage/plugin-permission-common@0.9.3
|
|
40
|
+
|
|
3
41
|
## 3.2.1-next.0
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var errors = require('@backstage/errors');
|
|
4
|
+
|
|
5
|
+
const isValidUrl = (url) => {
|
|
6
|
+
try {
|
|
7
|
+
new URL(url);
|
|
8
|
+
return true;
|
|
9
|
+
} catch (error) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const createRegisterCatalogEntitiesAction = ({
|
|
14
|
+
catalog,
|
|
15
|
+
actionsRegistry
|
|
16
|
+
}) => {
|
|
17
|
+
actionsRegistry.register({
|
|
18
|
+
name: "register-entity",
|
|
19
|
+
title: "Register entity in the Catalog",
|
|
20
|
+
attributes: {
|
|
21
|
+
destructive: false,
|
|
22
|
+
readOnly: false,
|
|
23
|
+
idempotent: false
|
|
24
|
+
},
|
|
25
|
+
description: `Registers one or more entities in the Backstage catalog by creating a Location entity that points to a remote catalog-info.yaml file.
|
|
26
|
+
|
|
27
|
+
This action is similar to the "Register existing component" flow in the Backstage UI, where you provide a URL to a catalog-info.yaml file describing catalog entities such as Components, Systems, Resources, APIs, Users, and Groups. The action will create a new Location entity that references the provided file; all entities defined within that file will be imported into the catalog.
|
|
28
|
+
|
|
29
|
+
A unique identifier (locationId) will be returned for the newly created Location. You can use this identifier in the future to unregister or delete the Location and all entities it owns.
|
|
30
|
+
`,
|
|
31
|
+
schema: {
|
|
32
|
+
input: (z) => z.object({
|
|
33
|
+
locationUrl: z.string().describe(
|
|
34
|
+
`URL reference to the catalog-info.yaml file that describes the entity to register. For example: https://github.com/backstage/demo/blob/master/catalog-info.yaml`
|
|
35
|
+
)
|
|
36
|
+
}),
|
|
37
|
+
output: (z) => z.object({
|
|
38
|
+
locationId: z.string().describe("The ID of the entity that was registered")
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
action: async ({ input, credentials }) => {
|
|
42
|
+
if (!isValidUrl(input.locationUrl)) {
|
|
43
|
+
throw new errors.InputError(`${input.locationUrl} is an invalid URL`);
|
|
44
|
+
}
|
|
45
|
+
const result = await catalog.addLocation(
|
|
46
|
+
{
|
|
47
|
+
type: "url",
|
|
48
|
+
target: input.locationUrl
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
credentials
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
return {
|
|
55
|
+
output: {
|
|
56
|
+
locationId: result.location.id
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.createRegisterCatalogEntitiesAction = createRegisterCatalogEntitiesAction;
|
|
64
|
+
//# sourceMappingURL=createRegisterCatalogEntitiesAction.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRegisterCatalogEntitiesAction.cjs.js","sources":["../../src/actions/createRegisterCatalogEntitiesAction.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { ActionsRegistryService } from '@backstage/backend-plugin-api/alpha';\nimport { InputError } from '@backstage/errors';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\n\nconst isValidUrl = (url: string) => {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n } catch (error) {\n return false;\n }\n};\n\nexport const createRegisterCatalogEntitiesAction = ({\n catalog,\n actionsRegistry,\n}: {\n catalog: CatalogService;\n actionsRegistry: ActionsRegistryService;\n}) => {\n actionsRegistry.register({\n name: 'register-entity',\n title: 'Register entity in the Catalog',\n attributes: {\n destructive: false,\n readOnly: false,\n idempotent: false,\n },\n description: `Registers one or more entities in the Backstage catalog by creating a Location entity that points to a remote catalog-info.yaml file.\n\nThis action is similar to the \"Register existing component\" flow in the Backstage UI, where you provide a URL to a catalog-info.yaml file describing catalog entities such as Components, Systems, Resources, APIs, Users, and Groups. The action will create a new Location entity that references the provided file; all entities defined within that file will be imported into the catalog.\n\nA unique identifier (locationId) will be returned for the newly created Location. You can use this identifier in the future to unregister or delete the Location and all entities it owns.\n`,\n schema: {\n input: z =>\n z.object({\n locationUrl: z\n .string()\n .describe(\n `URL reference to the catalog-info.yaml file that describes the entity to register. For example: https://github.com/backstage/demo/blob/master/catalog-info.yaml`,\n ),\n }),\n output: z =>\n z.object({\n locationId: z\n .string()\n .describe('The ID of the entity that was registered'),\n }),\n },\n action: async ({ input, credentials }) => {\n if (!isValidUrl(input.locationUrl)) {\n throw new InputError(`${input.locationUrl} is an invalid URL`);\n }\n\n const result = await catalog.addLocation(\n {\n type: 'url',\n target: input.locationUrl,\n },\n {\n credentials,\n },\n );\n\n return {\n output: {\n locationId: result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;AAAA,UACE,IAAA,EAAM,KAAA;AAAA,UACN,QAAQ,KAAA,CAAM;AAAA,SAChB;AAAA,QACA;AAAA,UACE;AAAA;AACF,OACF;AAEA,MAAA,OAAO;AAAA,QACL,MAAA,EAAQ;AAAA,UACN,UAAA,EAAY,OAAO,QAAA,CAAS;AAAA;AAC9B,OACF;AAAA,IACF;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var errors = require('@backstage/errors');
|
|
4
|
+
|
|
5
|
+
const createUnregisterCatalogEntitiesAction = ({
|
|
6
|
+
catalog,
|
|
7
|
+
actionsRegistry
|
|
8
|
+
}) => {
|
|
9
|
+
actionsRegistry.register({
|
|
10
|
+
name: "unregister-entity",
|
|
11
|
+
title: "Unregister entity from the Catalog",
|
|
12
|
+
attributes: {
|
|
13
|
+
destructive: true,
|
|
14
|
+
readOnly: false,
|
|
15
|
+
idempotent: true
|
|
16
|
+
},
|
|
17
|
+
description: `Unregisters a Location entity and all entities it owns from the Backstage catalog.
|
|
18
|
+
|
|
19
|
+
This action is similar to the "Unregister location" function in the Backstage UI, where you provide the unique identifier (locationId) of a Location entity. Alternatively, you can provide the URL used to register the location. The action will remove the specified Location from the catalog as well as all entities that were created when the Location was imported.
|
|
20
|
+
|
|
21
|
+
Once completed, all entities associated with the Location will be deleted from the catalog.
|
|
22
|
+
`,
|
|
23
|
+
schema: {
|
|
24
|
+
input: (z) => z.object({
|
|
25
|
+
type: z.union([
|
|
26
|
+
z.object({
|
|
27
|
+
locationId: z.string().describe(`Location ID of the Entity to unregister`)
|
|
28
|
+
}),
|
|
29
|
+
z.object({
|
|
30
|
+
locationUrl: z.string().describe(
|
|
31
|
+
`URL of the catalog-info.yaml file to unregister for example: https://github.com/backstage/demo/blob/master/catalog-info.yaml`
|
|
32
|
+
)
|
|
33
|
+
})
|
|
34
|
+
])
|
|
35
|
+
}).describe(
|
|
36
|
+
"The type to the unregister-entity action. Either locationId or locationUrl must be provided."
|
|
37
|
+
),
|
|
38
|
+
output: (z) => z.object({})
|
|
39
|
+
},
|
|
40
|
+
action: async ({ input: { type }, credentials }) => {
|
|
41
|
+
if ("locationId" in type) {
|
|
42
|
+
await catalog.removeLocationById(type.locationId, {
|
|
43
|
+
credentials
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
const locations = await catalog.getLocations(
|
|
47
|
+
{},
|
|
48
|
+
{
|
|
49
|
+
credentials
|
|
50
|
+
}
|
|
51
|
+
).then(
|
|
52
|
+
(response) => response.items.filter(
|
|
53
|
+
(location) => location.target.toLowerCase() === type.locationUrl.toLowerCase()
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
if (locations.length === 0) {
|
|
57
|
+
throw new errors.NotFoundError(
|
|
58
|
+
`Location with URL ${type.locationUrl} not found`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
for (const location of locations) {
|
|
62
|
+
await catalog.removeLocationById(location.id, {
|
|
63
|
+
credentials
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { output: {} };
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
exports.createUnregisterCatalogEntitiesAction = createUnregisterCatalogEntitiesAction;
|
|
73
|
+
//# sourceMappingURL=createUnregisterCatalogEntitiesAction.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createUnregisterCatalogEntitiesAction.cjs.js","sources":["../../src/actions/createUnregisterCatalogEntitiesAction.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { ActionsRegistryService } from '@backstage/backend-plugin-api/alpha';\nimport { NotFoundError } from '@backstage/errors';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\n\nexport const createUnregisterCatalogEntitiesAction = ({\n catalog,\n actionsRegistry,\n}: {\n catalog: CatalogService;\n actionsRegistry: ActionsRegistryService;\n}) => {\n actionsRegistry.register({\n name: 'unregister-entity',\n title: 'Unregister entity from the Catalog',\n attributes: {\n destructive: true,\n readOnly: false,\n idempotent: true,\n },\n description: `Unregisters a Location entity and all entities it owns from the Backstage catalog.\n\nThis action is similar to the \"Unregister location\" function in the Backstage UI, where you provide the unique identifier (locationId) of a Location entity. Alternatively, you can provide the URL used to register the location. The action will remove the specified Location from the catalog as well as all entities that were created when the Location was imported.\n\nOnce completed, all entities associated with the Location will be deleted from the catalog.\n`,\n schema: {\n input: z =>\n z\n .object({\n type: z.union([\n z.object({\n locationId: z\n .string()\n .describe(`Location ID of the Entity to unregister`),\n }),\n z.object({\n locationUrl: z\n .string()\n .describe(\n `URL of the catalog-info.yaml file to unregister for example: https://github.com/backstage/demo/blob/master/catalog-info.yaml`,\n ),\n }),\n ]),\n })\n .describe(\n 'The type to the unregister-entity action. Either locationId or locationUrl must be provided.',\n ),\n output: z => z.object({}),\n },\n action: async ({ input: { type }, credentials }) => {\n if ('locationId' in type) {\n await catalog.removeLocationById(type.locationId, {\n credentials,\n });\n } else {\n const locations = await catalog\n .getLocations(\n {},\n {\n credentials,\n },\n )\n .then(response =>\n response.items.filter(\n location =>\n location.target.toLowerCase() ===\n type.locationUrl.toLowerCase(),\n ),\n );\n\n if (locations.length === 0) {\n throw new NotFoundError(\n `Location with URL ${type.locationUrl} not found`,\n );\n }\n\n for (const location of locations) {\n await catalog.removeLocationById(location.id, {\n credentials,\n });\n }\n }\n\n return { output: {} };\n },\n });\n};\n"],"names":["NotFoundError"],"mappings":";;;;AAmBO,MAAM,wCA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AAA,KACJ,SAAS,KAAA,CAAM,MAAA;AAAA,YACb,cACE,QAAA,CAAS,MAAA,CAAO,aAAY,KAC5B,IAAA,CAAK,YAAY,WAAA;AAAY;AACjC,SACF;AAEF,QAAA,IAAI,SAAA,CAAU,WAAW,CAAA,EAAG;AAC1B,UAAA,MAAM,IAAIA,oBAAA;AAAA,YACR,CAAA,kBAAA,EAAqB,KAAK,WAAW,CAAA,UAAA;AAAA,WACvC;AAAA,QACF;AAEA,QAAA,KAAA,MAAW,YAAY,SAAA,EAAW;AAChC,UAAA,MAAM,OAAA,CAAQ,kBAAA,CAAmB,QAAA,CAAS,EAAA,EAAI;AAAA,YAC5C;AAAA,WACD,CAAA;AAAA,QACH;AAAA,MACF;AAEA,MAAA,OAAO,EAAE,MAAA,EAAQ,EAAC,EAAE;AAAA,IACtB;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var createGetCatalogEntityAction = require('./createGetCatalogEntityAction.cjs.js');
|
|
4
4
|
var createValidateEntityAction = require('./createValidateEntityAction.cjs.js');
|
|
5
|
+
var createRegisterCatalogEntitiesAction = require('./createRegisterCatalogEntitiesAction.cjs.js');
|
|
6
|
+
var createUnregisterCatalogEntitiesAction = require('./createUnregisterCatalogEntitiesAction.cjs.js');
|
|
5
7
|
|
|
6
8
|
const createCatalogActions = (options) => {
|
|
7
9
|
createGetCatalogEntityAction.createGetCatalogEntityAction(options);
|
|
8
10
|
createValidateEntityAction.createValidateEntityAction(options);
|
|
11
|
+
createRegisterCatalogEntitiesAction.createRegisterCatalogEntitiesAction(options);
|
|
12
|
+
createUnregisterCatalogEntitiesAction.createUnregisterCatalogEntitiesAction(options);
|
|
9
13
|
};
|
|
10
14
|
|
|
11
15
|
exports.createCatalogActions = createCatalogActions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../src/actions/index.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { ActionsRegistryService } from '@backstage/backend-plugin-api/alpha';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\nimport { createGetCatalogEntityAction } from './createGetCatalogEntityAction.ts';\nimport { createValidateEntityAction } from './createValidateEntityAction.ts';\n\nexport const createCatalogActions = (options: {\n actionsRegistry: ActionsRegistryService;\n catalog: CatalogService;\n}) => {\n createGetCatalogEntityAction(options);\n createValidateEntityAction(options);\n};\n"],"names":["createGetCatalogEntityAction","createValidateEntityAction"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/actions/index.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { ActionsRegistryService } from '@backstage/backend-plugin-api/alpha';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\nimport { createGetCatalogEntityAction } from './createGetCatalogEntityAction.ts';\nimport { createValidateEntityAction } from './createValidateEntityAction.ts';\nimport { createRegisterCatalogEntitiesAction } from './createRegisterCatalogEntitiesAction.ts';\nimport { createUnregisterCatalogEntitiesAction } from './createUnregisterCatalogEntitiesAction.ts';\n\nexport const createCatalogActions = (options: {\n actionsRegistry: ActionsRegistryService;\n catalog: CatalogService;\n}) => {\n createGetCatalogEntityAction(options);\n createValidateEntityAction(options);\n createRegisterCatalogEntitiesAction(options);\n createUnregisterCatalogEntitiesAction(options);\n};\n"],"names":["createGetCatalogEntityAction","createValidateEntityAction","createRegisterCatalogEntitiesAction","createUnregisterCatalogEntitiesAction"],"mappings":";;;;;;;AAsBO,MAAM,oBAAA,GAAuB,CAAC,OAAA,KAG/B;AACJ,EAAAA,yDAAA,CAA6B,OAAO,CAAA;AACpC,EAAAC,qDAAA,CAA2B,OAAO,CAAA;AAClC,EAAAC,uEAAA,CAAoC,OAAO,CAAA;AAC3C,EAAAC,2EAAA,CAAsC,OAAO,CAAA;AAC/C;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -118,4 +118,5 @@ declare const permissionRules: {
|
|
|
118
118
|
}>;
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
export {
|
|
121
|
+
export { catalogConditions, createCatalogConditionalDecision, createCatalogPermissionRule, permissionRules };
|
|
122
|
+
export type { CatalogPermissionRule };
|
package/dist/index.d.ts
CHANGED
|
@@ -113,4 +113,5 @@ declare const CATALOG_CONFLICTS_TOPIC = "experimental.catalog.conflict";
|
|
|
113
113
|
/** @public */
|
|
114
114
|
declare const CATALOG_ERRORS_TOPIC = "experimental.catalog.errors";
|
|
115
115
|
|
|
116
|
-
export { AnnotateLocationEntityProcessor, AnnotateScmSlugEntityProcessor, BuiltinKindsEntityProcessor, CATALOG_CONFLICTS_TOPIC, CATALOG_ERRORS_TOPIC, CodeOwnersProcessor, FileReaderProcessor, PlaceholderProcessor,
|
|
116
|
+
export { AnnotateLocationEntityProcessor, AnnotateScmSlugEntityProcessor, BuiltinKindsEntityProcessor, CATALOG_CONFLICTS_TOPIC, CATALOG_ERRORS_TOPIC, CodeOwnersProcessor, FileReaderProcessor, PlaceholderProcessor, UrlReaderProcessor, catalogPlugin as default, transformLegacyPolicyToProcessor };
|
|
117
|
+
export type { PlaceholderProcessorOptions };
|
|
@@ -10,17 +10,13 @@ class DefaultRefreshService {
|
|
|
10
10
|
const { entityRefs } = await this.database.listAncestors(tx, {
|
|
11
11
|
entityRef: options.entityRef
|
|
12
12
|
});
|
|
13
|
-
const
|
|
13
|
+
const locationAncestors = entityRefs.filter(
|
|
14
14
|
(ref) => ref.startsWith("location:")
|
|
15
15
|
);
|
|
16
|
-
|
|
17
|
-
await this.database.refresh(tx, {
|
|
18
|
-
entityRef: locationAncestor
|
|
19
|
-
});
|
|
16
|
+
for (const locationAncestor of locationAncestors) {
|
|
17
|
+
await this.database.refresh(tx, { entityRef: locationAncestor });
|
|
20
18
|
}
|
|
21
|
-
await this.database.refresh(tx, {
|
|
22
|
-
entityRef: options.entityRef
|
|
23
|
-
});
|
|
19
|
+
await this.database.refresh(tx, { entityRef: options.entityRef });
|
|
24
20
|
});
|
|
25
21
|
}
|
|
26
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultRefreshService.cjs.js","sources":["../../src/service/DefaultRefreshService.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 { DefaultCatalogDatabase } from '../database/DefaultCatalogDatabase';\nimport { RefreshOptions, RefreshService } from './types';\n\nexport class DefaultRefreshService implements RefreshService {\n private database: DefaultCatalogDatabase;\n\n constructor(options: { database: DefaultCatalogDatabase }) {\n this.database = options.database;\n }\n\n async refresh(options: RefreshOptions) {\n await this.database.transaction(async tx => {\n const { entityRefs } = await this.database.listAncestors(tx, {\n entityRef: options.entityRef,\n });\n const
|
|
1
|
+
{"version":3,"file":"DefaultRefreshService.cjs.js","sources":["../../src/service/DefaultRefreshService.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 { DefaultCatalogDatabase } from '../database/DefaultCatalogDatabase';\nimport { RefreshOptions, RefreshService } from './types';\n\nexport class DefaultRefreshService implements RefreshService {\n private database: DefaultCatalogDatabase;\n\n constructor(options: { database: DefaultCatalogDatabase }) {\n this.database = options.database;\n }\n\n async refresh(options: RefreshOptions) {\n await this.database.transaction(async tx => {\n const { entityRefs } = await this.database.listAncestors(tx, {\n entityRef: options.entityRef,\n });\n\n const locationAncestors = entityRefs.filter(ref =>\n ref.startsWith('location:'),\n );\n\n // TODO: Refreshes are currently scheduled(as soon as possible) for execution and will therefore happen in the future.\n // There's room for improvements here where the refresh could potentially hang or return an ID so that the user can check progress.\n for (const locationAncestor of locationAncestors) {\n await this.database.refresh(tx, { entityRef: locationAncestor });\n }\n await this.database.refresh(tx, { entityRef: options.entityRef });\n });\n }\n}\n"],"names":[],"mappings":";;AAmBO,MAAM,qBAAA,CAAgD;AAAA,EACnD,QAAA;AAAA,EAER,YAAY,OAAA,EAA+C;AACzD,IAAA,IAAA,CAAK,WAAW,OAAA,CAAQ,QAAA;AAAA,EAC1B;AAAA,EAEA,MAAM,QAAQ,OAAA,EAAyB;AACrC,IAAA,MAAM,IAAA,CAAK,QAAA,CAAS,WAAA,CAAY,OAAM,EAAA,KAAM;AAC1C,MAAA,MAAM,EAAE,UAAA,EAAW,GAAI,MAAM,IAAA,CAAK,QAAA,CAAS,cAAc,EAAA,EAAI;AAAA,QAC3D,WAAW,OAAA,CAAQ;AAAA,OACpB,CAAA;AAED,MAAA,MAAM,oBAAoB,UAAA,CAAW,MAAA;AAAA,QAAO,CAAA,GAAA,KAC1C,GAAA,CAAI,UAAA,CAAW,WAAW;AAAA,OAC5B;AAIA,MAAA,KAAA,MAAW,oBAAoB,iBAAA,EAAmB;AAChD,QAAA,MAAM,KAAK,QAAA,CAAS,OAAA,CAAQ,IAAI,EAAE,SAAA,EAAW,kBAAkB,CAAA;AAAA,MACjE;AACA,MAAA,MAAM,IAAA,CAAK,SAAS,OAAA,CAAQ,EAAA,EAAI,EAAE,SAAA,EAAW,OAAA,CAAQ,WAAW,CAAA;AAAA,IAClE,CAAC,CAAA;AAAA,EACH;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-backend",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "The Backstage backend plugin that provides the Backstage catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin",
|
|
@@ -73,23 +73,23 @@
|
|
|
73
73
|
"test": "backstage-cli package test"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@backstage/backend-openapi-utils": "0.6.4
|
|
77
|
-
"@backstage/backend-plugin-api": "1.
|
|
78
|
-
"@backstage/catalog-client": "1.12.1",
|
|
79
|
-
"@backstage/catalog-model": "1.7.6",
|
|
80
|
-
"@backstage/config": "1.3.6",
|
|
81
|
-
"@backstage/errors": "1.2.7",
|
|
82
|
-
"@backstage/integration": "1.
|
|
83
|
-
"@backstage/plugin-catalog-common": "1.1.7",
|
|
84
|
-
"@backstage/plugin-catalog-node": "1.20.1
|
|
85
|
-
"@backstage/plugin-events-node": "0.4.18
|
|
86
|
-
"@backstage/plugin-permission-common": "0.9.3",
|
|
87
|
-
"@backstage/plugin-permission-node": "0.10.7
|
|
88
|
-
"@backstage/types": "1.2.2",
|
|
76
|
+
"@backstage/backend-openapi-utils": "^0.6.4",
|
|
77
|
+
"@backstage/backend-plugin-api": "^1.6.0",
|
|
78
|
+
"@backstage/catalog-client": "^1.12.1",
|
|
79
|
+
"@backstage/catalog-model": "^1.7.6",
|
|
80
|
+
"@backstage/config": "^1.3.6",
|
|
81
|
+
"@backstage/errors": "^1.2.7",
|
|
82
|
+
"@backstage/integration": "^1.19.0",
|
|
83
|
+
"@backstage/plugin-catalog-common": "^1.1.7",
|
|
84
|
+
"@backstage/plugin-catalog-node": "^1.20.1",
|
|
85
|
+
"@backstage/plugin-events-node": "^0.4.18",
|
|
86
|
+
"@backstage/plugin-permission-common": "^0.9.3",
|
|
87
|
+
"@backstage/plugin-permission-node": "^0.10.7",
|
|
88
|
+
"@backstage/types": "^1.2.2",
|
|
89
89
|
"@opentelemetry/api": "^1.9.0",
|
|
90
90
|
"codeowners-utils": "^1.0.2",
|
|
91
91
|
"core-js": "^3.6.5",
|
|
92
|
-
"express": "^4.
|
|
92
|
+
"express": "^4.22.0",
|
|
93
93
|
"fast-json-stable-stringify": "^2.1.0",
|
|
94
94
|
"fs-extra": "^11.2.0",
|
|
95
95
|
"git-url-parse": "^15.0.0",
|
|
@@ -106,11 +106,11 @@
|
|
|
106
106
|
"zod": "^3.22.4"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@backstage/backend-defaults": "0.14.0
|
|
110
|
-
"@backstage/backend-test-utils": "1.10.
|
|
111
|
-
"@backstage/cli": "0.
|
|
112
|
-
"@backstage/plugin-permission-common": "0.9.3",
|
|
113
|
-
"@backstage/repo-tools": "0.16.1
|
|
109
|
+
"@backstage/backend-defaults": "^0.14.0",
|
|
110
|
+
"@backstage/backend-test-utils": "^1.10.2",
|
|
111
|
+
"@backstage/cli": "^0.35.0",
|
|
112
|
+
"@backstage/plugin-permission-common": "^0.9.3",
|
|
113
|
+
"@backstage/repo-tools": "^0.16.1",
|
|
114
114
|
"@types/core-js": "^2.5.4",
|
|
115
115
|
"@types/express": "^4.17.6",
|
|
116
116
|
"@types/git-url-parse": "^9.0.0",
|