forked from PrestaShopCorp/nestjs-context
-
Notifications
You must be signed in to change notification settings - Fork 0
/
context-config.type.ts
38 lines (37 loc) · 993 Bytes
/
context-config.type.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { ModuleMetadata } from '@nestjs/common';
import { RouteInfo } from '@nestjs/common/interfaces';
import { BuildContextType } from './build-context.type';
import { ContextName } from './context-name.enum';
type CommonConfig = {
cached?: boolean;
addDefaults?: boolean;
providers?: ModuleMetadata['providers'];
imports?: ModuleMetadata['imports'];
correlation_id?: {
routes?: RouteInfo;
header?: string;
};
};
export type ContextConfigType = CommonConfig &
(
| {
type: ContextName.HTTP;
build: BuildContextType<ContextName.HTTP>;
}
| {
type: ContextName.GQL_HTTP;
build: BuildContextType<ContextName.GQL_HTTP>;
}
| {
type: ContextName.GQL_WS;
build: BuildContextType<ContextName.GQL_WS>;
}
| {
type: ContextName.RPC;
build: BuildContextType<ContextName.RPC>;
}
| {
type: ContextName.WS;
build: BuildContextType<ContextName.WS>;
}
);