@@ -39,79 +39,103 @@ const client = new ApolloClient({
39
39
```
40
40
41
41
## Options
42
- ``` js
43
- const defaultOptions = {
42
+ ``` typescript
43
+ export interface FullOptions {
44
+ /**
45
+ * Determines if the given operation should be handled or discarded.
46
+ *
47
+ * If undefined, all operations will be included.
48
+ */
49
+ shouldHandleOperation: undefined | ((operation : Operation ) => boolean );
50
+
51
+ /**
52
+ * The uri of the GraphQL endpoint.
53
+ *
54
+ * Used to add context information, e.g. to breadcrumbs.
55
+ */
56
+ uri: undefined | string ;
57
+
58
+ /**
59
+ * Set the Sentry transaction name to the GraphQL operation name.
60
+ *
61
+ * May be overwritten by other parts of your app.
62
+ */
63
+ setTransaction: true | false ;
64
+
65
+ /**
66
+ * Narrow Sentry's fingerprint by appending the GraphQL operation name to the {{default}} key.
67
+ *
68
+ * Only the last executed operation will be added, not every operation that's been through the link.
69
+ * May be overwritten by other parts of your app.
70
+ */
71
+ setFingerprint: true | false ;
72
+
73
+ /**
74
+ * Attach a breadcrumb for executed GraphQL operations.
75
+ *
76
+ * The following information will be included by default:
77
+ * {
78
+ * type: 'http',
79
+ * category: `graphql.${operationType}`,
80
+ * message: operationName,
81
+ * level: errors ? 'error' : 'info',
82
+ * }
83
+ */
84
+ attachBreadcrumbs: AttachBreadcrumbsOptions | false ;
85
+ }
86
+
87
+ export type AttachBreadcrumbsOptions = {
88
+ /**
89
+ * Include the full query string?
90
+ */
91
+ includeQuery: false | true ;
92
+
93
+ /**
94
+ * Include the variable values?
95
+ *
96
+ * Be careful not to leak sensitive information or send too much data.
97
+ */
98
+ includeVariables: false | true ;
99
+
100
+ /**
101
+ * Include the fetched result (data, errors, extensions)?
102
+ *
103
+ * Be careful not to leak sensitive information or send too much data.
104
+ */
105
+ includeFetchResult: false | true ;
106
+
44
107
/**
45
- * Set the Sentry `transaction` to the `operationName` of the query / mutation. Note that this
46
- * only works if the transaction is not overwritten later in your app.
108
+ * Include the response error?
109
+ *
110
+ * Be careful not to leak sensitive information or send too much data.
47
111
*/
48
- setTransaction : true ,
112
+ includeError : false | true ;
49
113
50
114
/**
51
- * Narrow Sentry's fingerprint by appending the operation's name to Sentry's {{default}} key.
52
- * It works in such a way that only the last operation is added, not every operation that's been
53
- * through the link. Note that if you override this somewhere else in your app, it is possible
54
- * that the value set by `apollo-link-sentry` is overwritten .
115
+ * Include the contents of the Apollo Client cache?
116
+ *
117
+ * This is mostly useful for debugging purposes and not recommended for production environments,
118
+ * see "Be careful what you include", unless carefully combined with `beforeBreadcrumb` .
55
119
*/
56
- setFingerprint: true ,
57
-
58
- breadcrumb: {
59
- /**
60
- * Set to false to disable attaching GraphQL operations as breadcrumbs. If only this breadcrumb
61
- * option is toggled, the breadcrumb will only show the operation name and it's type.
62
- */
63
- enable: true ,
64
-
65
- /**
66
- * Include the query / mutation string in the breadcrumb.
67
- */
68
- includeQuery: false ,
69
-
70
- /**
71
- * Include the entire Apollo cache in the breadcrumb. It is not recommended to enable this
72
- * option in production environment, for several reasons, see "Be careful what you include".
73
- * This option is specifically useful for debugging purposes, but when applied in combination
74
- * with `beforeBreadcrumb` can also be used in production.
75
- */
76
- includeCache: false ,
77
-
78
- /**
79
- * Include the operation's variables in the breadcrumb. Again, be careful what you include,
80
- * or apply a filter.
81
- */
82
- includeVariables: false ,
83
-
84
- /**
85
- * Include the operation's fetch result in the breadcrumb.
86
- */
87
- includeResponse: false ,
88
-
89
- /**
90
- * If an error is received, it can be included in the breadcrumb. Regardless of this option,
91
- * the breadcrumb's type is set to error to reflect a failed operation in the Sentry UI.
92
- */
93
- includeError: false ,
94
-
95
- /**
96
- * Include context keys as extra data in the breadcrumb. Accepts dot notation.
97
- * The data is stringified and formatted. Can be used to include headers for instance.
98
- */
99
- includeContextKeys: [],
100
- },
120
+ includeCache: false | true ;
101
121
102
122
/**
103
- * Provide a callback function which receives an instance of this package's Operation class
104
- * Only operations that pass the test are sent to Sentry. Leave undefined if you want all
105
- * operations to pass. See PR #9 for more details.
123
+ * Include arbitrary data from the `ApolloContext`?
124
+ *
125
+ * Accepts a list of keys in dot notation, e.g. `foo.bar`. Can be useful to include extra
126
+ * information such as headers.
106
127
*/
107
- filter : ( operation ) => true ,
128
+ includeContext : false | NonEmptyArray < string >;
108
129
109
130
/**
110
- * Provide a callback function which receives an instance of this package's OperationBreadcrumb class
111
- * Use it to modify the data that is added to the breadcrumb. Leave undefined if you want all
112
- * data to be included. Very useful in combination with options like includeVariables and includeContextKeys.
131
+ * Modify the breadcrumb right before it is sent.
132
+ *
133
+ * Can be used to add additional data from the operation or clean up included data.
134
+ * Very useful in combination with options like `includeVariables` and `includeContextKeys`.
113
135
*/
114
- beforeBreadcrumb : (breadcrumb ) => breadcrumb,
136
+ transform:
137
+ | undefined
138
+ | ((breadcrumb : GraphQLBreadcrumb , operation : Operation ) => Breadcrumb );
115
139
};
116
140
```
117
141
0 commit comments