forked from omakoleg/toguru-client-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
47 lines (42 loc) · 1.42 KB
/
index.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
import _client, { TogglingApi } from './src/client'
import * as _expressBridge from './src/express/bridge'
import * as extractors from './src/express/extractors'
import { stubClient, stubMiddleware } from './src/express/testHelpers'
// Type exports
export { Toggle } from './src/models/Toggle'
export { ToggleState } from './src/models/ToggleState'
export { Toggles } from './src/models/Toggles'
export { ActivationContext } from './src/models/toguru'
export { ToguruClientConfig, TogglingApi, TogglingApiByActivationContext } from './src/client'
export { ExpressConfig } from './src/express/bridge'
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Express {
interface Request {
toguru?: TogglingApi
}
}
}
export const toguruClient = _client
export const toguruTestHelpers = {
express: {
stubMiddleware,
stubClient,
},
}
export const toguruExpressBridge = {
middleware: _expressBridge.middleware,
client: _expressBridge.expressClient,
/**
* Helper methods to extract information from the `Request`
*/
requestExtractors: {
cookieValue: extractors.cookieValue,
forcedToggles: {
fromCookie: extractors.fromCookie,
fromHeader: extractors.fromHeader,
fromQueryParam: extractors.fromQueryParam,
default: extractors.defaultForcedTogglesExtractor,
},
},
}