@@ -2,4 +2,10 @@
|
||||
'@backstage/backend-common': patch
|
||||
---
|
||||
|
||||
Added a `Context` type for the backend, that can propagate an abort signal, a deadline, and contextual values through the call stack. The main entrypoint is the `Contexts` utility class that provides a root context creator and commonly used decorators.
|
||||
Added a `Context` type for the backend, that can propagate an abort signal, a
|
||||
deadline, and contextual values through the call stack. The main entrypoint is
|
||||
the `Contexts` utility class that provides a root context creator and commonly
|
||||
used decorators.
|
||||
|
||||
These are marked as `@alpha` for now, and are therefore only accessible via
|
||||
`@backstage/backend-common/alpha`.
|
||||
|
||||
@@ -147,14 +147,14 @@ export interface ContainerRunner {
|
||||
runContainer(opts: RunContainerOptions): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export interface Context {
|
||||
readonly abortSignal: AbortSignal_2;
|
||||
readonly deadline: Date | undefined;
|
||||
value<T = unknown>(key: string): T | undefined;
|
||||
}
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export class Contexts {
|
||||
static root(): Context;
|
||||
static withAbort(
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"main": "dist/index.cjs.js",
|
||||
"types": "dist/index.d.ts"
|
||||
"types": "dist/index.d.ts",
|
||||
"alphaTypes": "dist/index.alpha.d.ts"
|
||||
},
|
||||
"homepage": "https://backstage.io",
|
||||
"repository": {
|
||||
@@ -21,7 +22,7 @@
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"build": "backstage-cli build --outputs cjs,types",
|
||||
"build": "backstage-cli build --experimental-type-build --outputs cjs,types",
|
||||
"lint": "backstage-cli lint",
|
||||
"test": "backstage-cli test",
|
||||
"prepack": "backstage-cli prepack",
|
||||
@@ -111,7 +112,8 @@
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"config.d.ts"
|
||||
"config.d.ts",
|
||||
"alpha"
|
||||
],
|
||||
"configSchema": "config.d.ts"
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import { ValueContext } from './ValueContext';
|
||||
/**
|
||||
* Common context decorators.
|
||||
*
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export class Contexts {
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@ import { AbortSignal } from 'node-abort-controller';
|
||||
* A context that is meant to be passed as a ctx variable down the call chain,
|
||||
* to pass along scoped information and abort signals.
|
||||
*
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export interface Context {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user