@backstage/backend-defaults 0.1.5-next.0 → 0.1.5

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,30 @@
1
1
  # @backstage/backend-defaults
2
2
 
3
+ ## 0.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 6cfd4d7073: Include implementations for the new `rootLifecycleServiceRef`.
8
+ - ecc6bfe4c9: Use new `ServiceFactoryOrFunction` type.
9
+ - 015a6dced6: Updated to make sure that service implementations replace default service implementations.
10
+ - 843a0a158c: Added factory for the new core identity service to the set of default service factories.
11
+ - 5b7bcd3c5e: Added support to supply a shared environment to `createBackend`, which can be created using `createSharedEnvironment` from `@backstage/backend-plugin-api`.
12
+ - 02b119ff93: The new root HTTP router service is now installed by default.
13
+ - Updated dependencies
14
+ - @backstage/backend-plugin-api@0.3.0
15
+ - @backstage/backend-app-api@0.3.0
16
+
17
+ ## 0.1.5-next.1
18
+
19
+ ### Patch Changes
20
+
21
+ - ecc6bfe4c9: Use new `ServiceFactoryOrFunction` type.
22
+ - 015a6dced6: Updated to make sure that service implementations replace default service implementations.
23
+ - 02b119ff93: The new root HTTP router service is now installed by default.
24
+ - Updated dependencies
25
+ - @backstage/backend-app-api@0.3.0-next.1
26
+ - @backstage/backend-plugin-api@0.3.0-next.1
27
+
3
28
  ## 0.1.5-next.0
4
29
 
5
30
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -5,25 +5,46 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var backendAppApi = require('@backstage/backend-app-api');
6
6
 
7
7
  const defaultServiceFactories = [
8
- backendAppApi.cacheFactory,
9
- backendAppApi.configFactory,
10
- backendAppApi.databaseFactory,
11
- backendAppApi.discoveryFactory,
12
- backendAppApi.loggerFactory,
13
- backendAppApi.rootLoggerFactory,
14
- backendAppApi.permissionsFactory,
15
- backendAppApi.schedulerFactory,
16
- backendAppApi.tokenManagerFactory,
17
- backendAppApi.urlReaderFactory,
18
- backendAppApi.httpRouterFactory,
19
- backendAppApi.lifecycleFactory,
20
- backendAppApi.rootLifecycleFactory
8
+ backendAppApi.cacheFactory(),
9
+ backendAppApi.configFactory(),
10
+ backendAppApi.databaseFactory(),
11
+ backendAppApi.discoveryFactory(),
12
+ backendAppApi.httpRouterFactory(),
13
+ backendAppApi.identityFactory(),
14
+ backendAppApi.lifecycleFactory(),
15
+ backendAppApi.loggerFactory(),
16
+ backendAppApi.permissionsFactory(),
17
+ backendAppApi.rootHttpRouterFactory(),
18
+ backendAppApi.rootLifecycleFactory(),
19
+ backendAppApi.rootLoggerFactory(),
20
+ backendAppApi.schedulerFactory(),
21
+ backendAppApi.tokenManagerFactory(),
22
+ backendAppApi.urlReaderFactory()
21
23
  ];
22
24
  function createBackend(options) {
23
- var _a;
24
- return backendAppApi.createSpecializedBackend({
25
- services: [...defaultServiceFactories, ...(_a = options == null ? void 0 : options.services) != null ? _a : []]
26
- });
25
+ var _a, _b, _c;
26
+ const services = new Array();
27
+ const providedServices = ((_a = options == null ? void 0 : options.services) != null ? _a : []).map(
28
+ (sf) => typeof sf === "function" ? sf() : sf
29
+ );
30
+ services.push(...providedServices);
31
+ if (options == null ? void 0 : options.env) {
32
+ const env = options.env;
33
+ if (env.version !== "v1") {
34
+ throw new Error(
35
+ `Shared environment version '${env.version}' is invalid or not supported`
36
+ );
37
+ }
38
+ const environmentServices = (_c = (_b = env.services) == null ? void 0 : _b.filter(
39
+ (sf) => !services.some(({ service }) => sf.service.id === service.id)
40
+ )) != null ? _c : [];
41
+ services.push(...environmentServices);
42
+ }
43
+ const defaultServices = defaultServiceFactories.filter(
44
+ (sf) => !services.some(({ service }) => service.id === sf.service.id)
45
+ );
46
+ services.push(...defaultServices);
47
+ return backendAppApi.createSpecializedBackend({ services });
27
48
  }
