@backstage/backend-defaults 0.5.0-next.2 → 0.5.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,161 @@
1
1
  # @backstage/backend-defaults
2
2
 
3
+ ## 0.5.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 094eaa3: Remove references to in-repo backend-common
8
+ - Updated dependencies
9
+ - @backstage/backend-app-api@1.0.1-next.0
10
+ - @backstage/plugin-permission-node@0.8.4-next.0
11
+ - @backstage/plugin-events-node@0.4.1-next.0
12
+ - @backstage/plugin-auth-node@0.5.3-next.0
13
+ - @backstage/backend-dev-utils@0.1.5
14
+ - @backstage/backend-plugin-api@1.0.1-next.0
15
+ - @backstage/cli-common@0.1.14
16
+ - @backstage/cli-node@0.2.8
17
+ - @backstage/config@1.2.0
18
+ - @backstage/config-loader@1.9.1
19
+ - @backstage/errors@1.2.4
20
+ - @backstage/integration@1.15.0
21
+ - @backstage/integration-aws-node@0.1.12
22
+ - @backstage/types@1.1.1
23
+
24
+ ## 0.5.0
25
+
26
+ ### Minor Changes
27
+
28
+ - a4bac3c: **BREAKING**: You can no longer supply a `basePath` option to the host discovery implementation. In the new backend system, the ability to choose this path has been removed anyway at the plugin router level.
29
+ - 359fcd7: **BREAKING**: The backwards compatibility with plugins using legacy auth through the token manager service has been removed. This means that instead of falling back to using the old token manager, requests towards plugins that don't support the new auth system will simply fail. Please make sure that all plugins in your deployment are hosted within a backend instance from the new backend system.
30
+ - baeef13: **BREAKING** Removed `createLifecycleMiddleware` and `LifecycleMiddlewareOptions` to clean up API surface. These exports have no external usage and do not provide value in its current form. If you were using these exports, please reach out to the maintainers to discuss your use case.
31
+ - d425fc4: **BREAKING**: The return values from `createBackendPlugin`, `createBackendModule`, and `createServiceFactory` are now simply `BackendFeature` and `ServiceFactory`, instead of the previously deprecated form of a function that returns them. For this reason, `createServiceFactory` also no longer accepts the callback form where you provide direct options to the service. This also affects all `coreServices.*` service refs.
32
+
33
+ This may in particular affect tests; if you were effectively doing `createBackendModule({...})()` (note the parentheses), you can now remove those extra parentheses at the end. You may encounter cases of this in your `packages/backend/src/index.ts` too, where you add plugins, modules, and services. If you were using `createServiceFactory` with a function as its argument for the purpose of passing in options, this pattern has been deprecated for a while and is no longer supported. You may want to explore the new multiton patterns to achieve your goals, or moving settings to app-config.
34
+
35
+ As part of this change, the `IdentityFactoryOptions` type was removed, and can no longer be used to tweak that service. The identity service was also deprecated some time ago, and you will want to [migrate to the new auth system](https://backstage.io/docs/tutorials/auth-service-migration) if you still rely on it.
36
+
37
+ - 19ff127: **BREAKING**: The default backend instance no longer provides implementations for the identity and token manager services, which have been removed from `@backstage/backend-plugin-api`.
38
+
39
+ If you rely on plugins that still require these services, you can add them to your own backend by re-creating the service reference and factory.
40
+
41
+ The following can be used to implement the identity service:
42
+
43
+ ```ts
44
+ import {
45
+ coreServices,
46
+ createServiceFactory,
47
+ createServiceRef,
48
+ } from '@backstage/backend-plugin-api';
49
+ import {
50
+ DefaultIdentityClient,
51
+ IdentityApi,
52
+ } from '@backstage/plugin-auth-node';
53
+
54
+ backend.add(
55
+ createServiceFactory({
56
+ service: createServiceRef<IdentityApi>({ id: 'core.identity' }),
57
+ deps: {
58
+ discovery: coreServices.discovery,
59
+ },
60
+ async factory({ discovery }) {
61
+ return DefaultIdentityClient.create({ discovery });
62
+ },
63
+ }),
64
+ );
65
+ ```
66
+
67
+ The following can be used to implement the token manager service:
68
+
69
+ ```ts
70
+ import { ServerTokenManager, TokenManager } from '@backstage/backend-common';
71
+ import { createBackend } from '@backstage/backend-defaults';
72
+ import {
73
+ coreServices,
74
+ createServiceFactory,
75
+ createServiceRef,
76
+ } from '@backstage/backend-plugin-api';
77
+
78
+ backend.add(
79
+ createServiceFactory({
80
+ service: createServiceRef<TokenManager>({ id: 'core.tokenManager' }),
81
+ deps: {
82
+ config: coreServices.rootConfig,
83
+ logger: coreServices.rootLogger,
84
+ },
85
+ createRootContext({ config, logger }) {
86
+ return ServerTokenManager.fromConfig(config, {
87
+ logger,
88
+ allowDisabledTokenManager: true,
89
+ });
90
+ },
91
+ async factory(_deps, tokenManager) {
92
+ return tokenManager;
93
+ },
94
+ }),
95
+ );
96
+ ```
97
+
98
+ - 055b75b: **BREAKING**: Simplifications and cleanup as part of the Backend System 1.0 work.
99
+
100
+ For the `/database` subpath exports:
101
+
102
+ - The deprecated `dropDatabase` function has now been removed, without replacement.
103
+ - The deprecated `LegacyRootDatabaseService` type has now been removed.
104
+ - The return type from `DatabaseManager.forPlugin` is now directly a `DatabaseService`, as arguably expected.
105
+ - `DatabaseManager.forPlugin` now requires the `deps` argument, with the logger and lifecycle services.
106
+
107
+ For the `/cache` subpath exports:
108
+
109
+ - The `PluginCacheManager` type has been removed. You can still import it from `@backstage/backend-common`, but it's deprecated there, and you should move off of that package by migrating fully to the new backend system.
110
+ - Accordingly, `CacheManager.forPlugin` immediately returns a `CacheService` instead of a `PluginCacheManager`. The outcome of this is that you no longer need to make the extra `.getClient()` call. The old `CacheManager` with the old behavior still exists on `@backstage/backend-common`, but the above recommendations apply.
111
+
112
+ ### Patch Changes
113
+
114
+ - 213664e: Fixed an issue where the `useRedisSets` configuration for the cache service would have no effect.
115
+ - 6ed9264: chore(deps): bump `path-to-regexp` from 6.2.2 to 8.0.0
116
+ - 622360e: Move down the discovery config to be in the root
117
+ - 7f779c7: `auth.externalAccess` should be optional in the config schema
118
+ - fe6fd8c: Accept `ConfigService` instead of `Config` in constructors/factories
119
+ - 82539fe: Updated dependency `archiver` to `^7.0.0`.
120
+ - c2b63ab: Updated dependency `supertest` to `^7.0.0`.
121
+ - 5705424: Wrap scheduled tasks from the scheduler core service now in OpenTelemetry spans
122
+ - 7a72ec8: Exports the `discoveryFeatureLoader` as a replacement for the deprecated `featureDiscoveryService`.
123
+ The `discoveryFeatureLoader` is a new backend system [feature loader](https://backstage.io/docs/backend-system/architecture/feature-loaders/) that discovers backend features from the current `package.json` and its dependencies.
124
+ Here is an example using the `discoveryFeatureLoader` loader in a new backend instance:
125
+
126
+ ```ts
127
+ import { createBackend } from '@backstage/backend-defaults';
128
+ import { discoveryFeatureLoader } from '@backstage/backend-defaults';
129
+ //...
130
+
131
+ const backend = createBackend();
132
+ //...
133
+ backend.add(discoveryFeatureLoader);
134
+ //...
135
+ backend.start();
136
+ ```
137
+
138
+ - b2a329d: Properly indent the config schema
139
+ - 66dbf0a: Allow the cache service to accept the human duration format for TTL
140
+ - 5a8fcb4: Added the option to skip database migrations by setting `skipMigrations: true` in config. This can be done globally in the database config or by plugin id.
141
+ - 0b2a402: Updates to the config schema to match reality
142
+ - Updated dependencies
143
+ - @backstage/backend-common@0.25.0
144
+ - @backstage/backend-app-api@1.0.0
145
+ - @backstage/backend-plugin-api@1.0.0
146
+ - @backstage/plugin-auth-node@0.5.2
147
+ - @backstage/cli-node@0.2.8
148
+ - @backstage/plugin-permission-node@0.8.3
149
+ - @backstage/integration@1.15.0
150
+ - @backstage/config-loader@1.9.1
151
+ - @backstage/plugin-events-node@0.4.0
152
+ - @backstage/backend-dev-utils@0.1.5
153
+ - @backstage/cli-common@0.1.14
154
+ - @backstage/config@1.2.0
155
+ - @backstage/errors@1.2.4
156
+ - @backstage/integration-aws-node@0.1.12
157
+ - @backstage/types@1.1.1
158
+
3
159
  ## 0.5.0-next.2
4
160
 
5
161
  ### Minor Changes
package/auth/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults__auth",
3
- "version": "0.5.0-next.2",
3
+ "version": "0.5.1-next.0",
4
4
  "main": "../dist/auth.cjs.js",
5
5
  "types": "../dist/auth.d.ts"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults__cache",
3
- "version": "0.5.0-next.2",
3
+ "version": "0.5.1-next.0",
4
4
  "main": "../dist/cache.cjs.js",
5
5
  "types": "../dist/cache.d.ts"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults__database",
3
- "version": "0.5.0-next.2",
3
+ "version": "0.5.1-next.0",
4
4
  "main": "../dist/database.cjs.js",
5
5
  "types": "../dist/database.d.ts"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults__discovery",
3
- "version": "0.5.0-next.2",
3
+ "version": "0.5.1-next.0",
4
4
  "main": "../dist/discovery.cjs.js",
5
5
  "types": "../dist/discovery.d.ts"
6
6
  }
package/dist/cache.cjs.js CHANGED
@@ -143,7 +143,9 @@ class CacheManager {
143
143
  let store;
144
144
  return (pluginId, defaultTtl) => {
145
145
  if (!store) {
146
- store = new KeyvRedis(this.connection);
146
+ store = new KeyvRedis(this.connection, {
147
+ useRedisSets: this.useRedisSets
148
+ });
147
149
  store.on("error", (err) => {
148
150
  this.logger?.error("Failed to create redis cache client", err);
149
151
  this.errorHandler?.(err);
@@ -1 +1 @@
1
- {"version":3,"file":"cache.cjs.js","sources":["../src/entrypoints/cache/types.ts","../src/entrypoints/cache/CacheClient.ts","../src/entrypoints/cache/CacheManager.ts","../src/entrypoints/cache/cacheServiceFactory.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { LoggerService } from '@backstage/backend-plugin-api';\nimport { HumanDuration, durationToMilliseconds } from '@backstage/types';\n\n/**\n * Options given when constructing a {@link CacheManager}.\n *\n * @public\n */\nexport type CacheManagerOptions = {\n /**\n * An optional logger for use by the PluginCacheManager.\n */\n logger?: LoggerService;\n\n /**\n * An optional handler for connection errors emitted from the underlying data\n * store.\n */\n onError?: (err: Error) => void;\n};\n\nexport function ttlToMilliseconds(ttl: number | HumanDuration): number {\n return typeof ttl === 'number' ? ttl : durationToMilliseconds(ttl);\n}\n","/*\n * Copyright 2021 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 CacheService,\n CacheServiceOptions,\n CacheServiceSetOptions,\n} from '@backstage/backend-plugin-api';\nimport { JsonValue } from '@backstage/types';\nimport { createHash } from 'crypto';\nimport Keyv from 'keyv';\nimport { ttlToMilliseconds } from './types';\n\nexport type CacheClientFactory = (options: CacheServiceOptions) => Keyv;\n\n/**\n * A basic, concrete implementation of the CacheService, suitable for almost\n * all uses in Backstage.\n */\nexport class DefaultCacheClient implements CacheService {\n #client: Keyv;\n #clientFactory: CacheClientFactory;\n #options: CacheServiceOptions;\n\n constructor(\n client: Keyv,\n clientFactory: CacheClientFactory,\n options: CacheServiceOptions,\n ) {\n this.#client = client;\n this.#clientFactory = clientFactory;\n this.#options = options;\n }\n\n async get<TValue extends JsonValue>(\n key: string,\n ): Promise<TValue | undefined> {\n const k = this.getNormalizedKey(key);\n const value = await this.#client.get(k);\n return value as TValue | undefined;\n }\n\n async set(\n key: string,\n value: JsonValue,\n opts: CacheServiceSetOptions = {},\n ): Promise<void> {\n const k = this.getNormalizedKey(key);\n const ttl =\n opts.ttl !== undefined ? ttlToMilliseconds(opts.ttl) : undefined;\n await this.#client.set(k, value, ttl);\n }\n\n async delete(key: string): Promise<void> {\n const k = this.getNormalizedKey(key);\n await this.#client.delete(k);\n }\n\n withOptions(options: CacheServiceOptions): CacheService {\n const newOptions = { ...this.#options, ...options };\n return new DefaultCacheClient(\n this.#clientFactory(newOptions),\n this.#clientFactory,\n newOptions,\n );\n }\n\n /**\n * Ensures keys are well-formed for any/all cache stores.\n */\n private getNormalizedKey(candidateKey: string): string {\n // Remove potentially invalid characters.\n const wellFormedKey = Buffer.from(candidateKey).toString('base64');\n\n // Memcache in particular doesn't do well with keys > 250 bytes.\n // Padded because a plugin ID is also prepended to the key.\n if (wellFormedKey.length < 200) {\n return wellFormedKey;\n }\n\n return createHash('sha256').update(candidateKey).digest('base64');\n }\n}\n","/*\n * Copyright 2021 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 CacheService,\n CacheServiceOptions,\n LoggerService,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport Keyv from 'keyv';\nimport { DefaultCacheClient } from './CacheClient';\nimport { CacheManagerOptions, ttlToMilliseconds } from './types';\nimport { durationToMilliseconds } from '@backstage/types';\n\ntype StoreFactory = (pluginId: string, defaultTtl: number | undefined) => Keyv;\n\n/**\n * Implements a Cache Manager which will automatically create new cache clients\n * for plugins when requested. All requested cache clients are created with the\n * connection details provided.\n *\n * @public\n */\nexport class CacheManager {\n /**\n * Keys represent supported `backend.cache.store` values, mapped to factories\n * that return Keyv instances appropriate to the store.\n */\n private readonly storeFactories = {\n redis: this.createRedisStoreFactory(),\n memcache: this.createMemcacheStoreFactory(),\n memory: this.createMemoryStoreFactory(),\n };\n\n private readonly logger?: LoggerService;\n private readonly store: keyof CacheManager['storeFactories'];\n private readonly connection: string;\n private readonly useRedisSets: boolean;\n private readonly errorHandler: CacheManagerOptions['onError'];\n private readonly defaultTtl?: number;\n\n /**\n * Creates a new {@link CacheManager} instance by reading from the `backend`\n * config section, specifically the `.cache` key.\n *\n * @param config - The loaded application configuration.\n */\n static fromConfig(\n config: RootConfigService,\n options: CacheManagerOptions = {},\n ): CacheManager {\n // If no `backend.cache` config is provided, instantiate the CacheManager\n // with an in-memory cache client.\n const store = config.getOptionalString('backend.cache.store') || 'memory';\n const defaultTtlConfig = config.getOptional('backend.cache.defaultTtl');\n const connectionString =\n config.getOptionalString('backend.cache.connection') || '';\n const useRedisSets =\n config.getOptionalBoolean('backend.cache.useRedisSets') ?? true;\n const logger = options.logger?.child({\n type: 'cacheManager',\n });\n\n let defaultTtl: number | undefined;\n if (defaultTtlConfig !== undefined && defaultTtlConfig !== null) {\n if (typeof defaultTtlConfig === 'number') {\n defaultTtl = defaultTtlConfig;\n } else if (\n typeof defaultTtlConfig === 'object' &&\n !Array.isArray(defaultTtlConfig)\n ) {\n defaultTtl = durationToMilliseconds(defaultTtlConfig);\n } else {\n throw new Error(\n `Invalid configuration backend.cache.defaultTtl: ${defaultTtlConfig}, expected milliseconds number or HumanDuration object`,\n );\n }\n }\n\n return new CacheManager(\n store,\n connectionString,\n useRedisSets,\n options.onError,\n logger,\n defaultTtl,\n );\n }\n\n /** @internal */\n constructor(\n store: string,\n connectionString: string,\n useRedisSets: boolean,\n errorHandler: CacheManagerOptions['onError'],\n logger?: LoggerService,\n defaultTtl?: number,\n ) {\n if (!this.storeFactories.hasOwnProperty(store)) {\n throw new Error(`Unknown cache store: ${store}`);\n }\n this.logger = logger;\n this.store = store as keyof CacheManager['storeFactories'];\n this.connection = connectionString;\n this.useRedisSets = useRedisSets;\n this.errorHandler = errorHandler;\n this.defaultTtl = defaultTtl;\n }\n\n /**\n * Generates a PluginCacheManager for consumption by plugins.\n *\n * @param pluginId - The plugin that the cache manager should be created for.\n * Plugin names should be unique.\n */\n forPlugin(pluginId: string): CacheService {\n const clientFactory = (options: CacheServiceOptions) => {\n const ttl = options.defaultTtl ?? this.defaultTtl;\n return this.getClientWithTtl(\n pluginId,\n ttl !== undefined ? ttlToMilliseconds(ttl) : undefined,\n );\n };\n\n return new DefaultCacheClient(clientFactory({}), clientFactory, {});\n }\n\n private getClientWithTtl(pluginId: string, ttl: number | undefined): Keyv {\n return this.storeFactories[this.store](pluginId, ttl);\n }\n\n private createRedisStoreFactory(): StoreFactory {\n const KeyvRedis = require('@keyv/redis');\n let store: typeof KeyvRedis | undefined;\n return (pluginId, defaultTtl) => {\n if (!store) {\n store = new KeyvRedis(this.connection);\n // Always provide an error handler to avoid stopping the process\n store.on('error', (err: Error) => {\n this.logger?.error('Failed to create redis cache client', err);\n this.errorHandler?.(err);\n });\n }\n return new Keyv({\n namespace: pluginId,\n ttl: defaultTtl,\n store,\n emitErrors: false,\n useRedisSets: this.useRedisSets,\n });\n };\n }\n\n private createMemcacheStoreFactory(): StoreFactory {\n const KeyvMemcache = require('@keyv/memcache');\n let store: typeof KeyvMemcache | undefined;\n return (pluginId, defaultTtl) => {\n if (!store) {\n store = new KeyvMemcache(this.connection);\n // Always provide an error handler to avoid stopping the process\n store.on('error', (err: Error) => {\n this.logger?.error('Failed to create memcache cache client', err);\n this.errorHandler?.(err);\n });\n }\n return new Keyv({\n namespace: pluginId,\n ttl: defaultTtl,\n emitErrors: false,\n store,\n });\n };\n }\n\n private createMemoryStoreFactory(): StoreFactory {\n const store = new Map();\n return (pluginId, defaultTtl) =>\n new Keyv({\n namespace: pluginId,\n ttl: defaultTtl,\n emitErrors: false,\n store,\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 coreServices,\n createServiceFactory,\n} from '@backstage/backend-plugin-api';\nimport { CacheManager } from './CacheManager';\n\n/**\n * Key-value store for caching data.\n *\n * See {@link @backstage/code-plugin-api#CacheService}\n * and {@link https://backstage.io/docs/backend-system/core-services/cache | the service docs}\n * for more information.\n *\n * @public\n */\nexport const cacheServiceFactory = createServiceFactory({\n service: coreServices.cache,\n deps: {\n config: coreServices.rootConfig,\n plugin: coreServices.pluginMetadata,\n logger: coreServices.rootLogger,\n },\n async createRootContext({ config, logger }) {\n return CacheManager.fromConfig(config, { logger });\n },\n async factory({ plugin }, manager) {\n return manager.forPlugin(plugin.getId());\n },\n});\n"],"names":["durationToMilliseconds","createHash","Keyv","createServiceFactory","coreServices"],"mappings":";;;;;;;;;;;AAqCO,SAAS,kBAAkB,GAAqC,EAAA;AACrE,EAAA,OAAO,OAAO,GAAA,KAAQ,QAAW,GAAA,GAAA,GAAMA,6BAAuB,GAAG,CAAA,CAAA;AACnE;;ACPO,MAAM,kBAA2C,CAAA;AAAA,EACtD,OAAA,CAAA;AAAA,EACA,cAAA,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EAEA,WAAA,CACE,MACA,EAAA,aAAA,EACA,OACA,EAAA;AACA,IAAA,IAAA,CAAK,OAAU,GAAA,MAAA,CAAA;AACf,IAAA,IAAA,CAAK,cAAiB,GAAA,aAAA,CAAA;AACtB,IAAA,IAAA,CAAK,QAAW,GAAA,OAAA,CAAA;AAAA,GAClB;AAAA,EAEA,MAAM,IACJ,GAC6B,EAAA;AAC7B,IAAM,MAAA,CAAA,GAAI,IAAK,CAAA,gBAAA,CAAiB,GAAG,CAAA,CAAA;AACnC,IAAA,MAAM,KAAQ,GAAA,MAAM,IAAK,CAAA,OAAA,CAAQ,IAAI,CAAC,CAAA,CAAA;AACtC,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAAA,EAEA,MAAM,GACJ,CAAA,GAAA,EACA,KACA,EAAA,IAAA,GAA+B,EAChB,EA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"}
1
+ {"version":3,"file":"cache.cjs.js","sources":["../src/entrypoints/cache/types.ts","../src/entrypoints/cache/CacheClient.ts","../src/entrypoints/cache/CacheManager.ts","../src/entrypoints/cache/cacheServiceFactory.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { LoggerService } from '@backstage/backend-plugin-api';\nimport { HumanDuration, durationToMilliseconds } from '@backstage/types';\n\n/**\n * Options given when constructing a {@link CacheManager}.\n *\n * @public\n */\nexport type CacheManagerOptions = {\n /**\n * An optional logger for use by the PluginCacheManager.\n */\n logger?: LoggerService;\n\n /**\n * An optional handler for connection errors emitted from the underlying data\n * store.\n */\n onError?: (err: Error) => void;\n};\n\nexport function ttlToMilliseconds(ttl: number | HumanDuration): number {\n return typeof ttl === 'number' ? ttl : durationToMilliseconds(ttl);\n}\n","/*\n * Copyright 2021 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 CacheService,\n CacheServiceOptions,\n CacheServiceSetOptions,\n} from '@backstage/backend-plugin-api';\nimport { JsonValue } from '@backstage/types';\nimport { createHash } from 'crypto';\nimport Keyv from 'keyv';\nimport { ttlToMilliseconds } from './types';\n\nexport type CacheClientFactory = (options: CacheServiceOptions) => Keyv;\n\n/**\n * A basic, concrete implementation of the CacheService, suitable for almost\n * all uses in Backstage.\n */\nexport class DefaultCacheClient implements CacheService {\n #client: Keyv;\n #clientFactory: CacheClientFactory;\n #options: CacheServiceOptions;\n\n constructor(\n client: Keyv,\n clientFactory: CacheClientFactory,\n options: CacheServiceOptions,\n ) {\n this.#client = client;\n this.#clientFactory = clientFactory;\n this.#options = options;\n }\n\n async get<TValue extends JsonValue>(\n key: string,\n ): Promise<TValue | undefined> {\n const k = this.getNormalizedKey(key);\n const value = await this.#client.get(k);\n return value as TValue | undefined;\n }\n\n async set(\n key: string,\n value: JsonValue,\n opts: CacheServiceSetOptions = {},\n ): Promise<void> {\n const k = this.getNormalizedKey(key);\n const ttl =\n opts.ttl !== undefined ? ttlToMilliseconds(opts.ttl) : undefined;\n await this.#client.set(k, value, ttl);\n }\n\n async delete(key: string): Promise<void> {\n const k = this.getNormalizedKey(key);\n await this.#client.delete(k);\n }\n\n withOptions(options: CacheServiceOptions): CacheService {\n const newOptions = { ...this.#options, ...options };\n return new DefaultCacheClient(\n this.#clientFactory(newOptions),\n this.#clientFactory,\n newOptions,\n );\n }\n\n /**\n * Ensures keys are well-formed for any/all cache stores.\n */\n private getNormalizedKey(candidateKey: string): string {\n // Remove potentially invalid characters.\n const wellFormedKey = Buffer.from(candidateKey).toString('base64');\n\n // Memcache in particular doesn't do well with keys > 250 bytes.\n // Padded because a plugin ID is also prepended to the key.\n if (wellFormedKey.length < 200) {\n return wellFormedKey;\n }\n\n return createHash('sha256').update(candidateKey).digest('base64');\n }\n}\n","/*\n * Copyright 2021 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 CacheService,\n CacheServiceOptions,\n LoggerService,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport Keyv from 'keyv';\nimport { DefaultCacheClient } from './CacheClient';\nimport { CacheManagerOptions, ttlToMilliseconds } from './types';\nimport { durationToMilliseconds } from '@backstage/types';\n\ntype StoreFactory = (pluginId: string, defaultTtl: number | undefined) => Keyv;\n\n/**\n * Implements a Cache Manager which will automatically create new cache clients\n * for plugins when requested. All requested cache clients are created with the\n * connection details provided.\n *\n * @public\n */\nexport class CacheManager {\n /**\n * Keys represent supported `backend.cache.store` values, mapped to factories\n * that return Keyv instances appropriate to the store.\n */\n private readonly storeFactories = {\n redis: this.createRedisStoreFactory(),\n memcache: this.createMemcacheStoreFactory(),\n memory: this.createMemoryStoreFactory(),\n };\n\n private readonly logger?: LoggerService;\n private readonly store: keyof CacheManager['storeFactories'];\n private readonly connection: string;\n private readonly useRedisSets: boolean;\n private readonly errorHandler: CacheManagerOptions['onError'];\n private readonly defaultTtl?: number;\n\n /**\n * Creates a new {@link CacheManager} instance by reading from the `backend`\n * config section, specifically the `.cache` key.\n *\n * @param config - The loaded application configuration.\n */\n static fromConfig(\n config: RootConfigService,\n options: CacheManagerOptions = {},\n ): CacheManager {\n // If no `backend.cache` config is provided, instantiate the CacheManager\n // with an in-memory cache client.\n const store = config.getOptionalString('backend.cache.store') || 'memory';\n const defaultTtlConfig = config.getOptional('backend.cache.defaultTtl');\n const connectionString =\n config.getOptionalString('backend.cache.connection') || '';\n const useRedisSets =\n config.getOptionalBoolean('backend.cache.useRedisSets') ?? true;\n const logger = options.logger?.child({\n type: 'cacheManager',\n });\n\n let defaultTtl: number | undefined;\n if (defaultTtlConfig !== undefined && defaultTtlConfig !== null) {\n if (typeof defaultTtlConfig === 'number') {\n defaultTtl = defaultTtlConfig;\n } else if (\n typeof defaultTtlConfig === 'object' &&\n !Array.isArray(defaultTtlConfig)\n ) {\n defaultTtl = durationToMilliseconds(defaultTtlConfig);\n } else {\n throw new Error(\n `Invalid configuration backend.cache.defaultTtl: ${defaultTtlConfig}, expected milliseconds number or HumanDuration object`,\n );\n }\n }\n\n return new CacheManager(\n store,\n connectionString,\n useRedisSets,\n options.onError,\n logger,\n defaultTtl,\n );\n }\n\n /** @internal */\n constructor(\n store: string,\n connectionString: string,\n useRedisSets: boolean,\n errorHandler: CacheManagerOptions['onError'],\n logger?: LoggerService,\n defaultTtl?: number,\n ) {\n if (!this.storeFactories.hasOwnProperty(store)) {\n throw new Error(`Unknown cache store: ${store}`);\n }\n this.logger = logger;\n this.store = store as keyof CacheManager['storeFactories'];\n this.connection = connectionString;\n this.useRedisSets = useRedisSets;\n this.errorHandler = errorHandler;\n this.defaultTtl = defaultTtl;\n }\n\n /**\n * Generates a PluginCacheManager for consumption by plugins.\n *\n * @param pluginId - The plugin that the cache manager should be created for.\n * Plugin names should be unique.\n */\n forPlugin(pluginId: string): CacheService {\n const clientFactory = (options: CacheServiceOptions) => {\n const ttl = options.defaultTtl ?? this.defaultTtl;\n return this.getClientWithTtl(\n pluginId,\n ttl !== undefined ? ttlToMilliseconds(ttl) : undefined,\n );\n };\n\n return new DefaultCacheClient(clientFactory({}), clientFactory, {});\n }\n\n private getClientWithTtl(pluginId: string, ttl: number | undefined): Keyv {\n return this.storeFactories[this.store](pluginId, ttl);\n }\n\n private createRedisStoreFactory(): StoreFactory {\n const KeyvRedis = require('@keyv/redis');\n let store: typeof KeyvRedis | undefined;\n return (pluginId, defaultTtl) => {\n if (!store) {\n store = new KeyvRedis(this.connection, {\n useRedisSets: this.useRedisSets,\n });\n // Always provide an error handler to avoid stopping the process\n store.on('error', (err: Error) => {\n this.logger?.error('Failed to create redis cache client', err);\n this.errorHandler?.(err);\n });\n }\n return new Keyv({\n namespace: pluginId,\n ttl: defaultTtl,\n store,\n emitErrors: false,\n useRedisSets: this.useRedisSets,\n });\n };\n }\n\n private createMemcacheStoreFactory(): StoreFactory {\n const KeyvMemcache = require('@keyv/memcache');\n let store: typeof KeyvMemcache | undefined;\n return (pluginId, defaultTtl) => {\n if (!store) {\n store = new KeyvMemcache(this.connection);\n // Always provide an error handler to avoid stopping the process\n store.on('error', (err: Error) => {\n this.logger?.error('Failed to create memcache cache client', err);\n this.errorHandler?.(err);\n });\n }\n return new Keyv({\n namespace: pluginId,\n ttl: defaultTtl,\n emitErrors: false,\n store,\n });\n };\n }\n\n private createMemoryStoreFactory(): StoreFactory {\n const store = new Map();\n return (pluginId, defaultTtl) =>\n new Keyv({\n namespace: pluginId,\n ttl: defaultTtl,\n emitErrors: false,\n store,\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 coreServices,\n createServiceFactory,\n} from '@backstage/backend-plugin-api';\nimport { CacheManager } from './CacheManager';\n\n/**\n * Key-value store for caching data.\n *\n * See {@link @backstage/code-plugin-api#CacheService}\n * and {@link https://backstage.io/docs/backend-system/core-services/cache | the service docs}\n * for more information.\n *\n * @public\n */\nexport const cacheServiceFactory = createServiceFactory({\n service: coreServices.cache,\n deps: {\n config: coreServices.rootConfig,\n plugin: coreServices.pluginMetadata,\n logger: coreServices.rootLogger,\n },\n async createRootContext({ config, logger }) {\n return CacheManager.fromConfig(config, { logger });\n },\n async factory({ plugin }, manager) {\n return manager.forPlugin(plugin.getId());\n },\n});\n"],"names":["durationToMilliseconds","createHash","Keyv","createServiceFactory","coreServices"],"mappings":";;;;;;;;;;;AAqCO,SAAS,kBAAkB,GAAqC,EAAA;AACrE,EAAA,OAAO,OAAO,GAAA,KAAQ,QAAW,G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AChB,KAAA,IAAIA,qBAAK,CAAA;AAAA,MACP,SAAW,EAAA,QAAA;AAAA,MACX,GAAK,EAAA,UAAA;AAAA,MACL,UAAY,EAAA,KAAA;AAAA,MACZ,KAAA;AAAA,KACD,CAAA,CAAA;AAAA,GACL;AACF;;ACxKO,MAAM,sBAAsBC,qCAAqB,CAAA;AAAA,EACtD,SAASC,6BAAa,CAAA,KAAA;AAAA,EACtB,IAAM,EAAA;AAAA,IACJ,QAAQA,6BAAa,CAAA,UAAA;AAAA,IACrB,QAAQA,6BAAa,CAAA,cAAA;AAAA,IACrB,QAAQA,6BAAa,CAAA,UAAA;AAAA,GACvB;AAAA,EACA,MAAM,iBAAA,CAAkB,EAAE,MAAA,EAAQ,QAAU,EAAA;AAC1C,IAAA,OAAO,YAAa,CAAA,UAAA,CAAW,MAAQ,EAAA,EAAE,QAAQ,CAAA,CAAA;AAAA,GACnD;AAAA,EACA,MAAM,OAAA,CAAQ,EAAE,MAAA,IAAU,OAAS,EAAA;AACjC,IAAA,OAAO,OAAQ,CAAA,SAAA,CAAU,MAAO,CAAA,KAAA,EAAO,CAAA,CAAA;AAAA,GACzC;AACF,CAAC;;;;;"}
@@ -2296,7 +2296,7 @@ class DefaultReadTreeResponseFactory {
2296
2296
  }
2297
2297
 
2298
2298
  var name = "@backstage/backend-defaults";
2299
- var version = "0.5.0-next.2";
2299
+ var version = "0.5.1-next.0";
2300
2300
  var description = "Backend defaults used by Backstage backend apps";
2301
2301
  var backstage = {
2302
2302
  role: "node-library"
@@ -2416,7 +2416,7 @@ var dependencies = {
2416
2416
  "@aws-sdk/credential-providers": "^3.350.0",
2417
2417
  "@aws-sdk/types": "^3.347.0",
2418
2418
  "@backstage/backend-app-api": "workspace:^",
2419
- "@backstage/backend-common": "workspace:^",
2419
+ "@backstage/backend-common": "^0.25.0",
2420
2420
  "@backstage/backend-dev-utils": "workspace:^",
2421
2421
  "@backstage/backend-plugin-api": "workspace:^",
2422
2422
  "@backstage/cli-common": "workspace:^",
@@ -2438,7 +2438,7 @@ var dependencies = {
2438
2438
  "@opentelemetry/api": "^1.3.0",
2439
2439
  "@types/cors": "^2.8.6",
2440
2440
  "@types/express": "^4.17.6",
2441
- archiver: "^6.0.0",
2441
+ archiver: "^7.0.0",
2442
2442
  "base64-stream": "^1.0.0",
2443
2443
  "better-sqlite3": "^11.0.0",
2444
2444
  compression: "^1.7.4",
@@ -2486,11 +2486,15 @@ var devDependencies = {
2486
2486
  "@backstage/backend-plugin-api": "workspace:^",
2487
2487
  "@backstage/backend-test-utils": "workspace:^",
2488
2488
  "@backstage/cli": "workspace:^",
2489
+ "@types/archiver": "^6.0.0",
2490
+ "@types/base64-stream": "^1.0.2",
2491
+ "@types/concat-stream": "^2.0.0",
2489
2492
  "@types/http-errors": "^2.0.0",
2490
2493
  "@types/morgan": "^1.9.0",
2491
2494
  "@types/node-forge": "^1.3.0",
2492
2495
  "@types/pg-format": "^1.0.5",
2493
2496
  "@types/stoppable": "^1.1.0",
2497
+ "@types/yauzl": "^2.10.0",
2494
2498
  "aws-sdk-client-mock": "^4.0.0",
2495
2499
  "http-errors": "^2.0.0",
2496
2500
  msw: "^1.0.0",