UNPKG

1.04 kBTypeScriptView Raw
1/**
2 * @publicApi
3 */
4export declare enum Scope {
5 /**
6 * The provider can be shared across multiple classes. The provider lifetime
7 * is strictly tied to the application lifecycle. Once the application has
8 * bootstrapped, all providers have been instantiated.
9 */
10 DEFAULT = 0,
11 /**
12 * A new private instance of the provider is instantiated for every use
13 */
14 TRANSIENT = 1,
15 /**
16 * A new instance is instantiated for each request processing pipeline
17 */
18 REQUEST = 2
19}
20/**
21 * @publicApi
22 *
23 * @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
24 */
25export interface ScopeOptions {
26 /**
27 * Specifies the lifetime of an injected Provider or Controller.
28 */
29 scope?: Scope;
30 /**
31 * Flags provider as durable. This flag can be used in combination with custom context id
32 * factory strategy to construct lazy DI subtrees.
33 *
34 * This flag can be used only in conjunction with scope = Scope.REQUEST.
35 */
36 durable?: boolean;
37}