Add more service implementations
Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com> Co-authored-by: blam <ben@blam.sh> Co-authored-by: Johan Haals <johan.haals@gmail.com> Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
committed by
Patrik Oldsberg
parent
39b24c78fe
commit
375a403664
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createServiceRef } from '../system/types';
|
||||
import { CacheManager } from '@backstage/backend-common';
|
||||
|
||||
export const cacheManagerServiceRef = createServiceRef<CacheManager>({
|
||||
id: 'core.cacheManager',
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createServiceRef } from '../system/types';
|
||||
import { PluginCacheManager } from '@backstage/backend-common';
|
||||
|
||||
export const cacheServiceRef = createServiceRef<PluginCacheManager>({
|
||||
id: 'core.cache',
|
||||
});
|
||||
+1
-1
@@ -17,6 +17,6 @@
|
||||
import { Config } from '@backstage/config';
|
||||
import { createServiceRef } from '../system/types';
|
||||
|
||||
export const configApiRef = createServiceRef<Config>({
|
||||
export const configServiceRef = createServiceRef<Config>({
|
||||
id: 'core.config',
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { PluginDatabaseManager } from '@backstage/backend-common';
|
||||
import { createServiceRef } from '../system/types';
|
||||
|
||||
export const databaseServiceRef = createServiceRef<PluginDatabaseManager>({
|
||||
id: 'core.database',
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createServiceRef } from '../system/types';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
|
||||
export const discoveryServiceRef = createServiceRef<PluginEndpointDiscovery>({
|
||||
id: 'core.discovery',
|
||||
});
|
||||
+1
-1
@@ -20,6 +20,6 @@ export interface HttpRouterApi {
|
||||
get(path: string): void;
|
||||
}
|
||||
|
||||
export const httpRouterApiRef = createServiceRef<HttpRouterApi>({
|
||||
export const httpRouterServiceRef = createServiceRef<HttpRouterApi>({
|
||||
id: 'core.httpRouter',
|
||||
});
|
||||
@@ -26,8 +26,13 @@
|
||||
// scheduler: PluginTaskScheduler;
|
||||
// };
|
||||
|
||||
export { configApiRef } from './configApiRef';
|
||||
export { httpRouterApiRef } from './httpRouterApiRef';
|
||||
export type { HttpRouterApi } from './httpRouterApiRef';
|
||||
export { loggerApiRef } from './loggerApiRef';
|
||||
export type { Logger } from './loggerApiRef';
|
||||
export { configServiceRef } from './configServiceRef';
|
||||
export { httpRouterServiceRef } from './httpRouterServiceRef';
|
||||
export type { HttpRouterApi } from './httpRouterServiceRef';
|
||||
export { loggerServiceRef } from './loggerServiceRef';
|
||||
export type { Logger } from './loggerServiceRef';
|
||||
export { urlReaderServiceRef } from './urlReaderServiceRef';
|
||||
export { cacheServiceRef } from './cacheServiceRef';
|
||||
export { databaseServiceRef } from './databaseServiceRef';
|
||||
export { discoveryServiceRef } from './discoveryServiceRef';
|
||||
export { tokenManagerServiceRef } from './tokenManagerServiceRef';
|
||||
|
||||
+2
-2
@@ -17,10 +17,10 @@
|
||||
import { createServiceRef } from '../system/types';
|
||||
|
||||
export interface Logger {
|
||||
log(message: string): void;
|
||||
info(message: string): void;
|
||||
child(fields: { [name: string]: string }): Logger;
|
||||
}
|
||||
|
||||
export const loggerApiRef = createServiceRef<Logger>({
|
||||
export const loggerServiceRef = createServiceRef<Logger>({
|
||||
id: 'core.logger',
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createServiceRef } from '../system/types';
|
||||
import { TokenManager } from '@backstage/backend-common';
|
||||
|
||||
export const tokenManagerServiceRef = createServiceRef<TokenManager>({
|
||||
id: 'core.tokenManager',
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createServiceRef } from '../system/types';
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
|
||||
export const urlReaderServiceRef = createServiceRef<UrlReader>({
|
||||
id: 'core.urlReader',
|
||||
});
|
||||
@@ -68,3 +68,11 @@ export function createServiceRef<T>(options: { id: string }): ServiceRef<T> {
|
||||
$$ref: 'service', // TODO: declare
|
||||
};
|
||||
}
|
||||
|
||||
export function createServiceFactory<
|
||||
Api,
|
||||
Impl extends Api,
|
||||
Deps extends { [name in string]: unknown },
|
||||
>(factory: ServiceFactory<Api, Impl, Deps>): ServiceFactory<Api, Impl, Deps> {
|
||||
return factory;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user