@backstage/backend-app-api 0.2.1-next.2 → 0.2.2-next.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.
Potentially problematic release.
This version of @backstage/backend-app-api might be problematic. Click here for more details.
- package/CHANGELOG.md +30 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +14 -1
- package/dist/index.beta.d.ts +14 -1
- package/dist/index.cjs.js +33 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +14 -1
- package/package.json +9 -10
- package/LICENSE +0 -201
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @backstage/backend-app-api
|
|
2
2
|
|
|
3
|
+
## 0.2.2-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0027a749cd: Added possibility to configure index plugin of the HTTP router service.
|
|
8
|
+
- 45857bffae: Properly export `rootLoggerFactory`.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/backend-plugin-api@0.1.3-next.0
|
|
11
|
+
- @backstage/backend-common@0.15.2-next.0
|
|
12
|
+
- @backstage/backend-tasks@0.3.6-next.0
|
|
13
|
+
- @backstage/plugin-permission-node@0.6.6-next.0
|
|
14
|
+
- @backstage/errors@1.1.2-next.0
|
|
15
|
+
|
|
16
|
+
## 0.2.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 2c57c0c499: Made `ApiRef.defaultFactory` internal.
|
|
21
|
+
- 854ba37357: Updated to support new `ServiceFactory` formats.
|
|
22
|
+
- af6bb42c68: Updated `ServiceRegistry` to not initialize factories more than once.
|
|
23
|
+
- 409ed984e8: Updated service implementations and backend wiring to support scoped service.
|
|
24
|
+
- de3347ca74: Updated usages of `ServiceFactory`.
|
|
25
|
+
- 1f384c5644: Improved error messaging when failing to instantiate services.
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
- @backstage/backend-plugin-api@0.1.2
|
|
28
|
+
- @backstage/backend-common@0.15.1
|
|
29
|
+
- @backstage/plugin-permission-node@0.6.5
|
|
30
|
+
- @backstage/backend-tasks@0.3.5
|
|
31
|
+
- @backstage/errors@1.1.1
|
|
32
|
+
|
|
3
33
|
## 0.2.1-next.2
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/index.alpha.d.ts
CHANGED
|
@@ -53,7 +53,17 @@ export declare const databaseFactory: (options?: undefined) => ServiceFactory<Pl
|
|
|
53
53
|
export declare const discoveryFactory: (options?: undefined) => ServiceFactory<PluginEndpointDiscovery>;
|
|
54
54
|
|
|
55
55
|
/** @public */
|
|
56
|
-
export declare const httpRouterFactory: (options?: undefined) => ServiceFactory<HttpRouterService>;
|
|
56
|
+
export declare const httpRouterFactory: (options?: HttpRouterFactoryOptions | undefined) => ServiceFactory<HttpRouterService>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
export declare type HttpRouterFactoryOptions = {
|
|
62
|
+
/**
|
|
63
|
+
* The plugin ID used for the index route. Defaults to 'app'
|
|
64
|
+
*/
|
|
65
|
+
indexPlugin?: string;
|
|
66
|
+
};
|
|
57
67
|
|
|
58
68
|
/** @public */
|
|
59
69
|
export declare const loggerFactory: (options?: undefined) => ServiceFactory<Logger>;
|
|
@@ -61,6 +71,9 @@ export declare const loggerFactory: (options?: undefined) => ServiceFactory<Logg
|
|
|
61
71
|
/** @public */
|
|
62
72
|
export declare const permissionsFactory: (options?: undefined) => ServiceFactory<PermissionAuthorizer | PermissionEvaluator>;
|
|
63
73
|
|
|
74
|
+
/** @public */
|
|
75
|
+
export declare const rootLoggerFactory: (options?: undefined) => ServiceFactory<Logger>;
|
|
76
|
+
|
|
64
77
|
/** @public */
|
|
65
78
|
export declare const schedulerFactory: (options?: undefined) => ServiceFactory<PluginTaskScheduler>;
|
|
66
79
|
|
package/dist/index.beta.d.ts
CHANGED
|
@@ -53,7 +53,17 @@ export declare const databaseFactory: (options?: undefined) => ServiceFactory<Pl
|
|
|
53
53
|
export declare const discoveryFactory: (options?: undefined) => ServiceFactory<PluginEndpointDiscovery>;
|
|
54
54
|
|
|
55
55
|
/** @public */
|
|
56
|
-
export declare const httpRouterFactory: (options?: undefined) => ServiceFactory<HttpRouterService>;
|
|
56
|
+
export declare const httpRouterFactory: (options?: HttpRouterFactoryOptions | undefined) => ServiceFactory<HttpRouterService>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
export declare type HttpRouterFactoryOptions = {
|
|
62
|
+
/**
|
|
63
|
+
* The plugin ID used for the index route. Defaults to 'app'
|
|
64
|
+
*/
|
|
65
|
+
indexPlugin?: string;
|
|
66
|
+
};
|
|
57
67
|
|
|
58
68
|
/** @public */
|
|
59
69
|
export declare const loggerFactory: (options?: undefined) => ServiceFactory<Logger>;
|
|
@@ -61,6 +71,9 @@ export declare const loggerFactory: (options?: undefined) => ServiceFactory<Logg
|
|
|
61
71
|
/** @public */
|
|
62
72
|
export declare const permissionsFactory: (options?: undefined) => ServiceFactory<PermissionAuthorizer | PermissionEvaluator>;
|
|
63
73
|
|
|
74
|
+
/** @public */
|
|
75
|
+
export declare const rootLoggerFactory: (options?: undefined) => ServiceFactory<Logger>;
|
|
76
|
+
|
|
64
77
|
/** @public */
|
|
65
78
|
export declare const schedulerFactory: (options?: undefined) => ServiceFactory<PluginTaskScheduler>;
|
|
66
79
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -440,6 +440,28 @@ const loggerFactory = backendPluginApi.createServiceFactory({
|
|
|
440
440
|
}
|
|
441
441
|
});
|
|
442
442
|
|
|
443
|
+
class BackstageLogger {
|
|
444
|
+
constructor(winston) {
|
|
445
|
+
this.winston = winston;
|
|
446
|
+
}
|
|
447
|
+
static fromWinston(logger) {
|
|
448
|
+
return new BackstageLogger(logger);
|
|
449
|
+
}
|
|
450
|
+
info(message, ...meta) {
|
|
451
|
+
this.winston.info(message, ...meta);
|
|
452
|
+
}
|
|
453
|
+
child(fields) {
|
|
454
|
+
return new BackstageLogger(this.winston.child(fields));
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
const rootLoggerFactory = backendPluginApi.createServiceFactory({
|
|
458
|
+
service: backendPluginApi.rootLoggerServiceRef,
|
|
459
|
+
deps: {},
|
|
460
|
+
async factory() {
|
|
461
|
+
return BackstageLogger.fromWinston(backendCommon.createRootLogger());
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
|
|
443
465
|
const permissionsFactory = backendPluginApi.createServiceFactory({
|
|
444
466
|
service: backendPluginApi.permissionsServiceRef,
|
|
445
467
|
deps: {
|
|
@@ -508,16 +530,22 @@ const httpRouterFactory = backendPluginApi.createServiceFactory({
|
|
|
508
530
|
config: backendPluginApi.configServiceRef,
|
|
509
531
|
plugin: backendPluginApi.pluginMetadataServiceRef
|
|
510
532
|
},
|
|
511
|
-
async factory({ config }) {
|
|
533
|
+
async factory({ config }, options) {
|
|
534
|
+
var _a;
|
|
535
|
+
const defaultPluginId = (_a = options == null ? void 0 : options.indexPlugin) != null ? _a : "app";
|
|
536
|
+
const apiRouter = Router__default["default"]();
|
|
512
537
|
const rootRouter = Router__default["default"]();
|
|
513
|
-
const service = backendCommon.createServiceBuilder(module).loadConfig(config).addRouter("", rootRouter);
|
|
538
|
+
const service = backendCommon.createServiceBuilder(module).loadConfig(config).addRouter("/api", apiRouter).addRouter("", rootRouter);
|
|
514
539
|
await service.start();
|
|
515
540
|
return async ({ plugin }) => {
|
|
516
541
|
const pluginId = plugin.getId();
|
|
517
|
-
const path = pluginId ? `/api/${pluginId}` : "";
|
|
518
542
|
return {
|
|
519
543
|
use(handler) {
|
|
520
|
-
|
|
544
|
+
if (pluginId === defaultPluginId) {
|
|
545
|
+
rootRouter.use(handler);
|
|
546
|
+
} else {
|
|
547
|
+
apiRouter.use(`/${pluginId}`, handler);
|
|
548
|
+
}
|
|
521
549
|
}
|
|
522
550
|
};
|
|
523
551
|
};
|
|
@@ -532,6 +560,7 @@ exports.discoveryFactory = discoveryFactory;
|
|
|
532
560
|
exports.httpRouterFactory = httpRouterFactory;
|
|
533
561
|
exports.loggerFactory = loggerFactory;
|
|
534
562
|
exports.permissionsFactory = permissionsFactory;
|
|
563
|
+
exports.rootLoggerFactory = rootLoggerFactory;
|
|
535
564
|
exports.schedulerFactory = schedulerFactory;
|
|
536
565
|
exports.tokenManagerFactory = tokenManagerFactory;
|
|
537
566
|
exports.urlReaderFactory = urlReaderFactory;
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/wiring/BackendInitializer.ts","../src/wiring/ServiceRegistry.ts","../src/wiring/BackstageBackend.ts","../src/wiring/types.ts","../src/services/implementations/cacheService.ts","../src/services/implementations/configService.ts","../src/services/implementations/databaseService.ts","../src/services/implementations/discoveryService.ts","../src/services/implementations/loggerService.ts","../src/services/implementations/permissionsService.ts","../src/services/implementations/schedulerService.ts","../src/services/implementations/tokenManagerService.ts","../src/services/implementations/urlReaderService.ts","../src/services/implementations/httpRouterService.ts"],"sourcesContent":["/*\n * Copyright 2022 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 BackendFeature,\n ExtensionPoint,\n ServiceRef,\n} from '@backstage/backend-plugin-api';\nimport {\n BackendRegisterInit,\n ServiceHolder,\n ServiceOrExtensionPoint,\n} from './types';\n\nexport class BackendInitializer {\n #started = false;\n #features = new Map<BackendFeature, unknown>();\n #registerInits = new Array<BackendRegisterInit>();\n #extensionPoints = new Map<ExtensionPoint<unknown>, unknown>();\n #serviceHolder: ServiceHolder;\n\n constructor(serviceHolder: ServiceHolder) {\n this.#serviceHolder = serviceHolder;\n }\n\n async #getInitDeps(\n deps: { [name: string]: ServiceOrExtensionPoint },\n pluginId: string,\n ) {\n const result = new Map<string, unknown>();\n const missingRefs = new Set<ServiceOrExtensionPoint>();\n\n for (const [name, ref] of Object.entries(deps)) {\n const extensionPoint = this.#extensionPoints.get(\n ref as ExtensionPoint<unknown>,\n );\n if (extensionPoint) {\n result.set(name, extensionPoint);\n } else {\n const impl = await this.#serviceHolder.get(\n ref as ServiceRef<unknown>,\n pluginId,\n );\n if (impl) {\n result.set(name, impl);\n } else {\n missingRefs.add(ref);\n }\n }\n }\n\n if (missingRefs.size > 0) {\n const missing = Array.from(missingRefs).join(', ');\n throw new Error(\n `No extension point or service available for the following ref(s): ${missing}`,\n );\n }\n\n return Object.fromEntries(result);\n }\n\n add<TOptions>(feature: BackendFeature, options?: TOptions) {\n if (this.#started) {\n throw new Error('feature can not be added after the backend has started');\n }\n this.#features.set(feature, options);\n }\n\n async start(): Promise<void> {\n if (this.#started) {\n throw new Error('Backend has already started');\n }\n this.#started = true;\n\n for (const [feature] of this.#features) {\n const provides = new Set<ExtensionPoint<unknown>>();\n\n let registerInit: BackendRegisterInit | undefined = undefined;\n\n feature.register({\n registerExtensionPoint: (extensionPointRef, impl) => {\n if (registerInit) {\n throw new Error('registerExtensionPoint called after registerInit');\n }\n if (this.#extensionPoints.has(extensionPointRef)) {\n throw new Error(`API ${extensionPointRef.id} already registered`);\n }\n this.#extensionPoints.set(extensionPointRef, impl);\n provides.add(extensionPointRef);\n },\n registerInit: registerOptions => {\n if (registerInit) {\n throw new Error('registerInit must only be called once');\n }\n registerInit = {\n id: feature.id,\n provides,\n consumes: new Set(Object.values(registerOptions.deps)),\n deps: registerOptions.deps,\n init: registerOptions.init as BackendRegisterInit['init'],\n };\n },\n });\n\n if (!registerInit) {\n throw new Error(\n `registerInit was not called by register in ${feature.id}`,\n );\n }\n\n this.#registerInits.push(registerInit);\n }\n\n const orderedRegisterResults = this.#resolveInitOrder(this.#registerInits);\n\n for (const registerInit of orderedRegisterResults) {\n const deps = await this.#getInitDeps(registerInit.deps, registerInit.id);\n await registerInit.init(deps);\n }\n }\n\n #resolveInitOrder(registerInits: Array<BackendRegisterInit>) {\n let registerInitsToOrder = registerInits.slice();\n const orderedRegisterInits = new Array<BackendRegisterInit>();\n\n // TODO: Validate duplicates\n\n while (registerInitsToOrder.length > 0) {\n const toRemove = new Set<unknown>();\n\n for (const registerInit of registerInitsToOrder) {\n const unInitializedDependents = [];\n\n for (const provided of registerInit.provides) {\n if (\n registerInitsToOrder.some(\n init => init !== registerInit && init.consumes.has(provided),\n )\n ) {\n unInitializedDependents.push(provided);\n }\n }\n\n if (unInitializedDependents.length === 0) {\n orderedRegisterInits.push(registerInit);\n toRemove.add(registerInit);\n }\n }\n\n registerInitsToOrder = registerInitsToOrder.filter(r => !toRemove.has(r));\n }\n\n return orderedRegisterInits;\n }\n}\n","/*\n * Copyright 2022 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 ServiceFactory,\n ServiceRef,\n pluginMetadataServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { stringifyError } from '@backstage/errors';\n\n/**\n * Keep in sync with `@backstage/backend-plugin-api/src/services/system/types.ts`\n * @internal\n */\nexport type InternalServiceRef<T> = ServiceRef<T> & {\n __defaultFactory?: (\n service: ServiceRef<T>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>;\n};\n\nexport class ServiceRegistry {\n readonly #providedFactories: Map<string, ServiceFactory>;\n readonly #loadedDefaultFactories: Map<Function, Promise<ServiceFactory>>;\n readonly #implementations: Map<\n ServiceFactory,\n {\n factoryFunc: Promise<\n (deps: { [name in string]: unknown }) => Promise<unknown>\n >;\n byPlugin: Map<string, Promise<unknown>>;\n }\n >;\n\n constructor(\n factories: Array<ServiceFactory<unknown> | (() => ServiceFactory<unknown>)>,\n ) {\n this.#providedFactories = new Map(\n factories.map(f => {\n if (typeof f === 'function') {\n const cf = f();\n return [cf.service.id, cf];\n }\n return [f.service.id, f];\n }),\n );\n this.#loadedDefaultFactories = new Map();\n this.#implementations = new Map();\n }\n\n #resolveFactory(\n ref: ServiceRef<unknown>,\n pluginId: string,\n ): Promise<ServiceFactory> | undefined {\n // Special case handling of the plugin metadata service, generating a custom factory for it each time\n if (ref.id === pluginMetadataServiceRef.id) {\n return Promise.resolve({\n scope: 'plugin',\n service: pluginMetadataServiceRef,\n deps: {},\n factory: async () => async () => ({\n getId() {\n return pluginId;\n },\n }),\n });\n }\n\n let resolvedFactory: Promise<ServiceFactory> | ServiceFactory | undefined =\n this.#providedFactories.get(ref.id);\n const { __defaultFactory: defaultFactory } =\n ref as InternalServiceRef<unknown>;\n if (!resolvedFactory && !defaultFactory) {\n return undefined;\n }\n\n if (!resolvedFactory) {\n let loadedFactory = this.#loadedDefaultFactories.get(defaultFactory!);\n if (!loadedFactory) {\n loadedFactory = Promise.resolve()\n .then(() => defaultFactory!(ref))\n .then(f =>\n typeof f === 'function' ? f() : f,\n ) as Promise<ServiceFactory>;\n this.#loadedDefaultFactories.set(defaultFactory!, loadedFactory);\n }\n resolvedFactory = loadedFactory.catch(error => {\n throw new Error(\n `Failed to instantiate service '${\n ref.id\n }' because the default factory loader threw an error, ${stringifyError(\n error,\n )}`,\n );\n });\n }\n\n return Promise.resolve(resolvedFactory);\n }\n\n #separateMapForTheRootService = new Map<ServiceFactory, Promise<unknown>>();\n\n #checkForMissingDeps(factory: ServiceFactory, pluginId: string) {\n const missingDeps = Object.values(factory.deps).filter(ref => {\n if (ref.id === pluginMetadataServiceRef.id) {\n return false;\n }\n if (this.#providedFactories.get(ref.id)) {\n return false;\n }\n\n return !(ref as InternalServiceRef<unknown>).__defaultFactory;\n });\n\n if (missingDeps.length) {\n const missing = missingDeps.map(r => `'${r.id}'`).join(', ');\n throw new Error(\n `Failed to instantiate service '${factory.service.id}' for '${pluginId}' because the following dependent services are missing: ${missing}`,\n );\n }\n }\n\n get<T>(ref: ServiceRef<T>, pluginId: string): Promise<T> | undefined {\n return this.#resolveFactory(ref, pluginId)?.then(factory => {\n if (factory.scope === 'root') {\n let existing = this.#separateMapForTheRootService.get(factory);\n if (!existing) {\n this.#checkForMissingDeps(factory, pluginId);\n const rootDeps = new Array<Promise<[name: string, impl: unknown]>>();\n\n for (const [name, serviceRef] of Object.entries(factory.deps)) {\n if (serviceRef.scope !== 'root') {\n throw new Error(\n `Failed to instantiate 'root' scoped service '${ref.id}' because it depends on '${serviceRef.scope}' scoped service '${serviceRef.id}'.`,\n );\n }\n const target = this.get(serviceRef, pluginId)!;\n rootDeps.push(target.then(impl => [name, impl]));\n }\n\n existing = Promise.all(rootDeps).then(entries =>\n factory.factory(Object.fromEntries(entries)),\n );\n this.#separateMapForTheRootService.set(factory, existing);\n }\n return existing as Promise<T>;\n }\n\n let implementation = this.#implementations.get(factory);\n if (!implementation) {\n this.#checkForMissingDeps(factory, pluginId);\n const rootDeps = new Array<Promise<[name: string, impl: unknown]>>();\n\n for (const [name, serviceRef] of Object.entries(factory.deps)) {\n if (serviceRef.scope === 'root') {\n const target = this.get(serviceRef, pluginId)!;\n rootDeps.push(target.then(impl => [name, impl]));\n }\n }\n\n implementation = {\n factoryFunc: Promise.all(rootDeps)\n .then(entries => factory.factory(Object.fromEntries(entries)))\n .catch(error => {\n const cause = stringifyError(error);\n throw new Error(\n `Failed to instantiate service '${ref.id}' because the top-level factory function threw an error, ${cause}`,\n );\n }),\n byPlugin: new Map(),\n };\n\n this.#implementations.set(factory, implementation);\n }\n\n let result = implementation.byPlugin.get(pluginId) as Promise<any>;\n if (!result) {\n const allDeps = new Array<Promise<[name: string, impl: unknown]>>();\n\n for (const [name, serviceRef] of Object.entries(factory.deps)) {\n const target = this.get(serviceRef, pluginId)!;\n allDeps.push(target.then(impl => [name, impl]));\n }\n\n result = implementation.factoryFunc\n .then(func =>\n Promise.all(allDeps).then(entries =>\n func(Object.fromEntries(entries)),\n ),\n )\n .catch(error => {\n const cause = stringifyError(error);\n throw new Error(\n `Failed to instantiate service '${ref.id}' for '${pluginId}' because the factory function threw an error, ${cause}`,\n );\n });\n implementation.byPlugin.set(pluginId, result);\n }\n\n return result;\n });\n }\n}\n","/*\n * Copyright 2022 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 { ServiceFactory, BackendFeature } from '@backstage/backend-plugin-api';\nimport { BackendInitializer } from './BackendInitializer';\nimport { ServiceRegistry } from './ServiceRegistry';\nimport { Backend } from './types';\n\nexport class BackstageBackend implements Backend {\n #services: ServiceRegistry;\n #initializer: BackendInitializer;\n\n constructor(apiFactories: ServiceFactory[]) {\n this.#services = new ServiceRegistry(apiFactories);\n this.#initializer = new BackendInitializer(this.#services);\n }\n\n add(feature: BackendFeature): void {\n this.#initializer.add(feature);\n }\n\n async start(): Promise<void> {\n await this.#initializer.start();\n }\n\n // async stop(): Promise<void> {\n // await this.#initializer.stop();\n // }\n}\n","/*\n * Copyright 2022 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 ServiceFactory,\n BackendFeature,\n ExtensionPoint,\n ServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { BackstageBackend } from './BackstageBackend';\n\n/**\n * @public\n */\nexport interface Backend {\n add(feature: BackendFeature): void;\n start(): Promise<void>;\n}\n\nexport interface BackendRegisterInit {\n id: string;\n consumes: Set<ServiceOrExtensionPoint>;\n provides: Set<ServiceOrExtensionPoint>;\n deps: { [name: string]: ServiceOrExtensionPoint };\n init: (deps: { [name: string]: unknown }) => Promise<void>;\n}\n\n/**\n * @public\n */\nexport interface CreateSpecializedBackendOptions {\n services: (ServiceFactory | (() => ServiceFactory))[];\n}\n\nexport type ServiceHolder = {\n get<T>(api: ServiceRef<T>, pluginId: string): Promise<T> | undefined;\n};\n\n/**\n * @public\n */\nexport function createSpecializedBackend(\n options: CreateSpecializedBackendOptions,\n): Backend {\n return new BackstageBackend(\n options.services.map(s => (typeof s === 'function' ? s() : s)),\n );\n}\n\n/**\n * @public\n */\nexport type ServiceOrExtensionPoint<T = unknown> =\n | ExtensionPoint<T>\n | ServiceRef<T>;\n","/*\n * Copyright 2022 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 { CacheManager } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n pluginMetadataServiceRef,\n cacheServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const cacheFactory = createServiceFactory({\n service: cacheServiceRef,\n deps: {\n config: configServiceRef,\n plugin: pluginMetadataServiceRef,\n },\n async factory({ config }) {\n const cacheManager = CacheManager.fromConfig(config);\n return async ({ plugin }) => {\n return cacheManager.forPlugin(plugin.getId());\n };\n },\n});\n","/*\n * Copyright 2022 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 { loadBackendConfig } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n loggerToWinstonLogger,\n rootLoggerServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const configFactory = createServiceFactory({\n service: configServiceRef,\n deps: {\n logger: rootLoggerServiceRef,\n },\n async factory({ logger }) {\n const config = await loadBackendConfig({\n argv: process.argv,\n logger: loggerToWinstonLogger(logger),\n });\n return config;\n },\n});\n","/*\n * Copyright 2022 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 { DatabaseManager } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n databaseServiceRef,\n pluginMetadataServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const databaseFactory = createServiceFactory({\n service: databaseServiceRef,\n deps: {\n config: configServiceRef,\n plugin: pluginMetadataServiceRef,\n },\n async factory({ config }) {\n const databaseManager = DatabaseManager.fromConfig(config);\n return async ({ plugin }) => {\n return databaseManager.forPlugin(plugin.getId());\n };\n },\n});\n","/*\n * Copyright 2022 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 { SingleHostDiscovery } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n discoveryServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const discoveryFactory = createServiceFactory({\n service: discoveryServiceRef,\n deps: {\n config: configServiceRef,\n },\n async factory({ config }) {\n const discovery = SingleHostDiscovery.fromConfig(config);\n return async () => {\n return discovery;\n };\n },\n});\n","/*\n * Copyright 2022 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 createServiceFactory,\n loggerServiceRef,\n pluginMetadataServiceRef,\n rootLoggerServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const loggerFactory = createServiceFactory({\n service: loggerServiceRef,\n deps: {\n rootLogger: rootLoggerServiceRef,\n plugin: pluginMetadataServiceRef,\n },\n async factory({ rootLogger }) {\n return async ({ plugin }) => {\n return rootLogger.child({ pluginId: plugin.getId() });\n };\n },\n});\n","/*\n * Copyright 2022 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 configServiceRef,\n createServiceFactory,\n discoveryServiceRef,\n permissionsServiceRef,\n tokenManagerServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { ServerPermissionClient } from '@backstage/plugin-permission-node';\n\n/** @public */\nexport const permissionsFactory = createServiceFactory({\n service: permissionsServiceRef,\n deps: {\n config: configServiceRef,\n discovery: discoveryServiceRef,\n tokenManager: tokenManagerServiceRef,\n },\n async factory({ config }) {\n return async ({ discovery, tokenManager }) => {\n return ServerPermissionClient.fromConfig(config, {\n discovery,\n tokenManager,\n });\n };\n },\n});\n","/*\n * Copyright 2022 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 configServiceRef,\n createServiceFactory,\n pluginMetadataServiceRef,\n schedulerServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { TaskScheduler } from '@backstage/backend-tasks';\n\n/** @public */\nexport const schedulerFactory = createServiceFactory({\n service: schedulerServiceRef,\n deps: {\n config: configServiceRef,\n plugin: pluginMetadataServiceRef,\n },\n async factory({ config }) {\n const taskScheduler = TaskScheduler.fromConfig(config);\n return async ({ plugin }) => {\n return taskScheduler.forPlugin(plugin.getId());\n };\n },\n});\n","/*\n * Copyright 2022 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 configServiceRef,\n loggerServiceRef,\n createServiceFactory,\n tokenManagerServiceRef,\n loggerToWinstonLogger,\n} from '@backstage/backend-plugin-api';\nimport { ServerTokenManager } from '@backstage/backend-common';\n\n/** @public */\nexport const tokenManagerFactory = createServiceFactory({\n service: tokenManagerServiceRef,\n deps: {\n config: configServiceRef,\n logger: loggerServiceRef,\n },\n async factory() {\n return async ({ config, logger }) => {\n return ServerTokenManager.fromConfig(config, {\n logger: loggerToWinstonLogger(logger),\n });\n };\n },\n});\n","/*\n * Copyright 2022 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 { UrlReaders } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n loggerServiceRef,\n loggerToWinstonLogger,\n urlReaderServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const urlReaderFactory = createServiceFactory({\n service: urlReaderServiceRef,\n deps: {\n config: configServiceRef,\n logger: loggerServiceRef,\n },\n async factory() {\n return async ({ config, logger }) => {\n return UrlReaders.default({\n config,\n logger: loggerToWinstonLogger(logger),\n });\n };\n },\n});\n","/*\n * Copyright 2022 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 createServiceFactory,\n httpRouterServiceRef,\n configServiceRef,\n pluginMetadataServiceRef,\n} from '@backstage/backend-plugin-api';\nimport Router from 'express-promise-router';\nimport { Handler } from 'express';\nimport { createServiceBuilder } from '@backstage/backend-common';\n\n/** @public */\nexport const httpRouterFactory = createServiceFactory({\n service: httpRouterServiceRef,\n deps: {\n config: configServiceRef,\n plugin: pluginMetadataServiceRef,\n },\n async factory({ config }) {\n const rootRouter = Router();\n\n const service = createServiceBuilder(module)\n .loadConfig(config)\n .addRouter('', rootRouter);\n\n await service.start();\n\n return async ({ plugin }) => {\n const pluginId = plugin.getId();\n const path = pluginId ? `/api/${pluginId}` : '';\n return {\n use(handler: Handler) {\n rootRouter.use(path, handler);\n },\n };\n };\n },\n});\n"],"names":["__privateAdd","__privateSet","__privateGet","__privateMethod","stringifyError","pluginMetadataServiceRef","createServiceFactory","cacheServiceRef","configServiceRef","CacheManager","rootLoggerServiceRef","loadBackendConfig","loggerToWinstonLogger","databaseServiceRef","DatabaseManager","discoveryServiceRef","SingleHostDiscovery","loggerServiceRef","permissionsServiceRef","tokenManagerServiceRef","ServerPermissionClient","schedulerServiceRef","TaskScheduler","ServerTokenManager","urlReaderServiceRef","UrlReaders","httpRouterServiceRef","Router","createServiceBuilder"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,QAAA,EAAA,SAAA,EAAA,cAAA,EAAA,gBAAA,EAAA,cAAA,EAAA,YAAA,EAAA,cAAA,EAAA,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AAa,KAAA;AAC3B,MAAM,MAAA,QAAA,GAAW,OAAO,KAAM,EAAA,CAAA;AAC9B,MAAM,MAAA,IAAA,GAAO,QAAW,GAAA,CAAA,KAAA,EAAQ,QAAa,CAAA,CAAA,GAAA,EAAA,CAAA;AAC7C,MAAO,OAAA;AAAA,QACL,IAAI,OAAkB,EAAA;AACpB,UAAW,UAAA,CAAA,GAAA,CAAI,MAAM,OAAO,CAAA,CAAA;AAAA,SAC9B;AAAA,OACF,CAAA;AAAA,KACF,CAAA;AAAA,GACF;AACF,CAAC;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/wiring/BackendInitializer.ts","../src/wiring/ServiceRegistry.ts","../src/wiring/BackstageBackend.ts","../src/wiring/types.ts","../src/services/implementations/cacheService.ts","../src/services/implementations/configService.ts","../src/services/implementations/databaseService.ts","../src/services/implementations/discoveryService.ts","../src/services/implementations/loggerService.ts","../src/services/implementations/rootLoggerService.ts","../src/services/implementations/permissionsService.ts","../src/services/implementations/schedulerService.ts","../src/services/implementations/tokenManagerService.ts","../src/services/implementations/urlReaderService.ts","../src/services/implementations/httpRouterService.ts"],"sourcesContent":["/*\n * Copyright 2022 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 BackendFeature,\n ExtensionPoint,\n ServiceRef,\n} from '@backstage/backend-plugin-api';\nimport {\n BackendRegisterInit,\n ServiceHolder,\n ServiceOrExtensionPoint,\n} from './types';\n\nexport class BackendInitializer {\n #started = false;\n #features = new Map<BackendFeature, unknown>();\n #registerInits = new Array<BackendRegisterInit>();\n #extensionPoints = new Map<ExtensionPoint<unknown>, unknown>();\n #serviceHolder: ServiceHolder;\n\n constructor(serviceHolder: ServiceHolder) {\n this.#serviceHolder = serviceHolder;\n }\n\n async #getInitDeps(\n deps: { [name: string]: ServiceOrExtensionPoint },\n pluginId: string,\n ) {\n const result = new Map<string, unknown>();\n const missingRefs = new Set<ServiceOrExtensionPoint>();\n\n for (const [name, ref] of Object.entries(deps)) {\n const extensionPoint = this.#extensionPoints.get(\n ref as ExtensionPoint<unknown>,\n );\n if (extensionPoint) {\n result.set(name, extensionPoint);\n } else {\n const impl = await this.#serviceHolder.get(\n ref as ServiceRef<unknown>,\n pluginId,\n );\n if (impl) {\n result.set(name, impl);\n } else {\n missingRefs.add(ref);\n }\n }\n }\n\n if (missingRefs.size > 0) {\n const missing = Array.from(missingRefs).join(', ');\n throw new Error(\n `No extension point or service available for the following ref(s): ${missing}`,\n );\n }\n\n return Object.fromEntries(result);\n }\n\n add<TOptions>(feature: BackendFeature, options?: TOptions) {\n if (this.#started) {\n throw new Error('feature can not be added after the backend has started');\n }\n this.#features.set(feature, options);\n }\n\n async start(): Promise<void> {\n if (this.#started) {\n throw new Error('Backend has already started');\n }\n this.#started = true;\n\n for (const [feature] of this.#features) {\n const provides = new Set<ExtensionPoint<unknown>>();\n\n let registerInit: BackendRegisterInit | undefined = undefined;\n\n feature.register({\n registerExtensionPoint: (extensionPointRef, impl) => {\n if (registerInit) {\n throw new Error('registerExtensionPoint called after registerInit');\n }\n if (this.#extensionPoints.has(extensionPointRef)) {\n throw new Error(`API ${extensionPointRef.id} already registered`);\n }\n this.#extensionPoints.set(extensionPointRef, impl);\n provides.add(extensionPointRef);\n },\n registerInit: registerOptions => {\n if (registerInit) {\n throw new Error('registerInit must only be called once');\n }\n registerInit = {\n id: feature.id,\n provides,\n consumes: new Set(Object.values(registerOptions.deps)),\n deps: registerOptions.deps,\n init: registerOptions.init as BackendRegisterInit['init'],\n };\n },\n });\n\n if (!registerInit) {\n throw new Error(\n `registerInit was not called by register in ${feature.id}`,\n );\n }\n\n this.#registerInits.push(registerInit);\n }\n\n const orderedRegisterResults = this.#resolveInitOrder(this.#registerInits);\n\n for (const registerInit of orderedRegisterResults) {\n const deps = await this.#getInitDeps(registerInit.deps, registerInit.id);\n await registerInit.init(deps);\n }\n }\n\n #resolveInitOrder(registerInits: Array<BackendRegisterInit>) {\n let registerInitsToOrder = registerInits.slice();\n const orderedRegisterInits = new Array<BackendRegisterInit>();\n\n // TODO: Validate duplicates\n\n while (registerInitsToOrder.length > 0) {\n const toRemove = new Set<unknown>();\n\n for (const registerInit of registerInitsToOrder) {\n const unInitializedDependents = [];\n\n for (const provided of registerInit.provides) {\n if (\n registerInitsToOrder.some(\n init => init !== registerInit && init.consumes.has(provided),\n )\n ) {\n unInitializedDependents.push(provided);\n }\n }\n\n if (unInitializedDependents.length === 0) {\n orderedRegisterInits.push(registerInit);\n toRemove.add(registerInit);\n }\n }\n\n registerInitsToOrder = registerInitsToOrder.filter(r => !toRemove.has(r));\n }\n\n return orderedRegisterInits;\n }\n}\n","/*\n * Copyright 2022 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 ServiceFactory,\n ServiceRef,\n pluginMetadataServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { stringifyError } from '@backstage/errors';\n\n/**\n * Keep in sync with `@backstage/backend-plugin-api/src/services/system/types.ts`\n * @internal\n */\nexport type InternalServiceRef<T> = ServiceRef<T> & {\n __defaultFactory?: (\n service: ServiceRef<T>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>;\n};\n\nexport class ServiceRegistry {\n readonly #providedFactories: Map<string, ServiceFactory>;\n readonly #loadedDefaultFactories: Map<Function, Promise<ServiceFactory>>;\n readonly #implementations: Map<\n ServiceFactory,\n {\n factoryFunc: Promise<\n (deps: { [name in string]: unknown }) => Promise<unknown>\n >;\n byPlugin: Map<string, Promise<unknown>>;\n }\n >;\n\n constructor(\n factories: Array<ServiceFactory<unknown> | (() => ServiceFactory<unknown>)>,\n ) {\n this.#providedFactories = new Map(\n factories.map(f => {\n if (typeof f === 'function') {\n const cf = f();\n return [cf.service.id, cf];\n }\n return [f.service.id, f];\n }),\n );\n this.#loadedDefaultFactories = new Map();\n this.#implementations = new Map();\n }\n\n #resolveFactory(\n ref: ServiceRef<unknown>,\n pluginId: string,\n ): Promise<ServiceFactory> | undefined {\n // Special case handling of the plugin metadata service, generating a custom factory for it each time\n if (ref.id === pluginMetadataServiceRef.id) {\n return Promise.resolve({\n scope: 'plugin',\n service: pluginMetadataServiceRef,\n deps: {},\n factory: async () => async () => ({\n getId() {\n return pluginId;\n },\n }),\n });\n }\n\n let resolvedFactory: Promise<ServiceFactory> | ServiceFactory | undefined =\n this.#providedFactories.get(ref.id);\n const { __defaultFactory: defaultFactory } =\n ref as InternalServiceRef<unknown>;\n if (!resolvedFactory && !defaultFactory) {\n return undefined;\n }\n\n if (!resolvedFactory) {\n let loadedFactory = this.#loadedDefaultFactories.get(defaultFactory!);\n if (!loadedFactory) {\n loadedFactory = Promise.resolve()\n .then(() => defaultFactory!(ref))\n .then(f =>\n typeof f === 'function' ? f() : f,\n ) as Promise<ServiceFactory>;\n this.#loadedDefaultFactories.set(defaultFactory!, loadedFactory);\n }\n resolvedFactory = loadedFactory.catch(error => {\n throw new Error(\n `Failed to instantiate service '${\n ref.id\n }' because the default factory loader threw an error, ${stringifyError(\n error,\n )}`,\n );\n });\n }\n\n return Promise.resolve(resolvedFactory);\n }\n\n #separateMapForTheRootService = new Map<ServiceFactory, Promise<unknown>>();\n\n #checkForMissingDeps(factory: ServiceFactory, pluginId: string) {\n const missingDeps = Object.values(factory.deps).filter(ref => {\n if (ref.id === pluginMetadataServiceRef.id) {\n return false;\n }\n if (this.#providedFactories.get(ref.id)) {\n return false;\n }\n\n return !(ref as InternalServiceRef<unknown>).__defaultFactory;\n });\n\n if (missingDeps.length) {\n const missing = missingDeps.map(r => `'${r.id}'`).join(', ');\n throw new Error(\n `Failed to instantiate service '${factory.service.id}' for '${pluginId}' because the following dependent services are missing: ${missing}`,\n );\n }\n }\n\n get<T>(ref: ServiceRef<T>, pluginId: string): Promise<T> | undefined {\n return this.#resolveFactory(ref, pluginId)?.then(factory => {\n if (factory.scope === 'root') {\n let existing = this.#separateMapForTheRootService.get(factory);\n if (!existing) {\n this.#checkForMissingDeps(factory, pluginId);\n const rootDeps = new Array<Promise<[name: string, impl: unknown]>>();\n\n for (const [name, serviceRef] of Object.entries(factory.deps)) {\n if (serviceRef.scope !== 'root') {\n throw new Error(\n `Failed to instantiate 'root' scoped service '${ref.id}' because it depends on '${serviceRef.scope}' scoped service '${serviceRef.id}'.`,\n );\n }\n const target = this.get(serviceRef, pluginId)!;\n rootDeps.push(target.then(impl => [name, impl]));\n }\n\n existing = Promise.all(rootDeps).then(entries =>\n factory.factory(Object.fromEntries(entries)),\n );\n this.#separateMapForTheRootService.set(factory, existing);\n }\n return existing as Promise<T>;\n }\n\n let implementation = this.#implementations.get(factory);\n if (!implementation) {\n this.#checkForMissingDeps(factory, pluginId);\n const rootDeps = new Array<Promise<[name: string, impl: unknown]>>();\n\n for (const [name, serviceRef] of Object.entries(factory.deps)) {\n if (serviceRef.scope === 'root') {\n const target = this.get(serviceRef, pluginId)!;\n rootDeps.push(target.then(impl => [name, impl]));\n }\n }\n\n implementation = {\n factoryFunc: Promise.all(rootDeps)\n .then(entries => factory.factory(Object.fromEntries(entries)))\n .catch(error => {\n const cause = stringifyError(error);\n throw new Error(\n `Failed to instantiate service '${ref.id}' because the top-level factory function threw an error, ${cause}`,\n );\n }),\n byPlugin: new Map(),\n };\n\n this.#implementations.set(factory, implementation);\n }\n\n let result = implementation.byPlugin.get(pluginId) as Promise<any>;\n if (!result) {\n const allDeps = new Array<Promise<[name: string, impl: unknown]>>();\n\n for (const [name, serviceRef] of Object.entries(factory.deps)) {\n const target = this.get(serviceRef, pluginId)!;\n allDeps.push(target.then(impl => [name, impl]));\n }\n\n result = implementation.factoryFunc\n .then(func =>\n Promise.all(allDeps).then(entries =>\n func(Object.fromEntries(entries)),\n ),\n )\n .catch(error => {\n const cause = stringifyError(error);\n throw new Error(\n `Failed to instantiate service '${ref.id}' for '${pluginId}' because the factory function threw an error, ${cause}`,\n );\n });\n implementation.byPlugin.set(pluginId, result);\n }\n\n return result;\n });\n }\n}\n","/*\n * Copyright 2022 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 { ServiceFactory, BackendFeature } from '@backstage/backend-plugin-api';\nimport { BackendInitializer } from './BackendInitializer';\nimport { ServiceRegistry } from './ServiceRegistry';\nimport { Backend } from './types';\n\nexport class BackstageBackend implements Backend {\n #services: ServiceRegistry;\n #initializer: BackendInitializer;\n\n constructor(apiFactories: ServiceFactory[]) {\n this.#services = new ServiceRegistry(apiFactories);\n this.#initializer = new BackendInitializer(this.#services);\n }\n\n add(feature: BackendFeature): void {\n this.#initializer.add(feature);\n }\n\n async start(): Promise<void> {\n await this.#initializer.start();\n }\n\n // async stop(): Promise<void> {\n // await this.#initializer.stop();\n // }\n}\n","/*\n * Copyright 2022 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 ServiceFactory,\n BackendFeature,\n ExtensionPoint,\n ServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { BackstageBackend } from './BackstageBackend';\n\n/**\n * @public\n */\nexport interface Backend {\n add(feature: BackendFeature): void;\n start(): Promise<void>;\n}\n\nexport interface BackendRegisterInit {\n id: string;\n consumes: Set<ServiceOrExtensionPoint>;\n provides: Set<ServiceOrExtensionPoint>;\n deps: { [name: string]: ServiceOrExtensionPoint };\n init: (deps: { [name: string]: unknown }) => Promise<void>;\n}\n\n/**\n * @public\n */\nexport interface CreateSpecializedBackendOptions {\n services: (ServiceFactory | (() => ServiceFactory))[];\n}\n\nexport type ServiceHolder = {\n get<T>(api: ServiceRef<T>, pluginId: string): Promise<T> | undefined;\n};\n\n/**\n * @public\n */\nexport function createSpecializedBackend(\n options: CreateSpecializedBackendOptions,\n): Backend {\n return new BackstageBackend(\n options.services.map(s => (typeof s === 'function' ? s() : s)),\n );\n}\n\n/**\n * @public\n */\nexport type ServiceOrExtensionPoint<T = unknown> =\n | ExtensionPoint<T>\n | ServiceRef<T>;\n","/*\n * Copyright 2022 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 { CacheManager } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n pluginMetadataServiceRef,\n cacheServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const cacheFactory = createServiceFactory({\n service: cacheServiceRef,\n deps: {\n config: configServiceRef,\n plugin: pluginMetadataServiceRef,\n },\n async factory({ config }) {\n const cacheManager = CacheManager.fromConfig(config);\n return async ({ plugin }) => {\n return cacheManager.forPlugin(plugin.getId());\n };\n },\n});\n","/*\n * Copyright 2022 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 { loadBackendConfig } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n loggerToWinstonLogger,\n rootLoggerServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const configFactory = createServiceFactory({\n service: configServiceRef,\n deps: {\n logger: rootLoggerServiceRef,\n },\n async factory({ logger }) {\n const config = await loadBackendConfig({\n argv: process.argv,\n logger: loggerToWinstonLogger(logger),\n });\n return config;\n },\n});\n","/*\n * Copyright 2022 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 { DatabaseManager } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n databaseServiceRef,\n pluginMetadataServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const databaseFactory = createServiceFactory({\n service: databaseServiceRef,\n deps: {\n config: configServiceRef,\n plugin: pluginMetadataServiceRef,\n },\n async factory({ config }) {\n const databaseManager = DatabaseManager.fromConfig(config);\n return async ({ plugin }) => {\n return databaseManager.forPlugin(plugin.getId());\n };\n },\n});\n","/*\n * Copyright 2022 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 { SingleHostDiscovery } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n discoveryServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const discoveryFactory = createServiceFactory({\n service: discoveryServiceRef,\n deps: {\n config: configServiceRef,\n },\n async factory({ config }) {\n const discovery = SingleHostDiscovery.fromConfig(config);\n return async () => {\n return discovery;\n };\n },\n});\n","/*\n * Copyright 2022 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 createServiceFactory,\n loggerServiceRef,\n pluginMetadataServiceRef,\n rootLoggerServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const loggerFactory = createServiceFactory({\n service: loggerServiceRef,\n deps: {\n rootLogger: rootLoggerServiceRef,\n plugin: pluginMetadataServiceRef,\n },\n async factory({ rootLogger }) {\n return async ({ plugin }) => {\n return rootLogger.child({ pluginId: plugin.getId() });\n };\n },\n});\n","/*\n * Copyright 2022 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 { createRootLogger } from '@backstage/backend-common';\nimport {\n createServiceFactory,\n Logger,\n rootLoggerServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { Logger as WinstonLogger } from 'winston';\n\nclass BackstageLogger implements Logger {\n static fromWinston(logger: WinstonLogger): BackstageLogger {\n return new BackstageLogger(logger);\n }\n\n private constructor(private readonly winston: WinstonLogger) {}\n\n info(message: string, ...meta: any[]): void {\n this.winston.info(message, ...meta);\n }\n\n child(fields: { [name: string]: string }): Logger {\n return new BackstageLogger(this.winston.child(fields));\n }\n}\n\n/** @public */\nexport const rootLoggerFactory = createServiceFactory({\n service: rootLoggerServiceRef,\n deps: {},\n async factory() {\n return BackstageLogger.fromWinston(createRootLogger());\n },\n});\n","/*\n * Copyright 2022 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 configServiceRef,\n createServiceFactory,\n discoveryServiceRef,\n permissionsServiceRef,\n tokenManagerServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { ServerPermissionClient } from '@backstage/plugin-permission-node';\n\n/** @public */\nexport const permissionsFactory = createServiceFactory({\n service: permissionsServiceRef,\n deps: {\n config: configServiceRef,\n discovery: discoveryServiceRef,\n tokenManager: tokenManagerServiceRef,\n },\n async factory({ config }) {\n return async ({ discovery, tokenManager }) => {\n return ServerPermissionClient.fromConfig(config, {\n discovery,\n tokenManager,\n });\n };\n },\n});\n","/*\n * Copyright 2022 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 configServiceRef,\n createServiceFactory,\n pluginMetadataServiceRef,\n schedulerServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { TaskScheduler } from '@backstage/backend-tasks';\n\n/** @public */\nexport const schedulerFactory = createServiceFactory({\n service: schedulerServiceRef,\n deps: {\n config: configServiceRef,\n plugin: pluginMetadataServiceRef,\n },\n async factory({ config }) {\n const taskScheduler = TaskScheduler.fromConfig(config);\n return async ({ plugin }) => {\n return taskScheduler.forPlugin(plugin.getId());\n };\n },\n});\n","/*\n * Copyright 2022 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 configServiceRef,\n loggerServiceRef,\n createServiceFactory,\n tokenManagerServiceRef,\n loggerToWinstonLogger,\n} from '@backstage/backend-plugin-api';\nimport { ServerTokenManager } from '@backstage/backend-common';\n\n/** @public */\nexport const tokenManagerFactory = createServiceFactory({\n service: tokenManagerServiceRef,\n deps: {\n config: configServiceRef,\n logger: loggerServiceRef,\n },\n async factory() {\n return async ({ config, logger }) => {\n return ServerTokenManager.fromConfig(config, {\n logger: loggerToWinstonLogger(logger),\n });\n };\n },\n});\n","/*\n * Copyright 2022 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 { UrlReaders } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n loggerServiceRef,\n loggerToWinstonLogger,\n urlReaderServiceRef,\n} from '@backstage/backend-plugin-api';\n\n/** @public */\nexport const urlReaderFactory = createServiceFactory({\n service: urlReaderServiceRef,\n deps: {\n config: configServiceRef,\n logger: loggerServiceRef,\n },\n async factory() {\n return async ({ config, logger }) => {\n return UrlReaders.default({\n config,\n logger: loggerToWinstonLogger(logger),\n });\n };\n },\n});\n","/*\n * Copyright 2022 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 createServiceFactory,\n httpRouterServiceRef,\n configServiceRef,\n pluginMetadataServiceRef,\n} from '@backstage/backend-plugin-api';\nimport Router from 'express-promise-router';\nimport { Handler } from 'express';\nimport { createServiceBuilder } from '@backstage/backend-common';\n\n/**\n * @public\n */\nexport type HttpRouterFactoryOptions = {\n /**\n * The plugin ID used for the index route. Defaults to 'app'\n */\n indexPlugin?: string;\n};\n\n/** @public */\nexport const httpRouterFactory = createServiceFactory({\n service: httpRouterServiceRef,\n deps: {\n config: configServiceRef,\n plugin: pluginMetadataServiceRef,\n },\n async factory({ config }, options?: HttpRouterFactoryOptions) {\n const defaultPluginId = options?.indexPlugin ?? 'app';\n\n const apiRouter = Router();\n const rootRouter = Router();\n\n const service = createServiceBuilder(module)\n .loadConfig(config)\n .addRouter('/api', apiRouter)\n .addRouter('', rootRouter);\n\n await service.start();\n\n return async ({ plugin }) => {\n const pluginId = plugin.getId();\n return {\n use(handler: Handler) {\n if (pluginId === defaultPluginId) {\n rootRouter.use(handler);\n } else {\n apiRouter.use(`/${pluginId}`, handler);\n }\n },\n };\n };\n },\n});\n"],"names":["__privateAdd","__privateSet","__privateGet","__privateMethod","stringifyError","pluginMetadataServiceRef","createServiceFactory","cacheServiceRef","configServiceRef","CacheManager","rootLoggerServiceRef","loadBackendConfig","loggerToWinstonLogger","databaseServiceRef","DatabaseManager","discoveryServiceRef","SingleHostDiscovery","loggerServiceRef","createRootLogger","permissionsServiceRef","tokenManagerServiceRef","ServerPermissionClient","schedulerServiceRef","TaskScheduler","ServerTokenManager","urlReaderServiceRef","UrlReaders","httpRouterServiceRef","Router","createServiceBuilder"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,QAAA,EAAA,SAAA,EAAA,cAAA,EAAA,gBAAA,EAAA,cAAA,EAAA,YAAA,EAAA,cAAA,EAAA,iBAAA,EAAA,mBAAA,CAAA;AA2BO,MAAM,kBAAmB,CAAA;AAAA,EAO9B,YAAY,aAA8B,EAAA;AAI1C,IAAMA,cAAA,CAAA,IAAA,EAAA,YAAA,CAAA,CAAA;AAgGN,IAAAA,cAAA,CAAA,IAAA,EAAA,iBAAA,CAAA,CAAA;AA1GA,IAAWA,cAAA,CAAA,IAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA;AACX,IAAAA,cAAA,CAAA,I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
|
|
|
53
53
|
export declare const discoveryFactory: (options?: undefined) => ServiceFactory<PluginEndpointDiscovery>;
|
|
54
54
|
|
|
55
55
|
/** @public */
|
|
56
|
-
export declare const httpRouterFactory: (options?: undefined) => ServiceFactory<HttpRouterService>;
|
|
56
|
+
export declare const httpRouterFactory: (options?: HttpRouterFactoryOptions | undefined) => ServiceFactory<HttpRouterService>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
export declare type HttpRouterFactoryOptions = {
|
|
62
|
+
/**
|
|
63
|
+
* The plugin ID used for the index route. Defaults to 'app'
|
|
64
|
+
*/
|
|
65
|
+
indexPlugin?: string;
|
|
66
|
+
};
|
|
57
67
|
|
|
58
68
|
/** @public */
|
|
59
69
|
export declare const loggerFactory: (options?: undefined) => ServiceFactory<Logger>;
|
|
@@ -61,6 +71,9 @@ export declare const loggerFactory: (options?: undefined) => ServiceFactory<Logg
|
|
|
61
71
|
/** @public */
|
|
62
72
|
export declare const permissionsFactory: (options?: undefined) => ServiceFactory<PermissionAuthorizer | PermissionEvaluator>;
|
|
63
73
|
|
|
74
|
+
/** @public */
|
|
75
|
+
export declare const rootLoggerFactory: (options?: undefined) => ServiceFactory<Logger>;
|
|
76
|
+
|
|
64
77
|
/** @public */
|
|
65
78
|
export declare const schedulerFactory: (options?: undefined) => ServiceFactory<PluginTaskScheduler>;
|
|
66
79
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-app-api",
|
|
3
3
|
"description": "Core API used by Backstage backend apps",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2-next.0",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"publishConfig": {
|
|
@@ -33,21 +33,20 @@
|
|
|
33
33
|
"start": "backstage-cli package start"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@backstage/backend-common": "^0.15.
|
|
37
|
-
"@backstage/backend-plugin-api": "^0.1.
|
|
38
|
-
"@backstage/backend-tasks": "^0.3.
|
|
39
|
-
"@backstage/errors": "^1.1.
|
|
40
|
-
"@backstage/plugin-permission-node": "^0.6.
|
|
36
|
+
"@backstage/backend-common": "^0.15.2-next.0",
|
|
37
|
+
"@backstage/backend-plugin-api": "^0.1.3-next.0",
|
|
38
|
+
"@backstage/backend-tasks": "^0.3.6-next.0",
|
|
39
|
+
"@backstage/errors": "^1.1.2-next.0",
|
|
40
|
+
"@backstage/plugin-permission-node": "^0.6.6-next.0",
|
|
41
41
|
"express": "^4.17.1",
|
|
42
42
|
"express-promise-router": "^4.1.0",
|
|
43
43
|
"winston": "^3.2.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@backstage/cli": "^0.
|
|
46
|
+
"@backstage/cli": "^0.20.0-next.0"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
49
|
"dist",
|
|
50
50
|
"alpha"
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
}
|
|
51
|
+
]
|
|
52
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2020 The Backstage Authors
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|