28
49
 
29
50
  exports.createBackend = createBackend;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/CreateBackend.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Backend,\n cacheFactory,\n configFactory,\n createSpecializedBackend,\n databaseFactory,\n discoveryFactory,\n httpRouterFactory,\n lifecycleFactory,\n rootLifecycleFactory,\n loggerFactory,\n permissionsFactory,\n rootLoggerFactory,\n schedulerFactory,\n tokenManagerFactory,\n urlReaderFactory,\n} from '@backstage/backend-app-api';\nimport { ServiceFactory } from '@backstage/backend-plugin-api';\n\nexport const defaultServiceFactories = [\n cacheFactory,\n configFactory,\n databaseFactory,\n discoveryFactory,\n loggerFactory,\n rootLoggerFactory,\n permissionsFactory,\n schedulerFactory,\n tokenManagerFactory,\n urlReaderFactory,\n httpRouterFactory,\n lifecycleFactory,\n rootLifecycleFactory,\n];\n\n/**\n * @public\n */\nexport interface CreateBackendOptions {\n services?: (ServiceFactory | (() => ServiceFactory))[];\n}\n\n/**\n * @public\n */\nexport function createBackend(options?: CreateBackendOptions): Backend {\n return createSpecializedBackend({\n services: [...defaultServiceFactories, ...(options?.services ?? [])],\n });\n}\n"],"names":["cacheFactory","configFactory","databaseFactory","discoveryFactory","loggerFactory","rootLoggerFactory","permissionsFactory","schedulerFactory","tokenManagerFactory","urlReaderFactory","httpRouterFactory","lifecycleFactory","rootLifecycleFactory","createSpecializedBackend"],"mappings":";;;;;;AAmCO,MAAM,uBAA0B,GAAA;AAAA,EACrCA,0BAAA;AAAA,EACAC,2BAAA;AAAA,EACAC,6BAAA;AAAA,EACAC,8BAAA;AAAA,EACAC,2BAAA;AAAA,EACAC,+BAAA;AAAA,EACAC,gCAAA;AAAA,EACAC,8BAAA;AAAA,EACAC,iCAAA;AAAA,EACAC,8BAAA;AAAA,EACAC,+BAAA;AAAA,EACAC,8BAAA;AAAA,EACAC,kCAAA;AACF,CAAA,CAAA;AAYO,SAAS,cAAc,OAAyC,EAAA;AA7DvE,EAAA,IAAA,EAAA,CAAA;AA8DE,EAAA,OAAOC,sCAAyB,CAAA;AAAA,IAC9B,QAAA,EAAU,CAAC,GAAG,uBAAA,EAAyB,IAAI,EAAS,GAAA,OAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,QAAA,KAAT,IAAqB,GAAA,EAAA,GAAA,EAAG,CAAA;AAAA,GACpE,CAAA,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/CreateBackend.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Backend,\n cacheFactory,\n configFactory,\n createSpecializedBackend,\n databaseFactory,\n discoveryFactory,\n httpRouterFactory,\n rootHttpRouterFactory,\n lifecycleFactory,\n rootLifecycleFactory,\n loggerFactory,\n permissionsFactory,\n rootLoggerFactory,\n schedulerFactory,\n tokenManagerFactory,\n urlReaderFactory,\n identityFactory,\n} from '@backstage/backend-app-api';\nimport {\n ServiceFactory,\n ServiceFactoryOrFunction,\n SharedBackendEnvironment,\n} from '@backstage/backend-plugin-api';\n\n// Internal import of the type to avoid needing to export this.\n// eslint-disable-next-line monorepo/no-internal-import\nimport type { InternalSharedBackendEnvironment } from '@backstage/backend-plugin-api/src/wiring/createSharedEnvironment';\n\nexport const defaultServiceFactories = [\n cacheFactory(),\n configFactory(),\n databaseFactory(),\n discoveryFactory(),\n httpRouterFactory(),\n identityFactory(),\n lifecycleFactory(),\n loggerFactory(),\n permissionsFactory(),\n rootHttpRouterFactory(),\n rootLifecycleFactory(),\n rootLoggerFactory(),\n schedulerFactory(),\n tokenManagerFactory(),\n urlReaderFactory(),\n];\n\n/**\n * @public\n */\nexport interface CreateBackendOptions {\n env?: SharedBackendEnvironment;\n services?: ServiceFactoryOrFunction[];\n}\n\n/**\n * @public\n */\nexport function createBackend(options?: CreateBackendOptions): Backend {\n const services = new Array<ServiceFactory>();\n\n // Highest priority: Services passed directly to createBackend\n const providedServices = (options?.services ?? []).map(sf =>\n typeof sf === 'function' ? sf() : sf,\n );\n services.push(...providedServices);\n\n // Middle priority: Services from the shared environment\n if (options?.env) {\n const env = options.env as unknown as InternalSharedBackendEnvironment;\n if (env.version !== 'v1') {\n throw new Error(\n `Shared environment version '${env.version}' is invalid or not supported`,\n );\n }\n\n const environmentServices =\n env.services?.filter(\n sf => !services.some(({ service }) => sf.service.id === service.id),\n ) ?? [];\n services.push(...environmentServices);\n }\n\n // Lowest priority: Default services that are not already provided by environment or directly to createBackend\n const defaultServices = defaultServiceFactories.filter(\n sf => !services.some(({ service }) => service.id === sf.service.id),\n );\n services.push(...defaultServices);\n\n return createSpecializedBackend({ services });\n}\n"],"names":["cacheFactory","configFactory","databaseFactory","discoveryFactory","httpRouterFactory","identityFactory","lifecycleFactory","loggerFactory","permissionsFactory","rootHttpRouterFactory","rootLifecycleFactory","rootLoggerFactory","schedulerFactory","tokenManagerFactory","urlReaderFactory","createSpecializedBackend"],"mappings":";;;;;;AA6CO,MAAM,uBAA0B,GAAA;AAAA,EACrCA,0BAAa,EAAA;AAAA,EACbC,2BAAc,EAAA;AAAA,EACdC,6BAAgB,EAAA;AAAA,EAChBC,8BAAiB,EAAA;AAAA,EACjBC,+BAAkB,EAAA;AAAA,EAClBC,6BAAgB,EAAA;AAAA,EAChBC,8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O,KAAA,OAAA,CAAQ,EAAE,CAAA;AAAA,KAAA,KADpE,YAEK,EAAC,CAAA;AACR,IAAS,QAAA,CAAA,IAAA,CAAK,GAAG,mBAAmB,CAAA,CAAA;AAAA,GACtC;AAGA,EAAA,MAAM,kBAAkB,uBAAwB,CAAA,MAAA;AAAA,IAC9C,CAAM,EAAA,KAAA,CAAC,QAAS,CAAA,IAAA,CAAK,CAAC,EAAE,OAAQ,EAAA,KAAM,OAAQ,CAAA,EAAA,KAAO,EAAG,CAAA,OAAA,CAAQ,EAAE,CAAA;AAAA,GACpE,CAAA;AACA,EAAS,QAAA,CAAA,IAAA,CAAK,GAAG,eAAe,CAAA,CAAA;AAEhC,EAAO,OAAAC,sCAAA,CAAyB,EAAE,QAAA,EAAU,CAAA,CAAA;AAC9C;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
