/
index.ts
111 lines (101 loc) · 3.17 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
/* Core */
export type { ApolloClientOptions, DefaultOptions } from "./ApolloClient.js";
export { ApolloClient, mergeOptions } from "./ApolloClient.js";
export type {
FetchMoreOptions,
UpdateQueryOptions,
} from "./ObservableQuery.js";
export { ObservableQuery } from "./ObservableQuery.js";
export type {
QueryOptions,
WatchQueryOptions,
MutationOptions,
SubscriptionOptions,
FetchPolicy,
WatchQueryFetchPolicy,
MutationFetchPolicy,
RefetchWritePolicy,
ErrorPolicy,
FetchMoreQueryOptions,
SubscribeToMoreOptions,
} from "./watchQueryOptions.js";
export { NetworkStatus, isNetworkRequestSettled } from "./networkStatus.js";
export * from "./types.js";
export type { Resolver, FragmentMatcher } from "./LocalState.js";
export { isApolloError, ApolloError } from "../errors/index.js";
/* Cache */
export type {
// All the exports (types) from ../cache, minus cacheSlot,
// which we want to keep semi-private.
Transaction,
DataProxy,
InMemoryCacheConfig,
ReactiveVar,
TypePolicies,
TypePolicy,
FieldPolicy,
FieldReadFunction,
FieldMergeFunction,
FieldFunctionOptions,
PossibleTypesMap,
} from "../cache/index.js";
export {
Cache,
ApolloCache,
InMemoryCache,
MissingFieldError,
defaultDataIdFromObject,
makeVar,
} from "../cache/index.js";
export * from "../cache/inmemory/types.js";
/* Link */
export * from "../link/core/index.js";
export * from "../link/http/index.js";
export type { ServerError } from "../link/utils/index.js";
export {
fromError,
toPromise,
fromPromise,
throwServerError,
} from "../link/utils/index.js";
/* Utilities */
export type {
DocumentTransformCacheKey,
Observer,
ObservableSubscription,
Reference,
StoreObject,
} from "../utilities/index.js";
export {
DocumentTransform,
Observable,
isReference,
makeReference,
} from "../utilities/index.js";
/* 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";