-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
index.ts
113 lines (101 loc) · 2.83 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* Core */
import { DEV } from '../utilities/globals';
export {
ApolloClient,
ApolloClientOptions,
DefaultOptions,
mergeOptions,
} from './ApolloClient';
export {
ObservableQuery,
FetchMoreOptions,
UpdateQueryOptions,
} from './ObservableQuery';
export {
QueryOptions,
WatchQueryOptions,
MutationOptions,
SubscriptionOptions,
FetchPolicy,
WatchQueryFetchPolicy,
ErrorPolicy,
FetchMoreQueryOptions,
SubscribeToMoreOptions,
} from './watchQueryOptions';
export { NetworkStatus } from './networkStatus';
export * from './types';
export {
Resolver,
FragmentMatcher,
} from './LocalState';
export { isApolloError, ApolloError } from '../errors';
/* Cache */
export {
// All the exports (types and values) from ../cache, minus cacheSlot,
// which we want to keep semi-private.
Cache,
ApolloCache,
Transaction,
DataProxy,
InMemoryCache,
InMemoryCacheConfig,
MissingFieldError,
defaultDataIdFromObject,
ReactiveVar,
makeVar,
TypePolicies,
TypePolicy,
FieldPolicy,
FieldReadFunction,
FieldMergeFunction,
FieldFunctionOptions,
PossibleTypesMap,
} from '../cache';
export * from '../cache/inmemory/types';
/* Link */
export * from '../link/core';
export * from '../link/http';
export {
fromError,
toPromise,
fromPromise,
ServerError,
throwServerError,
} from '../link/utils';
/* Utilities */
export {
Observable,
Observer,
ObservableSubscription,
Reference,
isReference,
makeReference,
StoreObject,
} from '../utilities';
/* Supporting */
// The verbosity of invariant.{log,warn,error} can be controlled globally
// (for anyone using the same ts-invariant package) by passing "log",
// "warn", "error", or "silent" to setVerbosity ("log" is the default).
// Note that all invariant.* logging is hidden in production.
import { setVerbosity } from "ts-invariant";
export { setVerbosity as setLogVerbosity }
setVerbosity(DEV ? "log" : "silent");
// Note that importing `gql` by itself, then destructuring
// additional properties separately before exporting, is intentional.
// Due to the way the `graphql-tag` library is setup, certain bundlers
// can't find the properties added to the exported `gql` function without
// additional guidance (e.g. Rollup - see
// https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module).
// Instead of having people that are using bundlers with `@apollo/client` add
// extra bundler config to help `graphql-tag` exports be found (which would be
// awkward since they aren't importing `graphql-tag` themselves), this
// workaround of pulling the extra properties off the `gql` function,
// then re-exporting them separately, helps keeps bundlers happy without any
// additional config changes.
export {
gql,
resetCaches,
disableFragmentWarnings,
enableExperimentalFragmentVariables,
disableExperimentalFragmentVariables,
} from 'graphql-tag';