@backstage/backend-app-api 0.0.0-nightly-20220709024234

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 ADDED
@@ -0,0 +1,17 @@
1
+ # @backstage/backend-app-api
2
+
3
+ ## 0.0.0-nightly-20220709024234
4
+
5
+ ### Minor Changes
6
+
7
+ - 91c1d12123: Add initial plumbing for creating backends using the experimental backend framework.
8
+
9
+ This package is highly **EXPERIMENTAL** and should not be used in production.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+ - @backstage/backend-plugin-api@0.0.0-nightly-20220709024234
15
+ - @backstage/backend-common@0.0.0-nightly-20220709024234
16
+ - @backstage/plugin-permission-node@0.0.0-nightly-20220709024234
17
+ - @backstage/backend-tasks@0.0.0-nightly-20220709024234
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @backstage/backend-app-api
2
+
3
+ **This package is HIGHLY EXPERIMENTAL, do not use this for production**
4
+
5
+ This package provides the core API used by Backstage backend apps.
6
+
7
+ ## Installation
8
+
9
+ Add the library to your backend app package:
10
+
11
+ ```bash
12
+ # From your Backstage root directory
13
+ yarn add --cwd packages/backend @backstage/backend-app-api
14
+ ```
15
+
16
+ ## Documentation
17
+
18
+ - [Backstage Readme](https://github.com/backstage/backstage/blob/master/README.md)
19
+ - [Backstage Documentation](https://github.com/backstage/backstage/blob/master/docs/README.md)
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@backstage/backend-app-api",
3
+ "version": "0.0.0-nightly-20220709024234",
4
+ "main": "../dist/index.cjs.js",
5
+ "types": "../dist/index.alpha.d.ts"
6
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Core API used by Backstage backend apps.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { AnyServiceFactory } from '@backstage/backend-plugin-api';
8
+ import { BackendRegistrable } from '@backstage/backend-plugin-api';
9
+
10
+ /**
11
+ * @public
12
+ */
13
+ export declare interface Backend {
14
+ add(extension: BackendRegistrable): void;
15
+ start(): Promise<void>;
16
+ }
17
+
18
+ /**
19
+ * @public
20
+ */
21
+ export declare function createBackend(options?: CreateBackendOptions): Backend;
22
+
23
+ /**
24
+ * @public
25
+ */
26
+ export declare interface CreateBackendOptions {
27
+ apis: AnyServiceFactory[];
28
+ }
29
+
30
+ export { }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Core API used by Backstage backend apps.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { AnyServiceFactory } from '@backstage/backend-plugin-api';
8
+ import { BackendRegistrable } from '@backstage/backend-plugin-api';
9
+
10
+ /**
11
+ * @public
12
+ */
13
+ export declare interface Backend {
14
+ add(extension: BackendRegistrable): void;
15
+ start(): Promise<void>;
16
+ }
17
+
18
+ /**
19
+ * @public
20
+ */
21
+ export declare function createBackend(options?: CreateBackendOptions): Backend;
22
+
23
+ /**
24
+ * @public
25
+ */
26
+ export declare interface CreateBackendOptions {
27
+ apis: AnyServiceFactory[];
28
+ }
29
+
30
+ export { }
@@ -0,0 +1,426 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var backendCommon = require('@backstage/backend-common');
6
+ var backendPluginApi = require('@backstage/backend-plugin-api');
7
+ var pluginPermissionNode = require('@backstage/plugin-permission-node');
8
+ var backendTasks = require('@backstage/backend-tasks');
9
+ var Router = require('express-promise-router');
10
+
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+
13
+ var Router__default = /*#__PURE__*/_interopDefaultLegacy(Router);
14
+
15
+ const cacheFactory = backendPluginApi.createServiceFactory({
16
+ service: backendPluginApi.cacheServiceRef,
17
+ deps: {
18
+ configFactory: backendPluginApi.configServiceRef
19
+ },
20
+ factory: async ({ configFactory }) => {
21
+ const config = await configFactory("root");
22
+ const cacheManager = backendCommon.CacheManager.fromConfig(config);
23
+ return async (pluginId) => {
24
+ return cacheManager.forPlugin(pluginId);
25
+ };
26
+ }
27
+ });
28
+
29
+ const configFactory = backendPluginApi.createServiceFactory({
30
+ service: backendPluginApi.configServiceRef,
31
+ deps: {
32
+ loggerFactory: backendPluginApi.loggerServiceRef
33
+ },
34
+ factory: async ({ loggerFactory }) => {
35
+ const logger = await loggerFactory("root");
36
+ const config = await backendCommon.loadBackendConfig({
37
+ argv: process.argv,
38
+ logger: backendPluginApi.loggerToWinstonLogger(logger)
39
+ });
40
+ return async () => {
41
+ return config;
42
+ };
43
+ }
44
+ });
45
+
46
+ const databaseFactory = backendPluginApi.createServiceFactory({
47
+ service: backendPluginApi.databaseServiceRef,
48
+ deps: {
49
+ configFactory: backendPluginApi.configServiceRef
50
+ },
51
+ factory: async ({ configFactory }) => {
52
+ const config = await configFactory("root");
53
+ const databaseManager = backendCommon.DatabaseManager.fromConfig(config);
54
+ return async (pluginId) => {
55
+ return databaseManager.forPlugin(pluginId);
56
+ };
57
+ }
58
+ });
59
+
60
+ const discoveryFactory = backendPluginApi.createServiceFactory({
61
+ service: backendPluginApi.discoveryServiceRef,
62
+ deps: {
63
+ configFactory: backendPluginApi.configServiceRef
64
+ },
65
+ factory: async ({ configFactory }) => {
66
+ const config = await configFactory("root");
67
+ const discovery = backendCommon.SingleHostDiscovery.fromConfig(config);
68
+ return async () => {
69
+ return discovery;
70
+ };
71
+ }
72
+ });
73
+
74
+ class BackstageLogger {
75
+ constructor(winston) {
76
+ this.winston = winston;
77
+ }
78
+ static fromWinston(logger) {
79
+ return new BackstageLogger(logger);
80
+ }
81
+ info(message, ...meta) {
82
+ this.winston.info(message, ...meta);
83
+ }
84
+ child(fields) {
85
+ return new BackstageLogger(this.winston.child(fields));
86
+ }
87
+ }
88
+ const loggerFactory = backendPluginApi.createServiceFactory({
89
+ service: backendPluginApi.loggerServiceRef,
90
+ deps: {},
91
+ factory: async () => {
92
+ const root = BackstageLogger.fromWinston(backendCommon.createRootLogger());
93
+ return async (pluginId) => {
94
+ return root.child({ pluginId });
95
+ };
96
+ }
97
+ });
98
+
99
+ const permissionsFactory = backendPluginApi.createServiceFactory({
100
+ service: backendPluginApi.permissionsServiceRef,
101
+ deps: {
102
+ configFactory: backendPluginApi.configServiceRef,
103
+ discoveryFactory: backendPluginApi.discoveryServiceRef,
104
+ tokenManagerFactory: backendPluginApi.tokenManagerServiceRef
105
+ },
106
+ factory: async ({ configFactory, discoveryFactory, tokenManagerFactory }) => {
107
+ const config = await configFactory("root");
108
+ const discovery = await discoveryFactory("root");
109
+ const tokenManager = await tokenManagerFactory("root");
110
+ const permissions = pluginPermissionNode.ServerPermissionClient.fromConfig(config, {
111
+ discovery,
112
+ tokenManager
113
+ });
114
+ return async (_pluginId) => {
115
+ return permissions;
116
+ };
117
+ }
118
+ });
119
+
120
+ const schedulerFactory = backendPluginApi.createServiceFactory({
121
+ service: backendPluginApi.schedulerServiceRef,
122
+ deps: {
123
+ configFactory: backendPluginApi.configServiceRef
124
+ },
125
+ factory: async ({ configFactory }) => {
126
+ const config = await configFactory("root");
127
+ const taskScheduler = backendTasks.TaskScheduler.fromConfig(config);
128
+ return async (pluginId) => {
129
+ return taskScheduler.forPlugin(pluginId);
130
+ };
131
+ }
132
+ });
133
+
134
+ const tokenManagerFactory = backendPluginApi.createServiceFactory({
135
+ service: backendPluginApi.tokenManagerServiceRef,
136
+ deps: {
137
+ configFactory: backendPluginApi.configServiceRef,
138
+ loggerFactory: backendPluginApi.loggerServiceRef
139
+ },
140
+ factory: async ({ configFactory, loggerFactory }) => {
141
+ const logger = await loggerFactory("root");
142
+ const config = await configFactory("root");
143
+ return async (_pluginId) => {
144
+ return backendCommon.ServerTokenManager.fromConfig(config, {
145
+ logger: backendPluginApi.loggerToWinstonLogger(logger)
146
+ });
147
+ };
148
+ }
149
+ });
150
+
151
+ const urlReaderFactory = backendPluginApi.createServiceFactory({
152
+ service: backendPluginApi.urlReaderServiceRef,
153
+ deps: {
154
+ configFactory: backendPluginApi.configServiceRef,
155
+ loggerFactory: backendPluginApi.loggerServiceRef
156
+ },
157
+ factory: async ({ configFactory, loggerFactory }) => {
158
+ return async (pluginId) => {
159
+ const logger = await loggerFactory(pluginId);
160
+ return backendCommon.UrlReaders.default({
161
+ logger: backendPluginApi.loggerToWinstonLogger(logger),
162
+ config: await configFactory(pluginId)
163
+ });
164
+ };
165
+ }
166
+ });
167
+
168
+ const httpRouterFactory = backendPluginApi.createServiceFactory({
169
+ service: backendPluginApi.httpRouterServiceRef,
170
+ deps: {
171
+ configFactory: backendPluginApi.configServiceRef
172
+ },
173
+ factory: async ({ configFactory }) => {
174
+ const rootRouter = Router__default["default"]();
175
+ const service = backendCommon.createServiceBuilder(module).loadConfig(await configFactory("root")).addRouter("", rootRouter);
176
+ await service.start();
177
+ return async (pluginId) => {
178
+ const path = pluginId ? `/api/${pluginId}` : "";
179
+ return {
180
+ use(handler) {
181
+ rootRouter.use(path, handler);
182
+ }
183
+ };
184
+ };
185
+ }
186
+ });
187
+
188
+ const defaultServiceFactories = [
189
+ cacheFactory,
190
+ configFactory,
191
+ databaseFactory,
192
+ discoveryFactory,
193
+ loggerFactory,
194
+ permissionsFactory,
195
+ schedulerFactory,
196
+ tokenManagerFactory,
197
+ urlReaderFactory,
198
+ httpRouterFactory
199
+ ];
200
+
201
+ var __accessCheck$2 = (obj, member, msg) => {
202
+ if (!member.has(obj))
203
+ throw TypeError("Cannot " + msg);
204
+ };
205
+ var __privateGet$2 = (obj, member, getter) => {
206
+ __accessCheck$2(obj, member, "read from private field");
207
+ return getter ? getter.call(obj) : member.get(obj);
208
+ };
209
+ var __privateAdd$2 = (obj, member, value) => {
210
+ if (member.has(obj))
211
+ throw TypeError("Cannot add the same private member more than once");
212
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
213
+ };
214
+ var __privateSet$2 = (obj, member, value, setter) => {
215
+ __accessCheck$2(obj, member, "write to private field");
216
+ setter ? setter.call(obj, value) : member.set(obj, value);
217
+ return value;
218
+ };
219
+ var __privateMethod = (obj, member, method) => {
220
+ __accessCheck$2(obj, member, "access private method");
221
+ return method;
222
+ };
223
+ var _started, _extensions, _registerInits, _extensionPoints, _serviceHolder, _getInitDeps, getInitDeps_fn, _resolveInitOrder, resolveInitOrder_fn;
224
+ class BackendInitializer {
225
+ constructor(serviceHolder) {
226
+ __privateAdd$2(this, _getInitDeps);
227
+ __privateAdd$2(this, _resolveInitOrder);
228
+ __privateAdd$2(this, _started, false);
229
+ __privateAdd$2(this, _extensions, /* @__PURE__ */ new Map());
230
+ __privateAdd$2(this, _registerInits, new Array());
231
+ __privateAdd$2(this, _extensionPoints, /* @__PURE__ */ new Map());
232
+ __privateAdd$2(this, _serviceHolder, void 0);
233
+ __privateSet$2(this, _serviceHolder, serviceHolder);
234
+ }
235
+ add(extension, options) {
236
+ if (__privateGet$2(this, _started)) {
237
+ throw new Error("extension can not be added after the backend has started");
238
+ }
239
+ __privateGet$2(this, _extensions).set(extension, options);
240
+ }
241
+ async start() {
242
+ console.log(`Starting backend`);
243
+ if (__privateGet$2(this, _started)) {
244
+ throw new Error("Backend has already started");
245
+ }
246
+ __privateSet$2(this, _started, true);
247
+ for (const [extension] of __privateGet$2(this, _extensions)) {
248
+ const provides = /* @__PURE__ */ new Set();
249
+ let registerInit = void 0;
250
+ console.log("Registering", extension.id);
251
+ extension.register({
252
+ registerExtensionPoint: (extensionPointRef, impl) => {
253
+ if (registerInit) {
254
+ throw new Error("registerExtensionPoint called after registerInit");
255
+ }
256
+ if (__privateGet$2(this, _extensionPoints).has(extensionPointRef)) {
257
+ throw new Error(`API ${extensionPointRef.id} already registered`);
258
+ }
259
+ __privateGet$2(this, _extensionPoints).set(extensionPointRef, impl);
260
+ provides.add(extensionPointRef);
261
+ },
262
+ registerInit: (registerOptions) => {
263
+ if (registerInit) {
264
+ throw new Error("registerInit must only be called once");
265
+ }
266
+ registerInit = {
267
+ id: extension.id,
268
+ provides,
269
+ consumes: new Set(Object.values(registerOptions.deps)),
270
+ deps: registerOptions.deps,
271
+ init: registerOptions.init
272
+ };
273
+ }
274
+ });
275
+ if (!registerInit) {
276
+ throw new Error(`registerInit was not called by register in ${extension.id}`);
277
+ }
278
+ __privateGet$2(this, _registerInits).push(registerInit);
279
+ }
280
+ this.validateSetup();
281
+ const orderedRegisterResults = __privateMethod(this, _resolveInitOrder, resolveInitOrder_fn).call(this, __privateGet$2(this, _registerInits));
282
+ for (const registerInit of orderedRegisterResults) {
283
+ const deps = await __privateMethod(this, _getInitDeps, getInitDeps_fn).call(this, registerInit.deps, registerInit.id);
284
+ await registerInit.init(deps);
285
+ }
286
+ }
287
+ validateSetup() {
288
+ }
289
+ }
290
+ _started = new WeakMap();
291
+ _extensions = new WeakMap();
292
+ _registerInits = new WeakMap();
293
+ _extensionPoints = new WeakMap();
294
+ _serviceHolder = new WeakMap();
295
+ _getInitDeps = new WeakSet();
296
+ getInitDeps_fn = async function(deps, pluginId) {
297
+ return Object.fromEntries(await Promise.all(Object.entries(deps).map(async ([name, ref]) => [
298
+ name,
299
+ __privateGet$2(this, _extensionPoints).get(ref) || await __privateGet$2(this, _serviceHolder).get(ref)(pluginId)
300
+ ])));
301
+ };
302
+ _resolveInitOrder = new WeakSet();
303
+ resolveInitOrder_fn = function(registerInits) {
304
+ let registerInitsToOrder = registerInits.slice();
305
+ const orderedRegisterInits = new Array();
306
+ while (registerInitsToOrder.length > 0) {
307
+ const toRemove = /* @__PURE__ */ new Set();
308
+ for (const registerInit of registerInitsToOrder) {
309
+ const unInitializedDependents = [];
310
+ for (const serviceRef of registerInit.provides) {
311
+ if (registerInitsToOrder.some((init) => init !== registerInit && init.consumes.has(serviceRef))) {
312
+ unInitializedDependents.push(serviceRef);
313
+ }
314
+ }
315
+ if (unInitializedDependents.length === 0) {
316
+ console.log(`DEBUG: pushed ${registerInit.id} to results`);
317
+ orderedRegisterInits.push(registerInit);
318
+ toRemove.add(registerInit);
319
+ }
320
+ }
321
+ registerInitsToOrder = registerInitsToOrder.filter((r) => !toRemove.has(r));
322
+ }
323
+ return orderedRegisterInits;
324
+ };
325
+
326
+ var __accessCheck$1 = (obj, member, msg) => {
327
+ if (!member.has(obj))
328
+ throw TypeError("Cannot " + msg);
329
+ };
330
+ var __privateGet$1 = (obj, member, getter) => {
331
+ __accessCheck$1(obj, member, "read from private field");
332
+ return getter ? getter.call(obj) : member.get(obj);
333
+ };
334
+ var __privateAdd$1 = (obj, member, value) => {
335
+ if (member.has(obj))
336
+ throw TypeError("Cannot add the same private member more than once");
337
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
338
+ };
339
+ var __privateSet$1 = (obj, member, value, setter) => {
340
+ __accessCheck$1(obj, member, "write to private field");
341
+ setter ? setter.call(obj, value) : member.set(obj, value);
342
+ return value;
343
+ };
344
+ var _implementations, _factories;
345
+ class ServiceRegistry {
346
+ constructor(factories) {
347
+ __privateAdd$1(this, _implementations, void 0);
348
+ __privateAdd$1(this, _factories, void 0);
349
+ __privateSet$1(this, _factories, new Map(factories.map((f) => [f.service.id, f])));
350
+ __privateSet$1(this, _implementations, /* @__PURE__ */ new Map());
351
+ }
352
+ get(ref) {
353
+ const factory = __privateGet$1(this, _factories).get(ref.id);
354
+ if (!factory) {
355
+ return void 0;
356
+ }
357
+ return async (pluginId) => {
358
+ let implementations = __privateGet$1(this, _implementations).get(ref.id);
359
+ if (implementations) {
360
+ if (implementations.has(pluginId)) {
361
+ return implementations.get(pluginId);
362
+ }
363
+ } else {
364
+ implementations = /* @__PURE__ */ new Map();
365
+ __privateGet$1(this, _implementations).set(ref.id, implementations);
366
+ }
367
+ const factoryDeps = Object.fromEntries(Object.entries(factory.deps).map(([name, serviceRef]) => [
368
+ name,
369
+ this.get(serviceRef)
370
+ ]));
371
+ const factoryFunc = await factory.factory(factoryDeps);
372
+ const implementation = await factoryFunc(pluginId);
373
+ implementations.set(pluginId, implementation);
374
+ return implementation;
375
+ };
376
+ }
377
+ }
378
+ _implementations = new WeakMap();
379
+ _factories = new WeakMap();
380
+
381
+ var __accessCheck = (obj, member, msg) => {
382
+ if (!member.has(obj))
383
+ throw TypeError("Cannot " + msg);
384
+ };
385
+ var __privateGet = (obj, member, getter) => {
386
+ __accessCheck(obj, member, "read from private field");
387
+ return getter ? getter.call(obj) : member.get(obj);
388
+ };
389
+ var __privateAdd = (obj, member, value) => {
390
+ if (member.has(obj))
391
+ throw TypeError("Cannot add the same private member more than once");
392
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
393
+ };
394
+ var __privateSet = (obj, member, value, setter) => {
395
+ __accessCheck(obj, member, "write to private field");
396
+ setter ? setter.call(obj, value) : member.set(obj, value);
397
+ return value;
398
+ };
399
+ var _services, _initializer;
400
+ class BackstageBackend {
401
+ constructor(apiFactories) {
402
+ __privateAdd(this, _services, void 0);
403
+ __privateAdd(this, _initializer, void 0);
404
+ __privateSet(this, _services, new ServiceRegistry(apiFactories));
405
+ __privateSet(this, _initializer, new BackendInitializer(__privateGet(this, _services)));
406
+ }
407
+ add(extension) {
408
+ __privateGet(this, _initializer).add(extension);
409
+ }
410
+ async start() {
411
+ await __privateGet(this, _initializer).start();
412
+ }
413
+ }
414
+ _services = new WeakMap();
415
+ _initializer = new WeakMap();
416
+
417
+ function createBackend(options) {
418
+ var _a;
419
+ return new BackstageBackend([
420
+ ...defaultServiceFactories,
421
+ ...(_a = options == null ? void 0 : options.apis) != null ? _a : []
422
+ ]);
423
+ }
424
+
425
+ exports.createBackend = createBackend;
426
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../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","../src/services/implementations/index.ts","../src/wiring/BackendInitializer.ts","../src/wiring/ServiceRegistry.ts","../src/wiring/BackstageBackend.ts","../src/wiring/types.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 { CacheManager } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n cacheServiceRef,\n} from '@backstage/backend-plugin-api';\n\n// TODO: Work out some naming and implementation patterns for these\nexport const cacheFactory = createServiceFactory({\n service: cacheServiceRef,\n deps: {\n configFactory: configServiceRef,\n },\n factory: async ({ configFactory }) => {\n const config = await configFactory('root');\n const cacheManager = CacheManager.fromConfig(config);\n return async (pluginId: string) => {\n return cacheManager.forPlugin(pluginId);\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 loggerServiceRef,\n} from '@backstage/backend-plugin-api';\n\nexport const configFactory = createServiceFactory({\n service: configServiceRef,\n deps: {\n loggerFactory: loggerServiceRef,\n },\n factory: async ({ loggerFactory }) => {\n const logger = await loggerFactory('root');\n const config = await loadBackendConfig({\n argv: process.argv,\n logger: loggerToWinstonLogger(logger),\n });\n return async () => {\n return config;\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 { DatabaseManager } from '@backstage/backend-common';\nimport {\n configServiceRef,\n createServiceFactory,\n databaseServiceRef,\n} from '@backstage/backend-plugin-api';\n\nexport const databaseFactory = createServiceFactory({\n service: databaseServiceRef,\n deps: {\n configFactory: configServiceRef,\n },\n factory: async ({ configFactory }) => {\n const config = await configFactory('root');\n const databaseManager = DatabaseManager.fromConfig(config);\n return async (pluginId: string) => {\n return databaseManager.forPlugin(pluginId);\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\nexport const discoveryFactory = createServiceFactory({\n service: discoveryServiceRef,\n deps: {\n configFactory: configServiceRef,\n },\n factory: async ({ configFactory }) => {\n const config = await configFactory('root');\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 { createRootLogger } from '@backstage/backend-common';\nimport {\n createServiceFactory,\n Logger,\n loggerServiceRef,\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\nexport const loggerFactory = createServiceFactory({\n service: loggerServiceRef,\n deps: {},\n factory: async () => {\n const root = BackstageLogger.fromWinston(createRootLogger());\n return async (pluginId: string) => {\n return root.child({ pluginId });\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\nexport const permissionsFactory = createServiceFactory({\n service: permissionsServiceRef,\n deps: {\n configFactory: configServiceRef,\n discoveryFactory: discoveryServiceRef,\n tokenManagerFactory: tokenManagerServiceRef,\n },\n factory: async ({ configFactory, discoveryFactory, tokenManagerFactory }) => {\n const config = await configFactory('root');\n const discovery = await discoveryFactory('root');\n const tokenManager = await tokenManagerFactory('root');\n const permissions = ServerPermissionClient.fromConfig(config, {\n discovery,\n tokenManager,\n });\n return async (_pluginId: string) => {\n return permissions;\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 schedulerServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { TaskScheduler } from '@backstage/backend-tasks';\n\nexport const schedulerFactory = createServiceFactory({\n service: schedulerServiceRef,\n deps: {\n configFactory: configServiceRef,\n },\n factory: async ({ configFactory }) => {\n const config = await configFactory('root');\n const taskScheduler = TaskScheduler.fromConfig(config);\n return async (pluginId: string) => {\n return taskScheduler.forPlugin(pluginId);\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\nexport const tokenManagerFactory = createServiceFactory({\n service: tokenManagerServiceRef,\n deps: {\n configFactory: configServiceRef,\n loggerFactory: loggerServiceRef,\n },\n factory: async ({ configFactory, loggerFactory }) => {\n const logger = await loggerFactory('root');\n const config = await configFactory('root');\n return async (_pluginId: string) => {\n // doesn't the logger want to be inferred from the plugin tho here?\n // maybe ... also why do we recreate it every time otherwise\n // we should memoize on a per plugin right? so I think it's should be fine to re-use the plugin one\n // we shouldn't recreate on a per plugin basis.\n // hm - on the other hand, is this really ever called more than once?\n // not this function right. should only be called when the plugin requests this serviceRef\n // yeah so no need to worry about memo probably\n // but we still want to scope the logger to the ServrTokenmanagfer>?\n // mm sure maybe\n // maybe in this case it doesn't provide so much value b\n // oh hang on - isn't it up to THE MANAGER to make a child internally if it wants to do that\n // so that it becomes a property intrinsic to that class, no matter how it's constructed\n // or is that too much responsibility for it - making the constructor complex so to speak, making it harder to tweak that behavior\n // this is not ultra efficient :)\n\n // I think the naming here is wrong to be gonest\n // this isn't like the cache manager or the database manager\n // the manager name is confusuion i think\n // aye perhaps\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\nexport const urlReaderFactory = createServiceFactory({\n service: urlReaderServiceRef,\n deps: {\n configFactory: configServiceRef,\n loggerFactory: loggerServiceRef,\n },\n factory: async ({ configFactory, loggerFactory }) => {\n return async (pluginId: string) => {\n const logger = await loggerFactory(pluginId);\n return UrlReaders.default({\n logger: loggerToWinstonLogger(logger),\n config: await configFactory(pluginId),\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} from '@backstage/backend-plugin-api';\nimport Router from 'express-promise-router';\nimport { Handler } from 'express';\nimport { createServiceBuilder } from '@backstage/backend-common';\n\nexport const httpRouterFactory = createServiceFactory({\n service: httpRouterServiceRef,\n deps: {\n configFactory: configServiceRef,\n },\n factory: async ({ configFactory }) => {\n const rootRouter = Router();\n\n const service = createServiceBuilder(module)\n .loadConfig(await configFactory('root'))\n .addRouter('', rootRouter);\n\n await service.start();\n\n return async (pluginId?: string) => {\n const path = pluginId ? `/api/${pluginId}` : '';\n return {\n use(handler: Handler) {\n rootRouter.use(path, handler);\n },\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 { cacheFactory } from './cacheService';\nimport { configFactory } from './configService';\nimport { databaseFactory } from './databaseService';\nimport { discoveryFactory } from './discoveryService';\nimport { loggerFactory } from './loggerService';\nimport { permissionsFactory } from './permissionsService';\nimport { schedulerFactory } from './schedulerService';\nimport { tokenManagerFactory } from './tokenManagerService';\nimport { urlReaderFactory } from './urlReaderService';\nimport { httpRouterFactory } from './httpRouterService';\n\nexport const defaultServiceFactories = [\n cacheFactory,\n configFactory,\n databaseFactory,\n discoveryFactory,\n loggerFactory,\n permissionsFactory,\n schedulerFactory,\n tokenManagerFactory,\n urlReaderFactory,\n httpRouterFactory,\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 BackendRegistrable,\n ExtensionPoint,\n ServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { BackendRegisterInit, ServiceHolder } from './types';\n\ntype ServiceOrExtensionPoint = ExtensionPoint<unknown> | ServiceRef<unknown>;\n\nexport class BackendInitializer {\n #started = false;\n #extensions = new Map<BackendRegistrable, unknown>();\n #registerInits = new Array<BackendRegisterInit>();\n #extensionPoints = new Map<ServiceOrExtensionPoint, 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 return Object.fromEntries(\n await Promise.all(\n Object.entries(deps).map(async ([name, ref]) => [\n name,\n this.#extensionPoints.get(ref) ||\n (await this.#serviceHolder.get(ref as ServiceRef<unknown>)!(\n pluginId,\n )),\n ]),\n ),\n );\n }\n\n add<TOptions>(extension: BackendRegistrable, options?: TOptions) {\n if (this.#started) {\n throw new Error(\n 'extension can not be added after the backend has started',\n );\n }\n this.#extensions.set(extension, options);\n }\n\n async start(): Promise<void> {\n console.log(`Starting backend`);\n if (this.#started) {\n throw new Error('Backend has already started');\n }\n this.#started = true;\n\n for (const [extension] of this.#extensions) {\n const provides = new Set<ServiceRef<unknown>>();\n\n let registerInit: BackendRegisterInit | undefined = undefined;\n\n console.log('Registering', extension.id);\n extension.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: extension.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 ${extension.id}`,\n );\n }\n\n this.#registerInits.push(registerInit);\n }\n\n this.validateSetup();\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 private validateSetup() {}\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 serviceRef of registerInit.provides) {\n if (\n registerInitsToOrder.some(\n init => init !== registerInit && init.consumes.has(serviceRef),\n )\n ) {\n unInitializedDependents.push(serviceRef);\n }\n }\n\n if (unInitializedDependents.length === 0) {\n console.log(`DEBUG: pushed ${registerInit.id} to results`);\n orderedRegisterInits.push(registerInit);\n toRemove.add(registerInit);\n }\n }\n\n registerInitsToOrder = registerInitsToOrder.filter(r => !toRemove.has(r));\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 */\nimport {\n AnyServiceFactory,\n FactoryFunc,\n ServiceRef,\n} from '@backstage/backend-plugin-api';\n\nexport class ServiceRegistry {\n readonly #implementations: Map<string, Map<string, unknown>>;\n readonly #factories: Map<string, AnyServiceFactory>;\n\n constructor(factories: AnyServiceFactory[]) {\n this.#factories = new Map(factories.map(f => [f.service.id, f]));\n this.#implementations = new Map();\n }\n\n get<T>(ref: ServiceRef<T>): FactoryFunc<T> | undefined {\n const factory = this.#factories.get(ref.id);\n if (!factory) {\n return undefined;\n }\n\n return async (pluginId: string): Promise<T> => {\n let implementations = this.#implementations.get(ref.id);\n if (implementations) {\n if (implementations.has(pluginId)) {\n return implementations.get(pluginId) as T;\n }\n } else {\n implementations = new Map();\n this.#implementations.set(ref.id, implementations);\n }\n\n const factoryDeps = Object.fromEntries(\n Object.entries(factory.deps).map(([name, serviceRef]) => [\n name,\n this.get(serviceRef)!, // TODO: throw\n ]),\n );\n\n const factoryFunc = await factory.factory(factoryDeps);\n const implementation = await factoryFunc(pluginId);\n\n implementations.set(pluginId, implementation);\n\n return implementation as T;\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 AnyServiceFactory,\n BackendRegistrable,\n} 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: AnyServiceFactory[]) {\n this.#services = new ServiceRegistry(apiFactories);\n this.#initializer = new BackendInitializer(this.#services);\n }\n\n add(extension: BackendRegistrable): void {\n this.#initializer.add(extension);\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 AnyServiceFactory,\n BackendRegistrable,\n FactoryFunc,\n ServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { defaultServiceFactories } from '../services/implementations';\nimport { BackstageBackend } from './BackstageBackend';\n\n/**\n * @public\n */\nexport interface Backend {\n add(extension: BackendRegistrable): void;\n start(): Promise<void>;\n}\n\nexport interface BackendRegisterInit {\n id: string;\n consumes: Set<ServiceRef<unknown>>;\n provides: Set<ServiceRef<unknown>>;\n deps: { [name: string]: ServiceRef<unknown> };\n init: (deps: { [name: string]: unknown }) => Promise<void>;\n}\n\n/**\n * @public\n */\nexport interface CreateBackendOptions {\n apis: AnyServiceFactory[];\n}\n\nexport type ServiceHolder = {\n get<T>(api: ServiceRef<T>): FactoryFunc<T> | undefined;\n};\n\n/**\n * @public\n */\nexport function createBackend(options?: CreateBackendOptions): Backend {\n // TODO: merge with provided APIs\n return new BackstageBackend([\n ...defaultServiceFactories,\n ...(options?.apis ?? []),\n ]);\n}\n"],"names":["createServiceFactory","cacheServiceRef","configServiceRef","CacheManager","loggerServiceRef","loadBackendConfig","loggerToWinstonLogger","databaseServiceRef","DatabaseManager","discoveryServiceRef","SingleHostDiscovery","createRootLogger","permissionsServiceRef","tokenManagerServiceRef","ServerPermissionClient","schedulerServiceRef","TaskScheduler","ServerTokenManager","urlReaderServiceRef","UrlReaders","httpRouterServiceRef","Router","createServiceBuilder","__accessCheck","__privateGet","__privateAdd","__privateSet"],"mappings":";;;;;;;;;;;;;;AAMO,MAAM,YAAY,GAAGA,qCAAoB,CAAC;AACjD,EAAE,OAAO,EAAEC,gCAAe;AAC1B,EAAE,IAAI,EAAE;AACR,IAAI,aAAa,EAAEC,iCAAgB;AACnC,GAAG;AACH,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK;AACxC,IAAI,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;AAC/C,IAAI,MAAM,YAAY,GAAGC,0BAAY,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACzD,IAAI,OAAO,OAAO,QAAQ,KAAK;AAC/B,MAAM,OAAO,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC9C,KAAK,CAAC;AACN,GAAG;AACH,CAAC,CAAC;;ACXK,MAAM,aAAa,GAAGH,qCAAoB,CAAC;AAClD,EAAE,OAAO,EAAEE,iCAAgB;AAC3B,EAAE,IAAI,EAAE;AACR,IAAI,aAAa,EAAEE,iCAAgB;AACnC,GAAG;AACH,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK;AACxC,IAAI,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,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,EAAE;;AClCrB,SAAS,aAAa,CAAC,OAAO,EAAE;AACvC,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,OAAO,IAAI,gBAAgB,CAAC;AAC9B,IAAI,GAAG,uBAAuB;AAC9B,IAAI,GAAG,CAAC,EAAE,GAAG,OAAO,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,IAAI,GAAG,EAAE,GAAG,EAAE;AACvE,GAAG,CAAC,CAAC;AACL;;;;"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Core API used by Backstage backend apps.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { AnyServiceFactory } from '@backstage/backend-plugin-api';
8
+ import { BackendRegistrable } from '@backstage/backend-plugin-api';
9
+
10
+ /**
11
+ * @public
12
+ */
13
+ export declare interface Backend {
14
+ add(extension: BackendRegistrable): void;
15
+ start(): Promise<void>;
16
+ }
17
+
18
+ /**
19
+ * @public
20
+ */
21
+ export declare function createBackend(options?: CreateBackendOptions): Backend;
22
+
23
+ /**
24
+ * @public
25
+ */
26
+ export declare interface CreateBackendOptions {
27
+ apis: AnyServiceFactory[];
28
+ }
29
+
30
+ export { }
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@backstage/backend-app-api",
3
+ "description": "Core API used by Backstage backend apps",
4
+ "version": "0.0.0-nightly-20220709024234",
5
+ "main": "dist/index.cjs.js",
6
+ "types": "dist/index.d.ts",
7
+ "private": false,
8
+ "publishConfig": {
9
+ "access": "public",
10
+ "main": "dist/index.cjs.js",
11
+ "types": "dist/index.d.ts",
12
+ "alphaTypes": "dist/index.alpha.d.ts"
13
+ },
14
+ "backstage": {
15
+ "role": "node-library"
16
+ },
17
+ "homepage": "https://backstage.io",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/backstage/backstage",
21
+ "directory": "packages/backend-app-api"
22
+ },
23
+ "keywords": [
24
+ "backstage"
25
+ ],
26
+ "license": "Apache-2.0",
27
+ "scripts": {
28
+ "build": "backstage-cli package build --experimental-type-build",
29
+ "lint": "backstage-cli package lint",
30
+ "test": "backstage-cli package test",
31
+ "prepack": "backstage-cli package prepack",
32
+ "postpack": "backstage-cli package postpack",
33
+ "clean": "backstage-cli package clean",
34
+ "start": "backstage-cli package start"
35
+ },
36
+ "dependencies": {
37
+ "@backstage/backend-plugin-api": "0.0.0-nightly-20220709024234",
38
+ "@backstage/backend-common": "0.0.0-nightly-20220709024234",
39
+ "@backstage/backend-tasks": "0.0.0-nightly-20220709024234",
40
+ "@backstage/plugin-permission-node": "0.0.0-nightly-20220709024234",
41
+ "express": "^4.17.1",
42
+ "express-promise-router": "^4.1.0",
43
+ "winston": "^3.2.1"
44
+ },
45
+ "devDependencies": {
46
+ "@backstage/cli": "0.0.0-nightly-20220709024234"
47
+ },
48
+ "files": [
49
+ "dist",
50
+ "alpha"
51
+ ]
52
+ }