@backstage/backend-app-api 0.7.3-next.1 → 0.7.4
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 +33 -0
- package/alpha/package.json +1 -1
- package/dist/index.cjs.js +64 -6
- package/dist/index.cjs.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @backstage/backend-app-api
|
|
2
2
|
|
|
3
|
+
## 0.7.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ce87d0e: Fixed a potential crash when passing an object with a `null` prototype as log meta.
|
|
8
|
+
|
|
9
|
+
## 0.7.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4cd5ff0: Add ability to configure the Node.js HTTP Server when configuring the root HTTP Router service
|
|
14
|
+
- e8199b1: Move the JWKS registration outside of the lifecycle middleware
|
|
15
|
+
- d229dc4: Move path utilities from `backend-common` to the `backend-plugin-api` package.
|
|
16
|
+
- dc8c5dd: The default `TokenManager` implementation no longer requires keys to be configured in production, but it will throw an errors when generating or authenticating tokens. The default `AuthService` implementation will now also provide additional context if such an error is throw when falling back to using the `TokenManager` service to generate tokens for outgoing requests.
|
|
17
|
+
- 025641b: Redact `meta` fields too with the logger
|
|
18
|
+
- 09f8988: Remove explicit `alg` check for user tokens in `verifyToken`
|
|
19
|
+
- 5863e02: Internal refactor to only create one external token handler
|
|
20
|
+
- a1dc547: Added support for camel case CSP directives in app-config. For example:
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
backend:
|
|
24
|
+
csp:
|
|
25
|
+
upgradeInsecureRequests: false
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- 329cc34: Added logging of all plugins being initialized, periodic status, and completion.
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
- @backstage/backend-common@0.22.0
|
|
31
|
+
- @backstage/backend-plugin-api@0.6.18
|
|
32
|
+
- @backstage/backend-tasks@0.5.23
|
|
33
|
+
- @backstage/plugin-auth-node@0.4.13
|
|
34
|
+
- @backstage/plugin-permission-node@0.7.29
|
|
35
|
+
|
|
3
36
|
## 0.7.2-next.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -15,6 +15,7 @@ var cors = require('cors');
|
|
|
15
15
|
var helmet = require('helmet');
|
|
16
16
|
var morgan = require('morgan');
|
|
17
17
|
var compression = require('compression');
|
|
18
|
+
var kebabCase = require('lodash/kebabCase');
|
|
18
19
|
var minimatch = require('minimatch');
|
|
19
20
|
var errors = require('@backstage/errors');
|
|
20
21
|
var crypto = require('crypto');
|
|
@@ -22,11 +23,11 @@ var winston = require('winston');
|
|
|
22
23
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
23
24
|
var alpha = require('@backstage/backend-plugin-api/alpha');
|
|
24
25
|
var luxon = require('luxon');
|
|
25
|
-
var backendCommon = require('@backstage/backend-common');
|
|
26
26
|
var jose = require('jose');
|
|
27
27
|
var uuid = require('uuid');
|
|
28
28
|
var pluginAuthNode = require('@backstage/plugin-auth-node');
|
|
29
29
|
var types = require('@backstage/types');
|
|
30
|
+
var backendCommon = require('@backstage/backend-common');
|
|
30
31
|
var backendAppApi = require('@backstage/backend-app-api');
|
|
31
32
|
var cookie = require('cookie');
|
|
32
33
|
var Router = require('express-promise-router');
|
|
@@ -66,6 +67,7 @@ var cors__default = /*#__PURE__*/_interopDefaultCompat(cors);
|
|
|
66
67
|
var helmet__default = /*#__PURE__*/_interopDefaultCompat(helmet);
|
|
67
68
|
var morgan__default = /*#__PURE__*/_interopDefaultCompat(morgan);
|
|
68
69
|
var compression__default = /*#__PURE__*/_interopDefaultCompat(compression);
|
|
70
|
+
var kebabCase__default = /*#__PURE__*/_interopDefaultCompat(kebabCase);
|
|
69
71
|
var Router__default = /*#__PURE__*/_interopDefaultCompat(Router);
|
|
70
72
|
var express__default = /*#__PURE__*/_interopDefaultCompat(express);
|
|
71
73
|
var trimEnd__default = /*#__PURE__*/_interopDefaultCompat(trimEnd);
|
|
@@ -536,10 +538,11 @@ function applyCspDirectives(directives) {
|
|
|
536
538
|
delete result["form-action"];
|
|
537
539
|
if (directives) {
|
|
538
540
|
for (const [key, value] of Object.entries(directives)) {
|
|
541
|
+
const kebabCaseKey = kebabCase__default.default(key);
|
|
539
542
|
if (value === false) {
|
|
540
|
-
delete result[
|
|
543
|
+
delete result[kebabCaseKey];
|
|
541
544
|
} else {
|
|
542
|
-
result[
|
|
545
|
+
result[kebabCaseKey] = value;
|
|
543
546
|
}
|
|
544
547
|
}
|
|
545
548
|
}
|
|
@@ -860,11 +863,14 @@ const _WinstonLogger = class _WinstonLogger {
|
|
|
860
863
|
const replace = (obj) => {
|
|
861
864
|
var _a;
|
|
862
865
|
for (const key in obj) {
|
|
863
|
-
if (
|
|
866
|
+
if (Object.hasOwn(obj, key)) {
|
|
864
867
|
if (typeof obj[key] === "object") {
|
|
865
868
|
obj[key] = replace(obj[key]);
|
|
866
869
|
} else if (typeof obj[key] === "string") {
|
|
867
|
-
|
|
870
|
+
try {
|
|
871
|
+
obj[key] = (_a = obj[key]) == null ? void 0 : _a.replace(redactionPattern, "[REDACTED]");
|
|
872
|
+
} catch {
|
|
873
|
+
}
|
|
868
874
|
}
|
|
869
875
|
}
|
|
870
876
|
}
|
|
@@ -1564,6 +1570,52 @@ checkForMissingDeps_fn = function(factory, pluginId) {
|
|
|
1564
1570
|
};
|
|
1565
1571
|
let ServiceRegistry = _ServiceRegistry;
|
|
1566
1572
|
|
|
1573
|
+
const LOGGER_INTERVAL_MAX = 6e4;
|
|
1574
|
+
function joinIds(ids) {
|
|
1575
|
+
return [...ids].map((id) => `'${id}'`).join(", ");
|
|
1576
|
+
}
|
|
1577
|
+
function createInitializationLogger(pluginIds, rootLogger) {
|
|
1578
|
+
const logger = rootLogger == null ? void 0 : rootLogger.child({ type: "initialization" });
|
|
1579
|
+
const starting = new Set(pluginIds);
|
|
1580
|
+
const started = /* @__PURE__ */ new Set();
|
|
1581
|
+
logger == null ? void 0 : logger.info(`Plugin initialization started: ${joinIds(pluginIds)}`);
|
|
1582
|
+
const getInitStatus = () => {
|
|
1583
|
+
let status = "";
|
|
1584
|
+
if (started.size > 0) {
|
|
1585
|
+
status = `, newly initialized: ${joinIds(started)}`;
|
|
1586
|
+
started.clear();
|
|
1587
|
+
}
|
|
1588
|
+
if (starting.size > 0) {
|
|
1589
|
+
status += `, still initializing: ${joinIds(starting)}`;
|
|
1590
|
+
}
|
|
1591
|
+
return status;
|
|
1592
|
+
};
|
|
1593
|
+
let interval = 1e3;
|
|
1594
|
+
let prevInterval = 0;
|
|
1595
|
+
let timeout;
|
|
1596
|
+
const onTimeout = () => {
|
|
1597
|
+
logger == null ? void 0 : logger.info(`Plugin initialization in progress${getInitStatus()}`);
|
|
1598
|
+
const nextInterval = Math.min(interval + prevInterval, LOGGER_INTERVAL_MAX);
|
|
1599
|
+
prevInterval = interval;
|
|
1600
|
+
interval = nextInterval;
|
|
1601
|
+
timeout = setTimeout(onTimeout, nextInterval);
|
|
1602
|
+
};
|
|
1603
|
+
timeout = setTimeout(onTimeout, interval);
|
|
1604
|
+
return {
|
|
1605
|
+
onPluginStarted(pluginId) {
|
|
1606
|
+
starting.delete(pluginId);
|
|
1607
|
+
started.add(pluginId);
|
|
1608
|
+
},
|
|
1609
|
+
onAllStarted() {
|
|
1610
|
+
logger == null ? void 0 : logger.info(`Plugin initialization complete${getInitStatus()}`);
|
|
1611
|
+
if (timeout) {
|
|
1612
|
+
clearTimeout(timeout);
|
|
1613
|
+
timeout = void 0;
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1567
1619
|
var __accessCheck$8 = (obj, member, msg) => {
|
|
1568
1620
|
if (!member.has(obj))
|
|
1569
1621
|
throw TypeError("Cannot " + msg);
|
|
@@ -1768,6 +1820,10 @@ doStart_fn = async function() {
|
|
|
1768
1820
|
}
|
|
1769
1821
|
}
|
|
1770
1822
|
const allPluginIds = [...pluginInits.keys()];
|
|
1823
|
+
const initLogger = createInitializationLogger(
|
|
1824
|
+
allPluginIds,
|
|
1825
|
+
await __privateGet$6(this, _serviceRegistry).get(backendPluginApi.coreServices.rootLogger, "root")
|
|
1826
|
+
);
|
|
1771
1827
|
await Promise.all(
|
|
1772
1828
|
allPluginIds.map(async (pluginId) => {
|
|
1773
1829
|
await __privateGet$6(this, _serviceRegistry).initializeEagerServicesWithScope(
|
|
@@ -1814,12 +1870,14 @@ doStart_fn = async function() {
|
|
|
1814
1870
|
);
|
|
1815
1871
|
});
|
|
1816
1872
|
}
|
|
1873
|
+
initLogger.onPluginStarted(pluginId);
|
|
1817
1874
|
const lifecycleService2 = await __privateMethod$5(this, _getPluginLifecycleImpl, getPluginLifecycleImpl_fn).call(this, pluginId);
|
|
1818
1875
|
await lifecycleService2.startup();
|
|
1819
1876
|
})
|
|
1820
1877
|
);
|
|
1821
1878
|
const lifecycleService = await __privateMethod$5(this, _getRootLifecycleImpl, getRootLifecycleImpl_fn).call(this);
|
|
1822
1879
|
await lifecycleService.startup();
|
|
1880
|
+
initLogger.onAllStarted();
|
|
1823
1881
|
if (process.env.NODE_ENV !== "test") {
|
|
1824
1882
|
const rootLogger = await __privateGet$6(this, _serviceRegistry).get(
|
|
1825
1883
|
backendPluginApi.coreServices.rootLogger,
|
|
@@ -1948,7 +2006,7 @@ function createSpecializedBackend(options) {
|
|
|
1948
2006
|
const MIGRATIONS_TABLE = "backstage_backend_public_keys__knex_migrations";
|
|
1949
2007
|
const TABLE = "backstage_backend_public_keys__keys";
|
|
1950
2008
|
function applyDatabaseMigrations(knex) {
|
|
1951
|
-
const migrationsDir =
|
|
2009
|
+
const migrationsDir = backendPluginApi.resolvePackagePath(
|
|
1952
2010
|
"@backstage/backend-app-api",
|
|
1953
2011
|
"migrations"
|
|
1954
2012
|
);
|