/
index.ts
74 lines (62 loc) · 2.03 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
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
import * as context from './context'
import { checkGlobals } from './utils/internal/checkGlobals'
export { context }
export { setupWorker } from './setupWorker/setupWorker'
export { SetupApi } from './SetupApi'
export {
response,
defaultResponse,
createResponseComposition,
} from './response'
/* Request handlers */
export { RequestHandler, defaultContext } from './handlers/RequestHandler'
export { rest } from './rest'
export { RestHandler, RESTMethods, restContext } from './handlers/RestHandler'
export { graphql } from './graphql'
export { GraphQLHandler, graphqlContext } from './handlers/GraphQLHandler'
/* Utils */
export { matchRequestUrl } from './utils/matching/matchRequestUrl'
export { compose } from './utils/internal/compose'
export * from './utils/handleRequest'
export { cleanUrl } from './utils/url/cleanUrl'
/**
* Type definitions.
*/
export type { SetupWorkerApi, StartOptions } from './setupWorker/glossary'
export type { SharedOptions } from './sharedOptions'
export * from './utils/request/MockedRequest'
export type {
ResponseResolver,
ResponseResolverReturnType,
AsyncResponseResolverReturnType,
DefaultBodyType,
DefaultRequestMultipartBody,
} from './handlers/RequestHandler'
export type {
MockedResponse,
ResponseTransformer,
ResponseComposition,
ResponseCompositionOptions,
ResponseFunction,
} from './response'
export type {
RestRequest,
RestContext,
RequestQuery,
ParsedRestRequest,
} from './handlers/RestHandler'
export type {
GraphQLContext,
GraphQLVariables,
GraphQLRequest,
GraphQLRequestBody,
GraphQLJsonRequestBody,
} from './handlers/GraphQLHandler'
export type { Path, PathParams, Match } from './utils/matching/matchRequestUrl'
export type { DelayMode } from './context/delay'
export { ParsedGraphQLRequest } from './utils/internal/parseGraphQLRequest'
// Validate environmental globals before executing any code.
// This ensures that the library gives user-friendly errors
// when ran in the environments that require additional polyfills
// from the end user.
checkGlobals()