+ import { SharedBackendEnvironment, ServiceFactoryOrFunction } from '@backstage/backend-plugin-api';
1
2
  import { Backend } from '@backstage/backend-app-api';
2
- import { ServiceFactory } from '@backstage/backend-plugin-api';
3
3
 
4
4
  /**
5
5
  * @public
6
6
  */
7
7
  interface CreateBackendOptions {
8
- services?: (ServiceFactory | (() => ServiceFactory))[];
8
+ env?: SharedBackendEnvironment;
9
+ services?: ServiceFactoryOrFunction[];
9
10
  }
10
11
  /**
11
12
  * @public
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults",
3
3
  "description": "Backend defaults used by Backstage backend apps",
4
- "version": "0.1.5-next.0",
4
+ "version": "0.1.5",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "publishConfig": {
@@ -32,11 +32,12 @@
32
32
  "start": "backstage-cli package start"
33
33
  },
34
34
  "dependencies": {
35
- "@backstage/backend-app-api": "^0.2.5-next.0",
36
- "@backstage/backend-plugin-api": "^0.2.1-next.0"
35
+ "@backstage/backend-app-api": "^0.3.0",
36
+ "@backstage/backend-plugin-api": "^0.3.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@backstage/cli": "^0.22.1-next.1"
39
+ "@backstage/backend-test-utils": "^0.1.32",
40
+ "@backstage/cli": "^0.22.1"
40
41
  },
41
42
  "files": [
42
43
  "dist"