Merge pull request #25284 from backstage/camilaibs/more-backend-common-cleanups
[NBS 1.0] group compat files and move more files to deprecated
This commit is contained in:
@@ -14,4 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './context';
|
||||
export * from './deprecated/context';
|
||||
|
||||
+2
-3
@@ -35,15 +35,14 @@ import {
|
||||
createCredentialsWithUserPrincipal,
|
||||
createCredentialsWithNonePrincipal,
|
||||
toInternalBackstageCredentials,
|
||||
} from '../../../backend-defaults/src/entrypoints/auth/helpers';
|
||||
} from '../../../../backend-defaults/src/entrypoints/auth/helpers';
|
||||
// TODO is this circular thingy a problem? Test in e2e
|
||||
import {
|
||||
type IdentityApiGetIdentityRequest,
|
||||
DefaultIdentityClient,
|
||||
} from '@backstage/plugin-auth-node';
|
||||
import { decodeJwt } from 'jose';
|
||||
import { TokenManager } from '../deprecated';
|
||||
import { PluginEndpointDiscovery } from '../deprecated';
|
||||
import { TokenManager, PluginEndpointDiscovery } from '../../deprecated';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
|
||||
class AuthCompat implements AuthService {
|
||||
Vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,12 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export function isValidUrl(url: string): boolean {
|
||||
try {
|
||||
// eslint-disable-next-line no-new
|
||||
new URL(url);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export * from './legacy';
|
||||
export * from './auth';
|
||||
export * from './cache';
|
||||
export * from './logging';
|
||||
+3
-19
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,21 +14,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { isValidUrl } from './urls';
|
||||
|
||||
describe('isValidUrl', () => {
|
||||
it('should return true for url', () => {
|
||||
const validUrl = isValidUrl('http://some.valid.url');
|
||||
expect(validUrl).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for absolute path', () => {
|
||||
const validUrl = isValidUrl('/some/absolute/path');
|
||||
expect(validUrl).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for relative path', () => {
|
||||
const validUrl = isValidUrl('../some/relative/path');
|
||||
expect(validUrl).toBe(false);
|
||||
});
|
||||
});
|
||||
export { legacyPlugin, makeLegacyPlugin } from './legacy';
|
||||
export type { LegacyCreateRouter } from './legacy';
|
||||
+3
-3
@@ -21,12 +21,12 @@ import {
|
||||
import { mockServices, startTestBackend } from '@backstage/backend-test-utils';
|
||||
import { EventEmitter } from 'events';
|
||||
import { Router } from 'express';
|
||||
import { createLegacyAuthAdapters } from './auth';
|
||||
import { createLegacyAuthAdapters } from '..';
|
||||
import { legacyPlugin } from './legacy';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import { authServiceFactory } from '../../backend-app-api/src/services/implementations/auth';
|
||||
import { authServiceFactory } from '../../../../backend-app-api/src/services/implementations/auth';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import { tokenManagerServiceFactory } from '../../backend-app-api/src/services/implementations/tokenManager';
|
||||
import { tokenManagerServiceFactory } from '../../../../backend-app-api/src/services/implementations/tokenManager';
|
||||
|
||||
describe('legacyPlugin', () => {
|
||||
it('can auth across the new and old systems', async () => {
|
||||
+3
-3
@@ -21,9 +21,9 @@ import {
|
||||
ServiceRef,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { RequestHandler } from 'express';
|
||||
import { cacheToPluginCacheManager } from './cache';
|
||||
import { loggerToWinstonLogger } from './logging';
|
||||
import { TokenManager } from './deprecated';
|
||||
import { cacheToPluginCacheManager } from '../cache';
|
||||
import { loggerToWinstonLogger } from '../logging';
|
||||
import { TokenManager } from '../../deprecated';
|
||||
|
||||
/**
|
||||
* @public
|
||||
+2
-2
@@ -18,11 +18,11 @@
|
||||
import {
|
||||
createConfigSecretEnumerator,
|
||||
loadBackendConfig as newLoadBackendConfig,
|
||||
} from '../../backend-app-api/src/config';
|
||||
} from '../../../backend-app-api/src/config';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { AppConfig, Config } from '@backstage/config';
|
||||
import { LoadConfigOptionsRemote } from '@backstage/config-loader';
|
||||
import { setRootLoggerRedactionList } from './deprecated/logging/createRootLogger';
|
||||
import { setRootLoggerRedactionList } from './logging/createRootLogger';
|
||||
|
||||
/**
|
||||
* Load configuration for a Backend.
|
||||
@@ -99,6 +99,8 @@ import {
|
||||
UrlReaderService as _UrlReaderService,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
|
||||
export * from './hot';
|
||||
export * from './config';
|
||||
export * from './scm';
|
||||
export * from './tokens';
|
||||
export * from './logging';
|
||||
|
||||
@@ -22,7 +22,7 @@ import helmet, { HelmetOptions } from 'helmet';
|
||||
import { ContentSecurityPolicyOptions } from 'helmet/dist/types/middlewares/content-security-policy';
|
||||
import * as http from 'http';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { useHotCleanup } from '../../../hot';
|
||||
import { useHotCleanup } from '../../hot';
|
||||
import { getRootLogger } from '../../logging';
|
||||
import {
|
||||
errorHandler as defaultErrorHandler,
|
||||
|
||||
@@ -20,13 +20,7 @@
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
export { legacyPlugin, makeLegacyPlugin } from './legacy';
|
||||
export type { LegacyCreateRouter } from './legacy';
|
||||
export { loadBackendConfig } from './config';
|
||||
export * from './deprecated';
|
||||
export * from './auth';
|
||||
export * from './cache';
|
||||
export * from './hot';
|
||||
export * from './logging';
|
||||
export * from './compat';
|
||||
export * from './middleware';
|
||||
export * from './service';
|
||||
|
||||
Reference in New Issue
Block a user