@backstage/plugin-catalog-backend-module-logs 0.0.0-nightly-20240625021714
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 +15 -0
- package/README.md +8 -0
- package/dist/index.cjs.js +39 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/package.json +45 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @backstage/plugin-catalog-backend-module-logs
|
|
2
|
+
|
|
3
|
+
## 0.0.0-nightly-20240625021714
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 97caf55: Creates a new module to make logging catalog errors simple. This module subscribes to catalog events and logs them.
|
|
8
|
+
|
|
9
|
+
See [Backstage documentation](https://backstage.io/docs/features/software-catalog/configuration#subscribing-to-catalog-errors) for details on how to install
|
|
10
|
+
and configure the plugin.
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- @backstage/backend-plugin-api@0.0.0-nightly-20240625021714
|
|
14
|
+
- @backstage/plugin-catalog-backend@0.0.0-nightly-20240625021714
|
|
15
|
+
- @backstage/plugin-events-node@0.0.0-nightly-20240625021714
|
package/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# backstage-plugin-catalog-backend-module-logs
|
|
2
|
+
|
|
3
|
+
A module that subscribes to catalog related events and logs them.
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
See [Backstage documentation](https://backstage.io/docs/features/software-catalog/configuration#subscribing-to-catalog-errors) for details on how to install
|
|
8
|
+
and configure the plugin.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
6
|
+
var pluginCatalogBackend = require('@backstage/plugin-catalog-backend');
|
|
7
|
+
var pluginEventsNode = require('@backstage/plugin-events-node');
|
|
8
|
+
|
|
9
|
+
const catalogModuleLogs = backendPluginApi.createBackendModule({
|
|
10
|
+
pluginId: "catalog",
|
|
11
|
+
moduleId: "logs",
|
|
12
|
+
register(env) {
|
|
13
|
+
env.registerInit({
|
|
14
|
+
deps: {
|
|
15
|
+
events: pluginEventsNode.eventsServiceRef,
|
|
16
|
+
logger: backendPluginApi.coreServices.logger
|
|
17
|
+
},
|
|
18
|
+
async init({ events, logger }) {
|
|
19
|
+
events.subscribe({
|
|
20
|
+
id: "catalog",
|
|
21
|
+
topics: [pluginCatalogBackend.CATALOG_ERRORS_TOPIC],
|
|
22
|
+
async onEvent(params) {
|
|
23
|
+
const event = params;
|
|
24
|
+
const { entity, location, errors } = event.eventPayload;
|
|
25
|
+
for (const error of errors) {
|
|
26
|
+
logger.warn(error.message, {
|
|
27
|
+
entity,
|
|
28
|
+
location
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
exports.default = catalogModuleLogs;
|
|
39
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 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 coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { CATALOG_ERRORS_TOPIC } from '@backstage/plugin-catalog-backend';\nimport { eventsServiceRef, EventParams } from '@backstage/plugin-events-node';\n\ninterface EventsPayload {\n entity: string;\n location?: string;\n errors: Error[];\n}\n\ninterface EventsParamsWithPayload extends EventParams {\n eventPayload: EventsPayload;\n}\n\n/**\n * A catalog module that logs catalog errors using the logger service.\n *\n * @packageDocumentation\n * @public\n */\nexport const catalogModuleLogs = createBackendModule({\n pluginId: 'catalog',\n moduleId: 'logs',\n register(env) {\n env.registerInit({\n deps: {\n events: eventsServiceRef,\n logger: coreServices.logger,\n },\n async init({ events, logger }) {\n events.subscribe({\n id: 'catalog',\n topics: [CATALOG_ERRORS_TOPIC],\n async onEvent(params: EventParams): Promise<void> {\n const event = params as EventsParamsWithPayload;\n const { entity, location, errors } = event.eventPayload;\n for (const error of errors) {\n logger.warn(error.message, {\n entity,\n location,\n });\n }\n },\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","eventsServiceRef","coreServices","CATALOG_ERRORS_TOPIC"],"mappings":";;;;;;;;AAuCO,MAAM,oBAAoBA,oCAAoB,CAAA;AAAA,EACnD,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,MAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,MAAQ,EAAAC,iCAAA;AAAA,QACR,QAAQC,6BAAa,CAAA,MAAA;AAAA,OACvB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,MAAA,EAAQ,QAAU,EAAA;AAC7B,QAAA,MAAA,CAAO,SAAU,CAAA;AAAA,UACf,EAAI,EAAA,SAAA;AAAA,UACJ,MAAA,EAAQ,CAACC,yCAAoB,CAAA;AAAA,UAC7B,MAAM,QAAQ,MAAoC,EAAA;AAChD,YAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AACd,YAAA,MAAM,EAAE,MAAA,EAAQ,QAAU,EAAA,MAAA,KAAW,KAAM,CAAA,YAAA,CAAA;AAC3C,YAAA,KAAA,MAAW,SAAS,MAAQ,EAAA;AAC1B,cAAO,MAAA,CAAA,IAAA,CAAK,MAAM,OAAS,EAAA;AAAA,gBACzB,MAAA;AAAA,gBACA,QAAA;AAAA,eACD,CAAA,CAAA;AAAA,aACH;AAAA,WACF;AAAA,SACD,CAAA,CAAA;AAAA,OACH;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A catalog module that logs catalog errors using the logger service.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
declare const catalogModuleLogs: _backstage_backend_plugin_api.BackendFeatureCompat;
|
|
10
|
+
|
|
11
|
+
export { catalogModuleLogs as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backstage/plugin-catalog-backend-module-logs",
|
|
3
|
+
"version": "0.0.0-nightly-20240625021714",
|
|
4
|
+
"description": "A module that subscribes to catalog releated events and logs them.",
|
|
5
|
+
"backstage": {
|
|
6
|
+
"role": "backend-plugin-module",
|
|
7
|
+
"pluginId": "catalog",
|
|
8
|
+
"pluginPackage": "@backstage/plugin-catalog-backend"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public",
|
|
12
|
+
"main": "dist/index.cjs.js",
|
|
13
|
+
"types": "dist/index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/backstage/backstage",
|
|
18
|
+
"directory": "plugins/catalog-backend-module-logs"
|
|
19
|
+
},
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"main": "dist/index.cjs.js",
|
|
22
|
+
"types": "dist/index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "backstage-cli package build",
|
|
28
|
+
"clean": "backstage-cli package clean",
|
|
29
|
+
"lint": "backstage-cli package lint",
|
|
30
|
+
"prepack": "backstage-cli package prepack",
|
|
31
|
+
"postpack": "backstage-cli package postpack",
|
|
32
|
+
"start": "backstage-cli package start",
|
|
33
|
+
"test": "backstage-cli package test"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@backstage/backend-plugin-api": "^0.0.0-nightly-20240625021714",
|
|
37
|
+
"@backstage/plugin-catalog-backend": "^0.0.0-nightly-20240625021714",
|
|
38
|
+
"@backstage/plugin-events-node": "^0.0.0-nightly-20240625021714"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@backstage/backend-test-utils": "^0.0.0-nightly-20240625021714",
|
|
42
|
+
"@backstage/cli": "^0.0.0-nightly-20240625021714",
|
|
43
|
+
"@backstage/plugin-events-backend-test-utils": "^0.0.0-nightly-20240625021714"
|
|
44
|
+
}
|
|
45
|
+
}
|