-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathunleash.interfaces.ts
75 lines (64 loc) · 1.97 KB
/
unleash.interfaces.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { ModuleMetadata, Provider, Type } from '@nestjs/common'
import { AxiosRequestConfig } from 'axios'
import { Request as ExpressRequest } from 'express'
import { Request, UnleashStrategy } from '../unleash-strategies'
export interface UnleashModuleOptions {
/**
* If "true", registers `UnleashModule` as a global module.
* See: https://docs.nestjs.com/modules#global-modules
*
* @default true
*/
global?: boolean
/**
* URL of your Unleash server
*
* @example http://unleash.herokuapp.com/api/client
*/
url: string
/**
* Name of the application seen by unleash-server
*/
appName: string
/**
* Instance id for this application (typically hostname, podId or similar)
*/
instanceId: string
/**
* Additional options for the HTTP request to the Unleash server, e.g. custom
* HTTP headers
*/
http?: AxiosRequestConfig
/**
* At which interval, in milliseconds, will this client update its feature
* state
*/
refreshInterval?: number
/**
* At which interval, in milliseconds, will this client send metrics
*/
metricsInterval?: number
/**
* Array of custom strategies. These classes mus implement the `UnleashStrategy` interface.
*/
strategies?: Type<UnleashStrategy>[]
/**
* `nestjs-unleash` sends an initial registration request to the unleash server at startup. This behavior can be disabled by this option.
*/
disableRegistration?: boolean
/**
* Some strategies depend on the user ID of the currently logged in user. The
* user ID is expected by default in `request.user.id`. To customize this
* behavior, a custom user ID factory can be provided.
*/
userIdFactory?: (request: ExpressRequest | Request<{ id: string }>) => string
}
export interface UnleashModuleAsyncOptions
extends Pick<ModuleMetadata, 'imports'> {
global?: boolean
extraProviders?: Provider[]
inject?: any[]
useFactory?: (
...args: any[]
) => Promise<UnleashModuleOptions> | UnleashModuleOptions
}