@backstage/backend-plugin-api 0.1.5-next.0 → 0.2.0-next.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @backstage/backend-plugin-api
2
2
 
3
+ ## 0.2.0-next.2
4
+
5
+ ### Minor Changes
6
+
7
+ - 884d749b14: **BREAKING**: All core service references are now exported via a single `coreServices` object. For example, the `loggerServiceRef` is now accessed via `coreServices.logger` instead.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/backend-common@0.17.0-next.2
13
+ - @backstage/backend-tasks@0.4.0-next.2
14
+ - @backstage/config@1.0.5-next.1
15
+ - @backstage/plugin-permission-common@0.7.2-next.1
16
+
17
+ ## 0.1.5-next.1
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+ - @backstage/backend-common@0.17.0-next.1
23
+ - @backstage/backend-tasks@0.4.0-next.1
24
+ - @backstage/config@1.0.5-next.1
25
+ - @backstage/plugin-permission-common@0.7.2-next.1
26
+
3
27
  ## 0.1.5-next.0
4
28
 
5
29
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-plugin-api",
3
- "version": "0.1.5-next.0",
3
+ "version": "0.2.0-next.2",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -69,12 +69,31 @@ export declare interface BackendRegistrationPoints {
69
69
  /**
70
70
  * @public
71
71
  */
72
- export declare const cacheServiceRef: ServiceRef<PluginCacheManager, "plugin">;
72
+ declare const cacheServiceRef: ServiceRef<PluginCacheManager, "plugin">;
73
73
 
74
74
  /**
75
75
  * @public
76
76
  */
77
- export declare const configServiceRef: ServiceRef<Config, "root">;
77
+ declare const configServiceRef: ServiceRef<Config, "root">;
78
+
79
+ declare namespace coreServices {
80
+ export {
81
+ configServiceRef as config,
82
+ httpRouterServiceRef as httpRouter,
83
+ loggerServiceRef as logger,
84
+ urlReaderServiceRef as urlReader,
85
+ cacheServiceRef as cache,
86
+ databaseServiceRef as database,
87
+ discoveryServiceRef as discovery,
88
+ tokenManagerServiceRef as tokenManager,
89
+ permissionsServiceRef as permissions,
90
+ schedulerServiceRef as scheduler,
91
+ rootLoggerServiceRef as rootLogger,
92
+ pluginMetadataServiceRef as pluginMetadata,
93
+ lifecycleServiceRef as lifecycle
94
+ }
95
+ }
96
+ export { coreServices }
78
97
 
79
98
  /**
80
99
  * @public
@@ -129,12 +148,12 @@ export declare function createServiceRef<T>(options: {
129
148
  /**
130
149
  * @public
131
150
  */
132
- export declare const databaseServiceRef: ServiceRef<PluginDatabaseManager, "plugin">;
151
+ declare const databaseServiceRef: ServiceRef<PluginDatabaseManager, "plugin">;
133
152
 
134
153
  /**
135
154
  * @public
136
155
  */
137
- export declare const discoveryServiceRef: ServiceRef<PluginEndpointDiscovery, "plugin">;
156
+ declare const discoveryServiceRef: ServiceRef<PluginEndpointDiscovery, "plugin">;
138
157
 
139
158
  /**
140
159
  * TODO
@@ -162,12 +181,12 @@ export declare interface HttpRouterService {
162
181
  /**
163
182
  * @public
164
183
  */
165
- export declare const httpRouterServiceRef: ServiceRef<HttpRouterService, "plugin">;
184
+ declare const httpRouterServiceRef: ServiceRef<HttpRouterService, "plugin">;
166
185
 
167
186
  /**
168
187
  * @public
169
188
  */
170
- export declare const lifecycleServiceRef: ServiceRef<BackendLifecycle, "plugin">;
189
+ declare const lifecycleServiceRef: ServiceRef<BackendLifecycle, "plugin">;
171
190
 
172
191
  /**
173
192
  * @public
@@ -182,7 +201,7 @@ export declare interface Logger {
182
201
  /**
183
202
  * @public
184
203
  */
185
- export declare const loggerServiceRef: ServiceRef<Logger, "plugin">;
204
+ declare const loggerServiceRef: ServiceRef<Logger, "plugin">;
186
205
 
187
206
  /** @public */
188
207
  export declare function loggerToWinstonLogger(logger: Logger, opts?: TransportStreamOptions): Logger_2;
@@ -190,7 +209,7 @@ export declare function loggerToWinstonLogger(logger: Logger, opts?: TransportSt
190
209
  /**
191
210
  * @public
192
211
  */
193
- export declare const permissionsServiceRef: ServiceRef<PermissionAuthorizer | PermissionEvaluator, "plugin">;
212
+ declare const permissionsServiceRef: ServiceRef<PermissionAuthorizer | PermissionEvaluator, "plugin">;
194
213
 
195
214
  /**
196
215
  * @public
@@ -202,17 +221,17 @@ export declare interface PluginMetadata {
202
221
  /**
203
222
  * @public
204
223
  */
205
- export declare const pluginMetadataServiceRef: ServiceRef<PluginMetadata, "plugin">;
224
+ declare const pluginMetadataServiceRef: ServiceRef<PluginMetadata, "plugin">;
206
225
 
207
226
  /**
208
227
  * @public
209
228
  */
210
- export declare const rootLoggerServiceRef: ServiceRef<Logger, "root">;
229
+ declare const rootLoggerServiceRef: ServiceRef<Logger, "root">;
211
230
 
212
231
  /**
213
232
  * @public
214
233
  */
215
- export declare const schedulerServiceRef: ServiceRef<PluginTaskScheduler, "plugin">;
234
+ declare const schedulerServiceRef: ServiceRef<PluginTaskScheduler, "plugin">;
216
235
 
217
236
  /** @public */
218
237
  export declare type ServiceFactory<TService = unknown> = {
@@ -275,7 +294,7 @@ declare type ServiceRefsToInstances<T extends {
275
294
  /**
276
295
  * @public
277
296
  */
278
- export declare const tokenManagerServiceRef: ServiceRef<TokenManager, "plugin">;
297
+ declare const tokenManagerServiceRef: ServiceRef<TokenManager, "plugin">;
279
298
 
280
299
  /** @public */
281
300
  export declare type TypesToServiceRef<T> = {
@@ -285,6 +304,6 @@ export declare type TypesToServiceRef<T> = {
285
304
  /**
286
305
  * @public
287
306
  */
288
- export declare const urlReaderServiceRef: ServiceRef<UrlReader, "plugin">;
307
+ declare const urlReaderServiceRef: ServiceRef<UrlReader, "plugin">;
289
308
 
290
309
  export { }
@@ -69,12 +69,31 @@ export declare interface BackendRegistrationPoints {
69
69
  /**
70
70
  * @public
71
71
  */
72
- export declare const cacheServiceRef: ServiceRef<PluginCacheManager, "plugin">;
72
+ declare const cacheServiceRef: ServiceRef<PluginCacheManager, "plugin">;
73
73
 
74
74
  /**
75
75
  * @public
76
76
  */
77
- export declare const configServiceRef: ServiceRef<Config, "root">;
77
+ declare const configServiceRef: ServiceRef<Config, "root">;
78
+
79
+ declare namespace coreServices {
80
+ export {
81
+ configServiceRef as config,
82
+ httpRouterServiceRef as httpRouter,
83
+ loggerServiceRef as logger,
84
+ urlReaderServiceRef as urlReader,
85
+ cacheServiceRef as cache,
86
+ databaseServiceRef as database,
87
+ discoveryServiceRef as discovery,
88
+ tokenManagerServiceRef as tokenManager,
89
+ permissionsServiceRef as permissions,
90
+ schedulerServiceRef as scheduler,
91
+ rootLoggerServiceRef as rootLogger,
92
+ pluginMetadataServiceRef as pluginMetadata,
93
+ lifecycleServiceRef as lifecycle
94
+ }
95
+ }
96
+ export { coreServices }
78
97
 
79
98
  /**
80
99
  * @public
@@ -129,12 +148,12 @@ export declare function createServiceRef<T>(options: {
129
148
  /**
130
149
  * @public
131
150
  */
132
- export declare const databaseServiceRef: ServiceRef<PluginDatabaseManager, "plugin">;
151
+ declare const databaseServiceRef: ServiceRef<PluginDatabaseManager, "plugin">;
133
152
 
134
153
  /**
135
154
  * @public
136
155
  */
137
- export declare const discoveryServiceRef: ServiceRef<PluginEndpointDiscovery, "plugin">;
156
+ declare const discoveryServiceRef: ServiceRef<PluginEndpointDiscovery, "plugin">;
138
157
 
139
158
  /**
140
159
  * TODO
@@ -162,12 +181,12 @@ export declare interface HttpRouterService {
162
181
  /**
163
182
  * @public
164
183
  */
165
- export declare const httpRouterServiceRef: ServiceRef<HttpRouterService, "plugin">;
184
+ declare const httpRouterServiceRef: ServiceRef<HttpRouterService, "plugin">;
166
185
 
167
186
  /**
168
187
  * @public
169
188
  */
170
- export declare const lifecycleServiceRef: ServiceRef<BackendLifecycle, "plugin">;
189
+ declare const lifecycleServiceRef: ServiceRef<BackendLifecycle, "plugin">;
171
190
 
172
191
  /**
173
192
  * @public
@@ -182,7 +201,7 @@ export declare interface Logger {
182
201
  /**
183
202
  * @public
184
203
  */
185
- export declare const loggerServiceRef: ServiceRef<Logger, "plugin">;
204
+ declare const loggerServiceRef: ServiceRef<Logger, "plugin">;
186
205
 
187
206
  /** @public */
188
207
  export declare function loggerToWinstonLogger(logger: Logger, opts?: TransportStreamOptions): Logger_2;
@@ -190,7 +209,7 @@ export declare function loggerToWinstonLogger(logger: Logger, opts?: TransportSt
190
209
  /**
191
210
  * @public
192
211
  */
193
- export declare const permissionsServiceRef: ServiceRef<PermissionAuthorizer | PermissionEvaluator, "plugin">;
212
+ declare const permissionsServiceRef: ServiceRef<PermissionAuthorizer | PermissionEvaluator, "plugin">;
194
213
 
195
214
  /**
196
215
  * @public
@@ -202,17 +221,17 @@ export declare interface PluginMetadata {
202
221
  /**
203
222
  * @public
204
223
  */
205
- export declare const pluginMetadataServiceRef: ServiceRef<PluginMetadata, "plugin">;
224
+ declare const pluginMetadataServiceRef: ServiceRef<PluginMetadata, "plugin">;
206
225
 
207
226
  /**
208
227
  * @public
209
228
  */
210
- export declare const rootLoggerServiceRef: ServiceRef<Logger, "root">;
229
+ declare const rootLoggerServiceRef: ServiceRef<Logger, "root">;
211
230
 
212
231
  /**
213
232
  * @public
214
233
  */
215
- export declare const schedulerServiceRef: ServiceRef<PluginTaskScheduler, "plugin">;
234
+ declare const schedulerServiceRef: ServiceRef<PluginTaskScheduler, "plugin">;
216
235
 
217
236
  /** @public */
218
237
  export declare type ServiceFactory<TService = unknown> = {
@@ -275,7 +294,7 @@ declare type ServiceRefsToInstances<T extends {
275
294
  /**
276
295
  * @public
277
296
  */
278
- export declare const tokenManagerServiceRef: ServiceRef<TokenManager, "plugin">;
297
+ declare const tokenManagerServiceRef: ServiceRef<TokenManager, "plugin">;
279
298
 
280
299
  /** @public */
281
300
  export declare type TypesToServiceRef<T> = {
@@ -285,6 +304,6 @@ export declare type TypesToServiceRef<T> = {
285
304
  /**
286
305
  * @public
287
306
  */
288
- export declare const urlReaderServiceRef: ServiceRef<UrlReader, "plugin">;
307
+ declare const urlReaderServiceRef: ServiceRef<UrlReader, "plugin">;
289
308
 
290
309
  export { }
package/dist/index.cjs.js CHANGED
@@ -90,6 +90,23 @@ const lifecycleServiceRef = createServiceRef({
90
90
  scope: "plugin"
91
91
  });
92
92
 
93
+ var coreServices = /*#__PURE__*/Object.freeze({
94
+ __proto__: null,
95
+ config: configServiceRef,
96
+ httpRouter: httpRouterServiceRef,
97
+ logger: loggerServiceRef,
98
+ urlReader: urlReaderServiceRef,
99
+ cache: cacheServiceRef,
100
+ database: databaseServiceRef,
101
+ discovery: discoveryServiceRef,
102
+ tokenManager: tokenManagerServiceRef,
103
+ permissions: permissionsServiceRef,
104
+ scheduler: schedulerServiceRef,
105
+ rootLogger: rootLoggerServiceRef,
106
+ pluginMetadata: pluginMetadataServiceRef,
107
+ lifecycle: lifecycleServiceRef
108
+ });
109
+
93
110
  class BackstageLoggerTransport extends Transport__default["default"] {
94
111
  constructor(backstageLogger, opts) {
95
112
  super(opts);
@@ -135,23 +152,11 @@ function createBackendModule(config) {
135
152
  });
136
153
  }
137
154
 
138
- exports.cacheServiceRef = cacheServiceRef;
139
- exports.configServiceRef = configServiceRef;
155
+ exports.coreServices = coreServices;
140
156
  exports.createBackendModule = createBackendModule;
141
157
  exports.createBackendPlugin = createBackendPlugin;
142
158
  exports.createExtensionPoint = createExtensionPoint;
143
159
  exports.createServiceFactory = createServiceFactory;
144
160
  exports.createServiceRef = createServiceRef;
145
- exports.databaseServiceRef = databaseServiceRef;
146
- exports.discoveryServiceRef = discoveryServiceRef;
147
- exports.httpRouterServiceRef = httpRouterServiceRef;
148
- exports.lifecycleServiceRef = lifecycleServiceRef;
149
- exports.loggerServiceRef = loggerServiceRef;
150
161
  exports.loggerToWinstonLogger = loggerToWinstonLogger;
151
- exports.permissionsServiceRef = permissionsServiceRef;
152
- exports.pluginMetadataServiceRef = pluginMetadataServiceRef;
153
- exports.rootLoggerServiceRef = rootLoggerServiceRef;
154
- exports.schedulerServiceRef = schedulerServiceRef;
155
- exports.tokenManagerServiceRef = tokenManagerServiceRef;
156
- exports.urlReaderServiceRef = urlReaderServiceRef;
157
162
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/services/system/types.ts","../src/services/definitions/configServiceRef.ts","../src/services/definitions/httpRouterServiceRef.ts","../src/services/definitions/loggerServiceRef.ts","../src/services/definitions/urlReaderServiceRef.ts","../src/services/definitions/cacheServiceRef.ts","../src/services/definitions/databaseServiceRef.ts","../src/services/definitions/discoveryServiceRef.ts","../src/services/definitions/tokenManagerServiceRef.ts","../src/services/definitions/permissionsServiceRef.ts","../src/services/definitions/schedulerServiceRef.ts","../src/services/definitions/rootLoggerServiceRef.ts","../src/services/definitions/pluginMetadataServiceRef.ts","../src/services/definitions/lifecycleServiceRef.ts","../src/services/helpers/loggerToWinstonLogger.ts","../src/wiring/factories.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\n/**\n * TODO\n *\n * @public\n */\nexport type ServiceRef<\n TService,\n TScope extends 'root' | 'plugin' = 'root' | 'plugin',\n> = {\n id: string;\n\n /**\n * This determines the scope at which this service is available.\n *\n * Root scoped services are available to all other services but\n * may only depend on other root scoped services.\n *\n * Plugin scoped services are only available to other plugin scoped\n * services but may depend on all other services.\n */\n scope: TScope;\n\n /**\n * Utility for getting the type of the service, using `typeof serviceRef.T`.\n * Attempting to actually read this value will result in an exception.\n */\n T: TService;\n\n toString(): string;\n\n $$ref: 'service';\n};\n\n/** @public */\nexport type TypesToServiceRef<T> = { [key in keyof T]: ServiceRef<T[key]> };\n\n/** @public */\nexport type ServiceFactory<TService = unknown> =\n | {\n // This scope prop is needed in addition to the service ref, as TypeScript\n // can't properly discriminate the two factory types otherwise.\n scope: 'root';\n service: ServiceRef<TService, 'root'>;\n deps: { [key in string]: ServiceRef<unknown> };\n factory(deps: { [key in string]: unknown }): Promise<TService>;\n }\n | {\n scope: 'plugin';\n service: ServiceRef<TService, 'plugin'>;\n deps: { [key in string]: ServiceRef<unknown> };\n factory(deps: { [key in string]: unknown }): Promise<\n (deps: { [key in string]: unknown }) => Promise<TService>\n >;\n };\n\n/** @public */\nexport function createServiceRef<T>(options: {\n id: string;\n scope?: 'plugin';\n defaultFactory?: (\n service: ServiceRef<T, 'plugin'>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>;\n}): ServiceRef<T, 'plugin'>;\n/** @public */\nexport function createServiceRef<T>(options: {\n id: string;\n scope: 'root';\n defaultFactory?: (\n service: ServiceRef<T, 'root'>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>;\n}): ServiceRef<T, 'root'>;\nexport function createServiceRef<T>(options: {\n id: string;\n scope?: 'plugin' | 'root';\n defaultFactory?:\n | ((\n service: ServiceRef<T, 'plugin'>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>)\n | ((\n service: ServiceRef<T, 'root'>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>);\n}): ServiceRef<T> {\n const { id, scope = 'plugin', defaultFactory } = options;\n return {\n id,\n scope,\n get T(): T {\n throw new Error(`tried to read ServiceRef.T of ${this}`);\n },\n toString() {\n return `serviceRef{${options.id}}`;\n },\n $$ref: 'service', // TODO: declare\n __defaultFactory: defaultFactory,\n } as ServiceRef<T, typeof scope> & {\n __defaultFactory?: (\n service: ServiceRef<T>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>;\n };\n}\n\n/** @ignore */\ntype ServiceRefsToInstances<\n T extends { [key in string]: ServiceRef<unknown> },\n TScope extends 'root' | 'plugin' = 'root' | 'plugin',\n> = {\n [name in {\n [key in keyof T]: T[key] extends ServiceRef<unknown, TScope> ? key : never;\n }[keyof T]]: T[name] extends ServiceRef<infer TImpl> ? TImpl : never;\n};\n\n/**\n * @public\n */\nexport function createServiceFactory<\n TService,\n TScope extends 'root' | 'plugin',\n TImpl extends TService,\n TDeps extends { [name in string]: ServiceRef<unknown> },\n TOpts extends object | undefined = undefined,\n>(config: {\n service: ServiceRef<TService, TScope>;\n deps: TDeps;\n factory(\n deps: ServiceRefsToInstances<TDeps, 'root'>,\n options: TOpts,\n ): TScope extends 'root'\n ? Promise<TImpl>\n : Promise<(deps: ServiceRefsToInstances<TDeps>) => Promise<TImpl>>;\n}): undefined extends TOpts\n ? (options?: TOpts) => ServiceFactory<TService>\n : (options: TOpts) => ServiceFactory<TService> {\n return (options?: TOpts) =>\n ({\n scope: config.service.scope,\n service: config.service,\n deps: config.deps,\n factory(deps: ServiceRefsToInstances<TDeps, 'root'>) {\n return config.factory(deps, options!);\n },\n } as ServiceFactory<TService>);\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 { Config } from '@backstage/config';\nimport { createServiceRef } from '../system/types';\n\n/**\n * @public\n */\nexport const configServiceRef = createServiceRef<Config>({\n id: 'core.root.config',\n scope: 'root',\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 { createServiceRef } from '../system/types';\nimport { Handler } from 'express';\n\n/**\n * @public\n */\nexport interface HttpRouterService {\n use(handler: Handler): void;\n}\n\n/**\n * @public\n */\nexport const httpRouterServiceRef = createServiceRef<HttpRouterService>({\n id: 'core.httpRouter',\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 { createServiceRef } from '../system/types';\n\n/**\n * @public\n */\nexport interface Logger {\n info(message: string): void;\n child(fields: { [name: string]: string }): Logger;\n}\n\n/**\n * @public\n */\nexport const loggerServiceRef = createServiceRef<Logger>({\n id: 'core.logger',\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 { createServiceRef } from '../system/types';\nimport { UrlReader } from '@backstage/backend-common';\n\n/**\n * @public\n */\nexport const urlReaderServiceRef = createServiceRef<UrlReader>({\n id: 'core.urlReader',\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 { createServiceRef } from '../system/types';\nimport { PluginCacheManager } from '@backstage/backend-common';\n\n/**\n * @public\n */\nexport const cacheServiceRef = createServiceRef<PluginCacheManager>({\n id: 'core.cache',\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 { PluginDatabaseManager } from '@backstage/backend-common';\nimport { createServiceRef } from '../system/types';\n\n/**\n * @public\n */\nexport const databaseServiceRef = createServiceRef<PluginDatabaseManager>({\n id: 'core.database',\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 { createServiceRef } from '../system/types';\nimport { PluginEndpointDiscovery } from '@backstage/backend-common';\n\n/**\n * @public\n */\nexport const discoveryServiceRef = createServiceRef<PluginEndpointDiscovery>({\n id: 'core.discovery',\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 { createServiceRef } from '../system/types';\nimport { TokenManager } from '@backstage/backend-common';\n\n/**\n * @public\n */\nexport const tokenManagerServiceRef = createServiceRef<TokenManager>({\n id: 'core.tokenManager',\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 { createServiceRef } from '../system/types';\nimport {\n PermissionAuthorizer,\n PermissionEvaluator,\n} from '@backstage/plugin-permission-common';\n\n/**\n * @public\n */\nexport const permissionsServiceRef = createServiceRef<\n PermissionEvaluator | PermissionAuthorizer\n>({\n id: 'core.permissions',\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 { createServiceRef } from '../system/types';\nimport { PluginTaskScheduler } from '@backstage/backend-tasks';\n\n/**\n * @public\n */\nexport const schedulerServiceRef = createServiceRef<PluginTaskScheduler>({\n id: 'core.scheduler',\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 { createServiceRef } from '../system/types';\nimport { Logger } from './loggerServiceRef';\n\n/**\n * @public\n */\nexport const rootLoggerServiceRef = createServiceRef<Logger>({\n id: 'core.root.logger',\n scope: 'root',\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 { createServiceRef } from '../system/types';\n\n/**\n * @public\n */\nexport interface PluginMetadata {\n getId(): string;\n}\n\n/**\n * @public\n */\nexport const pluginMetadataServiceRef = createServiceRef<PluginMetadata>({\n id: 'core.plugin-metadata',\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 { createServiceRef } from '../system/types';\n\n/**\n * @public\n **/\nexport type BackendLifecycleShutdownHook = {\n fn: () => void | Promise<void>;\n};\n\n/**\n * @public\n **/\nexport interface BackendLifecycle {\n /**\n * Register a function to be called when the backend is shutting down.\n */\n addShutdownHook(options: BackendLifecycleShutdownHook): void;\n}\n\n/**\n * @public\n */\nexport const lifecycleServiceRef = createServiceRef<BackendLifecycle>({\n id: 'core.lifecycle',\n scope: 'plugin',\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 { Logger as BackstageLogger } from '../definitions';\nimport { Logger as WinstonLogger, createLogger } from 'winston';\nimport Transport, { TransportStreamOptions } from 'winston-transport';\n\nclass BackstageLoggerTransport extends Transport {\n constructor(\n private readonly backstageLogger: BackstageLogger,\n opts?: TransportStreamOptions,\n ) {\n super(opts);\n }\n\n log(info: { message: string }, callback: VoidFunction) {\n // TODO: add support for levels and fields\n this.backstageLogger.info(info.message);\n callback();\n }\n}\n\n/** @public */\nexport function loggerToWinstonLogger(\n logger: BackstageLogger,\n opts?: TransportStreamOptions,\n): WinstonLogger {\n return createLogger({\n transports: [new BackstageLoggerTransport(logger, opts)],\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 BackendRegistrationPoints,\n BackendFeature,\n ExtensionPoint,\n} from './types';\n\n/** @public */\nexport function createExtensionPoint<T>(options: {\n id: string;\n}): ExtensionPoint<T> {\n return {\n id: options.id,\n get T(): T {\n throw new Error(`tried to read ExtensionPoint.T of ${this}`);\n },\n toString() {\n return `extensionPoint{${options.id}}`;\n },\n $$ref: 'extension-point', // TODO: declare\n };\n}\n\n/** @public */\nexport interface BackendPluginConfig<TOptions> {\n id: string;\n register(reg: BackendRegistrationPoints, options: TOptions): void;\n}\n\n/** @public */\nexport function createBackendPlugin<\n TOptions extends object | undefined = undefined,\n>(config: {\n id: string;\n register(reg: BackendRegistrationPoints, options: TOptions): void;\n}): undefined extends TOptions\n ? (options?: TOptions) => BackendFeature\n : (options: TOptions) => BackendFeature {\n return (options?: TOptions) => ({\n id: config.id,\n register(register: BackendRegistrationPoints) {\n return config.register(register, options!);\n },\n });\n}\n\n/** @public */\nexport interface BackendModuleConfig<TOptions> {\n pluginId: string;\n moduleId: string;\n register(\n reg: Omit<BackendRegistrationPoints, 'registerExtensionPoint'>,\n options: TOptions,\n ): void;\n}\n\n/**\n * @public\n *\n * Creates a new backend module for a given plugin.\n *\n * The `moduleId` should be equal to the module-specific prefix of the exported name, such\n * that the full name is `moduleId + PluginId + \"Module\"`. For example, a GitHub entity\n * provider module for the `catalog` plugin might have the module ID `'githubEntityProvider'`,\n * and the full exported name would be `githubEntityProviderCatalogModule`.\n *\n * The `pluginId` should exactly match the `id` of the plugin that the module extends.\n */\nexport function createBackendModule<\n TOptions extends object | undefined = undefined,\n>(\n config: BackendModuleConfig<TOptions>,\n): undefined extends TOptions\n ? (options?: TOptions) => BackendFeature\n : (options: TOptions) => BackendFeature {\n return (options?: TOptions) => ({\n id: `${config.pluginId}.${config.moduleId}`,\n register(register: BackendRegistrationPoints) {\n // TODO: Hide registerExtensionPoint\n return config.register(register, options!);\n },\n });\n}\n"],"names":["Transport","createLogger"],"mappings":";;;;;;;;;;;AAuFO,SAAS,iBAAoB,OAU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wB,OAElB,EAAA;AACpB,EAAO,OAAA;AAAA,IACL,IAAI,OAAQ,CAAA,EAAA;AAAA,IACZ,IAAI,CAAO,GAAA;AACT,MAAM,MAAA,IAAI,KAAM,CAAA,CAAA,kCAAA,EAAqC,IAAM,CAAA,CAAA,CAAA,CAAA;AAAA,KAC7D;AAAA,IACA,QAAW,GAAA;AACT,MAAA,OAAO,kBAAkB,OAAQ,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA;AAAA,KACnC;AAAA,IACA,KAAO,EAAA,iBAAA;AAAA,GACT,CAAA;AACF,CAAA;AASO,SAAS,oBAEd,MAKwC,EAAA;AACxC,EAAA,OAAO,CAAC,OAAwB,MAAA;AAAA,IAC9B,IAAI,MAAO,CAAA,EAAA;AAAA,IACX,SAAS,QAAqC,EAAA;AAC5C,MAAO,OAAA,MAAA,CAAO,QAAS,CAAA,QAAA,EAAU,OAAQ,CAAA,CAAA;AAAA,KAC3C;AAAA,GACF,CAAA,CAAA;AACF,CAAA;AAwBO,SAAS,oBAGd,MAGwC,EAAA;AACxC,EAAA,OAAO,CAAC,OAAwB,MAAA;AAAA,IAC9B,EAAI,EAAA,CAAA,EAAG,MAAO,CAAA,QAAA,CAAA,CAAA,EAAY,MAAO,CAAA,QAAA,CAAA,CAAA;AAAA,IACjC,SAAS,QAAqC,EAAA;AAE5C,MAAO,OAAA,MAAA,CAAO,QAAS,CAAA,QAAA,EAAU,OAAQ,CAAA,CAAA;AAAA,KAC3C;AAAA,GACF,CAAA,CAAA;AACF;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/services/system/types.ts","../src/services/definitions/configServiceRef.ts","../src/services/definitions/httpRouterServiceRef.ts","../src/services/definitions/loggerServiceRef.ts","../src/services/definitions/urlReaderServiceRef.ts","../src/services/definitions/cacheServiceRef.ts","../src/services/definitions/databaseServiceRef.ts","../src/services/definitions/discoveryServiceRef.ts","../src/services/definitions/tokenManagerServiceRef.ts","../src/services/definitions/permissionsServiceRef.ts","../src/services/definitions/schedulerServiceRef.ts","../src/services/definitions/rootLoggerServiceRef.ts","../src/services/definitions/pluginMetadataServiceRef.ts","../src/services/definitions/lifecycleServiceRef.ts","../src/services/helpers/loggerToWinstonLogger.ts","../src/wiring/factories.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\n/**\n * TODO\n *\n * @public\n */\nexport type ServiceRef<\n TService,\n TScope extends 'root' | 'plugin' = 'root' | 'plugin',\n> = {\n id: string;\n\n /**\n * This determines the scope at which this service is available.\n *\n * Root scoped services are available to all other services but\n * may only depend on other root scoped services.\n *\n * Plugin scoped services are only available to other plugin scoped\n * services but may depend on all other services.\n */\n scope: TScope;\n\n /**\n * Utility for getting the type of the service, using `typeof serviceRef.T`.\n * Attempting to actually read this value will result in an exception.\n */\n T: TService;\n\n toString(): string;\n\n $$ref: 'service';\n};\n\n/** @public */\nexport type TypesToServiceRef<T> = { [key in keyof T]: ServiceRef<T[key]> };\n\n/** @public */\nexport type ServiceFactory<TService = unknown> =\n | {\n // This scope prop is needed in addition to the service ref, as TypeScript\n // can't properly discriminate the two factory types otherwise.\n scope: 'root';\n service: ServiceRef<TService, 'root'>;\n deps: { [key in string]: ServiceRef<unknown> };\n factory(deps: { [key in string]: unknown }): Promise<TService>;\n }\n | {\n scope: 'plugin';\n service: ServiceRef<TService, 'plugin'>;\n deps: { [key in string]: ServiceRef<unknown> };\n factory(deps: { [key in string]: unknown }): Promise<\n (deps: { [key in string]: unknown }) => Promise<TService>\n >;\n };\n\n/** @public */\nexport function createServiceRef<T>(options: {\n id: string;\n scope?: 'plugin';\n defaultFactory?: (\n service: ServiceRef<T, 'plugin'>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>;\n}): ServiceRef<T, 'plugin'>;\n/** @public */\nexport function createServiceRef<T>(options: {\n id: string;\n scope: 'root';\n defaultFactory?: (\n service: ServiceRef<T, 'root'>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>;\n}): ServiceRef<T, 'root'>;\nexport function createServiceRef<T>(options: {\n id: string;\n scope?: 'plugin' | 'root';\n defaultFactory?:\n | ((\n service: ServiceRef<T, 'plugin'>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>)\n | ((\n service: ServiceRef<T, 'root'>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>);\n}): ServiceRef<T> {\n const { id, scope = 'plugin', defaultFactory } = options;\n return {\n id,\n scope,\n get T(): T {\n throw new Error(`tried to read ServiceRef.T of ${this}`);\n },\n toString() {\n return `serviceRef{${options.id}}`;\n },\n $$ref: 'service', // TODO: declare\n __defaultFactory: defaultFactory,\n } as ServiceRef<T, typeof scope> & {\n __defaultFactory?: (\n service: ServiceRef<T>,\n ) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>;\n };\n}\n\n/** @ignore */\ntype ServiceRefsToInstances<\n T extends { [key in string]: ServiceRef<unknown> },\n TScope extends 'root' | 'plugin' = 'root' | 'plugin',\n> = {\n [name in {\n [key in keyof T]: T[key] extends ServiceRef<unknown, TScope> ? key : never;\n }[keyof T]]: T[name] extends ServiceRef<infer TImpl> ? TImpl : never;\n};\n\n/**\n * @public\n */\nexport function createServiceFactory<\n TService,\n TScope extends 'root' | 'plugin',\n TImpl extends TService,\n TDeps extends { [name in string]: ServiceRef<unknown> },\n TOpts extends object | undefined = undefined,\n>(config: {\n service: ServiceRef<TService, TScope>;\n deps: TDeps;\n factory(\n deps: ServiceRefsToInstances<TDeps, 'root'>,\n options: TOpts,\n ): TScope extends 'root'\n ? Promise<TImpl>\n : Promise<(deps: ServiceRefsToInstances<TDeps>) => Promise<TImpl>>;\n}): undefined extends TOpts\n ? (options?: TOpts) => ServiceFactory<TService>\n : (options: TOpts) => ServiceFactory<TService> {\n return (options?: TOpts) =>\n ({\n scope: config.service.scope,\n service: config.service,\n deps: config.deps,\n factory(deps: ServiceRefsToInstances<TDeps, 'root'>) {\n return config.factory(deps, options!);\n },\n } as ServiceFactory<TService>);\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 { Config } from '@backstage/config';\nimport { createServiceRef } from '../system/types';\n\n/**\n * @public\n */\nexport const configServiceRef = createServiceRef<Config>({\n id: 'core.root.config',\n scope: 'root',\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 { createServiceRef } from '../system/types';\nimport { Handler } from 'express';\n\n/**\n * @public\n */\nexport interface HttpRouterService {\n use(handler: Handler): void;\n}\n\n/**\n * @public\n */\nexport const httpRouterServiceRef = createServiceRef<HttpRouterService>({\n id: 'core.httpRouter',\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 { createServiceRef } from '../system/types';\n\n/**\n * @public\n */\nexport interface Logger {\n info(message: string): void;\n child(fields: { [name: string]: string }): Logger;\n}\n\n/**\n * @public\n */\nexport const loggerServiceRef = createServiceRef<Logger>({\n id: 'core.logger',\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 { createServiceRef } from '../system/types';\nimport { UrlReader } from '@backstage/backend-common';\n\n/**\n * @public\n */\nexport const urlReaderServiceRef = createServiceRef<UrlReader>({\n id: 'core.urlReader',\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 { createServiceRef } from '../system/types';\nimport { PluginCacheManager } from '@backstage/backend-common';\n\n/**\n * @public\n */\nexport const cacheServiceRef = createServiceRef<PluginCacheManager>({\n id: 'core.cache',\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 { PluginDatabaseManager } from '@backstage/backend-common';\nimport { createServiceRef } from '../system/types';\n\n/**\n * @public\n */\nexport const databaseServiceRef = createServiceRef<PluginDatabaseManager>({\n id: 'core.database',\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 { createServiceRef } from '../system/types';\nimport { PluginEndpointDiscovery } from '@backstage/backend-common';\n\n/**\n * @public\n */\nexport const discoveryServiceRef = createServiceRef<PluginEndpointDiscovery>({\n id: 'core.discovery',\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 { createServiceRef } from '../system/types';\nimport { TokenManager } from '@backstage/backend-common';\n\n/**\n * @public\n */\nexport const tokenManagerServiceRef = createServiceRef<TokenManager>({\n id: 'core.tokenManager',\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 { createServiceRef } from '../system/types';\nimport {\n PermissionAuthorizer,\n PermissionEvaluator,\n} from '@backstage/plugin-permission-common';\n\n/**\n * @public\n */\nexport const permissionsServiceRef = createServiceRef<\n PermissionEvaluator | PermissionAuthorizer\n>({\n id: 'core.permissions',\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 { createServiceRef } from '../system/types';\nimport { PluginTaskScheduler } from '@backstage/backend-tasks';\n\n/**\n * @public\n */\nexport const schedulerServiceRef = createServiceRef<PluginTaskScheduler>({\n id: 'core.scheduler',\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 { createServiceRef } from '../system/types';\nimport { Logger } from './loggerServiceRef';\n\n/**\n * @public\n */\nexport const rootLoggerServiceRef = createServiceRef<Logger>({\n id: 'core.root.logger',\n scope: 'root',\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 { createServiceRef } from '../system/types';\n\n/**\n * @public\n */\nexport interface PluginMetadata {\n getId(): string;\n}\n\n/**\n * @public\n */\nexport const pluginMetadataServiceRef = createServiceRef<PluginMetadata>({\n id: 'core.plugin-metadata',\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 { createServiceRef } from '../system/types';\n\n/**\n * @public\n **/\nexport type BackendLifecycleShutdownHook = {\n fn: () => void | Promise<void>;\n};\n\n/**\n * @public\n **/\nexport interface BackendLifecycle {\n /**\n * Register a function to be called when the backend is shutting down.\n */\n addShutdownHook(options: BackendLifecycleShutdownHook): void;\n}\n\n/**\n * @public\n */\nexport const lifecycleServiceRef = createServiceRef<BackendLifecycle>({\n id: 'core.lifecycle',\n scope: 'plugin',\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 { Logger as BackstageLogger } from '../definitions';\nimport { Logger as WinstonLogger, createLogger } from 'winston';\nimport Transport, { TransportStreamOptions } from 'winston-transport';\n\nclass BackstageLoggerTransport extends Transport {\n constructor(\n private readonly backstageLogger: BackstageLogger,\n opts?: TransportStreamOptions,\n ) {\n super(opts);\n }\n\n log(info: { message: string }, callback: VoidFunction) {\n // TODO: add support for levels and fields\n this.backstageLogger.info(info.message);\n callback();\n }\n}\n\n/** @public */\nexport function loggerToWinstonLogger(\n logger: BackstageLogger,\n opts?: TransportStreamOptions,\n): WinstonLogger {\n return createLogger({\n transports: [new BackstageLoggerTransport(logger, opts)],\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 BackendRegistrationPoints,\n BackendFeature,\n ExtensionPoint,\n} from './types';\n\n/** @public */\nexport function createExtensionPoint<T>(options: {\n id: string;\n}): ExtensionPoint<T> {\n return {\n id: options.id,\n get T(): T {\n throw new Error(`tried to read ExtensionPoint.T of ${this}`);\n },\n toString() {\n return `extensionPoint{${options.id}}`;\n },\n $$ref: 'extension-point', // TODO: declare\n };\n}\n\n/** @public */\nexport interface BackendPluginConfig<TOptions> {\n id: string;\n register(reg: BackendRegistrationPoints, options: TOptions): void;\n}\n\n/** @public */\nexport function createBackendPlugin<\n TOptions extends object | undefined = undefined,\n>(config: {\n id: string;\n register(reg: BackendRegistrationPoints, options: TOptions): void;\n}): undefined extends TOptions\n ? (options?: TOptions) => BackendFeature\n : (options: TOptions) => BackendFeature {\n return (options?: TOptions) => ({\n id: config.id,\n register(register: BackendRegistrationPoints) {\n return config.register(register, options!);\n },\n });\n}\n\n/** @public */\nexport interface BackendModuleConfig<TOptions> {\n pluginId: string;\n moduleId: string;\n register(\n reg: Omit<BackendRegistrationPoints, 'registerExtensionPoint'>,\n options: TOptions,\n ): void;\n}\n\n/**\n * @public\n *\n * Creates a new backend module for a given plugin.\n *\n * The `moduleId` should be equal to the module-specific prefix of the exported name, such\n * that the full name is `moduleId + PluginId + \"Module\"`. For example, a GitHub entity\n * provider module for the `catalog` plugin might have the module ID `'githubEntityProvider'`,\n * and the full exported name would be `githubEntityProviderCatalogModule`.\n *\n * The `pluginId` should exactly match the `id` of the plugin that the module extends.\n */\nexport function createBackendModule<\n TOptions extends object | undefined = undefined,\n>(\n config: BackendModuleConfig<TOptions>,\n): undefined extends TOptions\n ? (options?: TOptions) => BackendFeature\n : (options: TOptions) => BackendFeature {\n return (options?: TOptions) => ({\n id: `${config.pluginId}.${config.moduleId}`,\n register(register: BackendRegistrationPoints) {\n // TODO: Hide registerExtensionPoint\n return config.register(register, options!);\n },\n });\n}\n"],"names":["Transport","createLogger"],"mappings":";;;;;;;;;;;AAuFO,SAAS,iBAAoB,OAUlB,EAAA;AAChB,EAAA,MAAM,EAAE,EAAA,EAAI,KAAQ,GAAA,QAAA,EAAU,gBAAmB,GAAA,OAAA,CAAA;AACjD,EAAO,OAAA;AAAA,IACL,EAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAI,CAAO,GAAA;AACT,MAAM,MAAA,IAAI,KAAM,CAAA,CAAA,8BAAA,EAAiC,IAAM,CAAA,CAAA,CAAA,CAAA;AAAA,KACzD;AAAA,IACA,QAAW,GAAA;AACT,MAAA,OAAO,cAAc,OAAQ,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA;AAAA,KAC/B;AAAA,IACA,KAA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A,KACnC;AAAA,IACA,KAAO,EAAA,iBAAA;AAAA,GACT,CAAA;AACF,CAAA;AASO,SAAS,oBAEd,MAKwC,EAAA;AACxC,EAAA,OAAO,CAAC,OAAwB,MAAA;AAAA,IAC9B,IAAI,MAAO,CAAA,EAAA;AAAA,IACX,SAAS,QAAqC,EAAA;AAC5C,MAAO,OAAA,MAAA,CAAO,QAAS,CAAA,QAAA,EAAU,OAAQ,CAAA,CAAA;AAAA,KAC3C;AAAA,GACF,CAAA,CAAA;AACF,CAAA;AAwBO,SAAS,oBAGd,MAGwC,EAAA;AACxC,EAAA,OAAO,CAAC,OAAwB,MAAA;AAAA,IAC9B,EAAI,EAAA,CAAA,EAAG,MAAO,CAAA,QAAA,CAAA,CAAA,EAAY,MAAO,CAAA,QAAA,CAAA,CAAA;AAAA,IACjC,SAAS,QAAqC,EAAA;AAE5C,MAAO,OAAA,MAAA,CAAO,QAAS,CAAA,QAAA,EAAU,OAAQ,CAAA,CAAA;AAAA,KAC3C;AAAA,GACF,CAAA,CAAA;AACF;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -69,12 +69,31 @@ export declare interface BackendRegistrationPoints {
69
69
  /**
70
70
  * @public
71
71
  */
72
- export declare const cacheServiceRef: ServiceRef<PluginCacheManager, "plugin">;
72
+ declare const cacheServiceRef: ServiceRef<PluginCacheManager, "plugin">;
73
73
 
74
74
  /**
75
75
  * @public
76
76
  */
77
- export declare const configServiceRef: ServiceRef<Config, "root">;
77
+ declare const configServiceRef: ServiceRef<Config, "root">;
78
+
79
+ declare namespace coreServices {
80
+ export {
81
+ configServiceRef as config,
82
+ httpRouterServiceRef as httpRouter,
83
+ loggerServiceRef as logger,
84
+ urlReaderServiceRef as urlReader,
85
+ cacheServiceRef as cache,
86
+ databaseServiceRef as database,
87
+ discoveryServiceRef as discovery,
88
+ tokenManagerServiceRef as tokenManager,
89
+ permissionsServiceRef as permissions,
90
+ schedulerServiceRef as scheduler,
91
+ rootLoggerServiceRef as rootLogger,
92
+ pluginMetadataServiceRef as pluginMetadata,
93
+ lifecycleServiceRef as lifecycle
94
+ }
95
+ }
96
+ export { coreServices }
78
97
 
79
98
  /**
80
99
  * @public
@@ -129,12 +148,12 @@ export declare function createServiceRef<T>(options: {
129
148
  /**
130
149
  * @public
131
150
  */
132
- export declare const databaseServiceRef: ServiceRef<PluginDatabaseManager, "plugin">;
151
+ declare const databaseServiceRef: ServiceRef<PluginDatabaseManager, "plugin">;
133
152
 
134
153
  /**
135
154
  * @public
136
155
  */
137
- export declare const discoveryServiceRef: ServiceRef<PluginEndpointDiscovery, "plugin">;
156
+ declare const discoveryServiceRef: ServiceRef<PluginEndpointDiscovery, "plugin">;
138
157
 
139
158
  /**
140
159
  * TODO
@@ -162,12 +181,12 @@ export declare interface HttpRouterService {
162
181
  /**
163
182
  * @public
164
183
  */
165
- export declare const httpRouterServiceRef: ServiceRef<HttpRouterService, "plugin">;
184
+ declare const httpRouterServiceRef: ServiceRef<HttpRouterService, "plugin">;
166
185
 
167
186
  /**
168
187
  * @public
169
188
  */
170
- export declare const lifecycleServiceRef: ServiceRef<BackendLifecycle, "plugin">;
189
+ declare const lifecycleServiceRef: ServiceRef<BackendLifecycle, "plugin">;
171
190
 
172
191
  /**
173
192
  * @public
@@ -182,7 +201,7 @@ export declare interface Logger {
182
201
  /**
183
202
  * @public
184
203
  */
185
- export declare const loggerServiceRef: ServiceRef<Logger, "plugin">;
204
+ declare const loggerServiceRef: ServiceRef<Logger, "plugin">;
186
205
 
187
206
  /** @public */
188
207
  export declare function loggerToWinstonLogger(logger: Logger, opts?: TransportStreamOptions): Logger_2;
@@ -190,7 +209,7 @@ export declare function loggerToWinstonLogger(logger: Logger, opts?: TransportSt
190
209
  /**
191
210
  * @public
192
211
  */
193
- export declare const permissionsServiceRef: ServiceRef<PermissionAuthorizer | PermissionEvaluator, "plugin">;
212
+ declare const permissionsServiceRef: ServiceRef<PermissionAuthorizer | PermissionEvaluator, "plugin">;
194
213
 
195
214
  /**
196
215
  * @public
@@ -202,17 +221,17 @@ export declare interface PluginMetadata {
202
221
  /**
203
222
  * @public
204
223
  */
205
- export declare const pluginMetadataServiceRef: ServiceRef<PluginMetadata, "plugin">;
224
+ declare const pluginMetadataServiceRef: ServiceRef<PluginMetadata, "plugin">;
206
225
 
207
226
  /**
208
227
  * @public
209
228
  */
210
- export declare const rootLoggerServiceRef: ServiceRef<Logger, "root">;
229
+ declare const rootLoggerServiceRef: ServiceRef<Logger, "root">;
211
230
 
212
231
  /**
213
232
  * @public
214
233
  */
215
- export declare const schedulerServiceRef: ServiceRef<PluginTaskScheduler, "plugin">;
234
+ declare const schedulerServiceRef: ServiceRef<PluginTaskScheduler, "plugin">;
216
235
 
217
236
  /** @public */
218
237
  export declare type ServiceFactory<TService = unknown> = {
@@ -275,7 +294,7 @@ declare type ServiceRefsToInstances<T extends {
275
294
  /**
276
295
  * @public
277
296
  */
278
- export declare const tokenManagerServiceRef: ServiceRef<TokenManager, "plugin">;
297
+ declare const tokenManagerServiceRef: ServiceRef<TokenManager, "plugin">;
279
298
 
280
299
  /** @public */
281
300
  export declare type TypesToServiceRef<T> = {
@@ -285,6 +304,6 @@ export declare type TypesToServiceRef<T> = {
285
304
  /**
286
305
  * @public
287
306
  */
288
- export declare const urlReaderServiceRef: ServiceRef<UrlReader, "plugin">;
307
+ declare const urlReaderServiceRef: ServiceRef<UrlReader, "plugin">;
289
308
 
290
309
  export { }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/backend-plugin-api",
3
3
  "description": "Core API used by Backstage backend plugins",
4
- "version": "0.1.5-next.0",
4
+ "version": "0.2.0-next.2",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "publishConfig": {
@@ -33,17 +33,17 @@
33
33
  "start": "backstage-cli package start"
34
34
  },
35
35
  "dependencies": {
36
- "@backstage/backend-common": "^0.16.1-next.0",
37
- "@backstage/backend-tasks": "^0.3.8-next.0",
38
- "@backstage/config": "^1.0.5-next.0",
39
- "@backstage/plugin-permission-common": "^0.7.2-next.0",
36
+ "@backstage/backend-common": "^0.17.0-next.2",
37
+ "@backstage/backend-tasks": "^0.4.0-next.2",
38
+ "@backstage/config": "^1.0.5-next.1",
39
+ "@backstage/plugin-permission-common": "^0.7.2-next.1",
40
40
  "@types/express": "^4.17.6",
41
41
  "express": "^4.17.1",
42
42
  "winston": "^3.2.1",
43
43
  "winston-transport": "^4.5.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@backstage/cli": "^0.21.2-next.0"
46
+ "@backstage/cli": "^0.21.2-next.2"
47
47
  },
48
48
  "files": [
49
49
  "dist",