-
Notifications
You must be signed in to change notification settings - Fork 749
Expand file tree
/
Copy pathGraphQLDependencyTracker.swift
More file actions
45 lines (33 loc) · 1.13 KB
/
GraphQLDependencyTracker.swift
File metadata and controls
45 lines (33 loc) · 1.13 KB
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
#if !COCOAPODS
import ApolloMigrationAPI
#endif
final class GraphQLDependencyTracker: GraphQLResultAccumulator {
let requiresCacheKeyComputation: Bool = true
private var dependentKeys: Set<CacheKey> = Set()
func accept(scalar: JSONValue, info: FieldExecutionInfo) {
dependentKeys.insert(info.cachePath.joined)
}
func accept(customScalar: JSONValue, info: FieldExecutionInfo) {
dependentKeys.insert(info.cachePath.joined)
}
func acceptNullValue(info: FieldExecutionInfo) {
dependentKeys.insert(info.cachePath.joined)
}
func acceptMissingValue(info: FieldExecutionInfo) throws -> () {
dependentKeys.insert(info.cachePath.joined)
}
func accept(list: [Void], info: FieldExecutionInfo) {
dependentKeys.insert(info.cachePath.joined)
}
func accept(childObject: Void, info: FieldExecutionInfo) {
}
func accept(fieldEntry: Void, info: FieldExecutionInfo) -> Void? {
dependentKeys.insert(info.cachePath.joined)
return ()
}
func accept(fieldEntries: [Void], info: ObjectExecutionInfo) {
}
func finish(rootValue: Void, info: ObjectExecutionInfo) -> Set<CacheKey> {
return dependentKeys
}
}