rollbar - Removed usages and references of `@backstage/backend-common` (#1956)
* rollbar - Removed usages and references of `@backstage/backend-common` Signed-off-by: Andre Wanlin <awanlin@spotify.com> * Added error middleware Signed-off-by: Andre Wanlin <awanlin@spotify.com> * Added deprecation Signed-off-by: Andre Wanlin <awanlin@spotify.com> * Updated changeset and reports Signed-off-by: Andre Wanlin <awanlin@spotify.com> --------- Signed-off-by: Andre Wanlin <awanlin@spotify.com>
This commit is contained in:
parent
fdcc96dc79
commit
3a74e4b6ba
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
'@backstage-community/plugin-rollbar-backend': patch
|
||||
---
|
||||
|
||||
Removed usages and references of `@backstage/backend-common`
|
||||
|
||||
Deprecated `createRouter` and its router options in favour of the new backend system.
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
"test": "backstage-cli package test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "^0.25.0",
|
||||
"@backstage/backend-defaults": "^0.5.2",
|
||||
"@backstage/backend-plugin-api": "^1.0.1",
|
||||
"@backstage/config": "^1.2.0",
|
||||
"@types/express": "^4.17.6",
|
||||
|
|
@ -58,7 +58,6 @@
|
|||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-defaults": "^0.5.2",
|
||||
"@backstage/backend-test-utils": "^1.0.2",
|
||||
"@backstage/cli": "^0.28.0",
|
||||
"@backstage/plugin-auth-backend": "^0.23.1",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { Config } from '@backstage/config';
|
|||
import express from 'express';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @public (undocumented)
|
||||
// @public @deprecated (undocumented)
|
||||
export function createRouter(options: RouterOptions): Promise<express.Router>;
|
||||
|
||||
// @public (undocumented)
|
||||
|
|
@ -219,7 +219,7 @@ export type RollbarTopActiveItem = {
|
|||
counts: number[];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
// @public @deprecated (undocumented)
|
||||
export interface RouterOptions {
|
||||
// (undocumented)
|
||||
config: Config;
|
||||
|
|
|
|||
|
|
@ -15,10 +15,12 @@
|
|||
*/
|
||||
|
||||
import { getRequestHeaders, RollbarApi } from './RollbarApi';
|
||||
import { registerMswTestHooks } from '@backstage/backend-test-utils';
|
||||
import {
|
||||
mockServices,
|
||||
registerMswTestHooks,
|
||||
} from '@backstage/backend-test-utils';
|
||||
import { rest } from 'msw';
|
||||
import { setupServer } from 'msw/node';
|
||||
import { getVoidLogger } from '@backstage/backend-common';
|
||||
|
||||
describe('RollbarApi', () => {
|
||||
describe('getRequestHeaders', () => {
|
||||
|
|
@ -58,7 +60,7 @@ describe('RollbarApi', () => {
|
|||
|
||||
it('should return all projects with a name attribute', async () => {
|
||||
setupHandlers();
|
||||
const api = new RollbarApi('my-access-token', getVoidLogger());
|
||||
const api = new RollbarApi('my-access-token', mockServices.rootLogger());
|
||||
const projects = await api.getAllProjects();
|
||||
expect(projects).toEqual([
|
||||
{ id: 123, name: 'abc', accountId: 1, status: 'enabled' },
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { getVoidLogger } from '@backstage/backend-common';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import express from 'express';
|
||||
import request from 'supertest';
|
||||
import { RollbarApi } from '../api';
|
||||
import { createRouter } from './router';
|
||||
import { RollbarProject, RollbarTopActiveItem } from '../api/types';
|
||||
import { mockServices } from '@backstage/backend-test-utils';
|
||||
|
||||
describe('createRouter', () => {
|
||||
let rollbarApi: jest.Mocked<RollbarApi>;
|
||||
|
|
@ -37,7 +37,7 @@ describe('createRouter', () => {
|
|||
} as any;
|
||||
const router = await createRouter({
|
||||
rollbarApi,
|
||||
logger: getVoidLogger(),
|
||||
logger: mockServices.rootLogger(),
|
||||
config: new ConfigReader({ rollbar: { accountToken: 'foo' } }),
|
||||
});
|
||||
app = express().use(router);
|
||||
|
|
|
|||
|
|
@ -16,19 +16,25 @@
|
|||
|
||||
import express from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import { errorHandler } from '@backstage/backend-common';
|
||||
import { Config } from '@backstage/config';
|
||||
import { RollbarApi } from '../api';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter';
|
||||
|
||||
/** @public */
|
||||
/**
|
||||
* @deprecated Please migrate to the new backend system as this will be removed in the future.
|
||||
*
|
||||
* @public */
|
||||
export interface RouterOptions {
|
||||
rollbarApi?: RollbarApi;
|
||||
logger: LoggerService;
|
||||
config: Config;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
/**
|
||||
* @deprecated Please migrate to the new backend system as this will be removed in the future.
|
||||
*
|
||||
* @public */
|
||||
export async function createRouter(
|
||||
options: RouterOptions,
|
||||
): Promise<express.Router> {
|
||||
|
|
@ -85,8 +91,7 @@ export async function createRouter(
|
|||
});
|
||||
}
|
||||
|
||||
router.use(errorHandler());
|
||||
|
||||
router.use(MiddlewareFactory.create({ config, logger }).error());
|
||||
return router;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2516,7 +2516,6 @@ __metadata:
|
|||
version: 0.0.0-use.local
|
||||
resolution: "@backstage-community/plugin-rollbar-backend@workspace:plugins/rollbar-backend"
|
||||
dependencies:
|
||||
"@backstage/backend-common": ^0.25.0
|
||||
"@backstage/backend-defaults": ^0.5.2
|
||||
"@backstage/backend-plugin-api": ^1.0.1
|
||||
"@backstage/backend-test-utils": ^1.0.2
|
||||
|
|
|
|||
Loading…
Reference in New Issue