@@ -12,8 +12,21 @@ function isOperation(
1212 * Determine if a document is a mutation document.
1313 *
1414 * @param document - The GraphQL document to check
15+ * @returns A boolean indicating if the document is a mutation operation
1516 *
16- * @since 3.8.0
17+ * @example
18+ *
19+ * ```ts
20+ * import { isMutationOperation } from "@apollo/client/utilities";
21+ *
22+ * const mutation = gql`
23+ * mutation MyMutation {
24+ * # ...
25+ * }
26+ * `;
27+ *
28+ * isMutationOperation(mutation); // true
29+ * ```
1730 */
1831export function isMutationOperation ( document : DocumentNode ) {
1932 return isOperation ( document , "mutation" ) ;
@@ -23,8 +36,21 @@ export function isMutationOperation(document: DocumentNode) {
2336 * Determine if a document is a query document.
2437 *
2538 * @param document - The GraphQL document to check
39+ * @returns A boolean indicating if the document is a query operation
40+ *
41+ * @example
42+ *
43+ * ```ts
44+ * import { isQueryOperation } from "@apollo/client/utilities";
2645 *
27- * @since 3.8.0
46+ * const query = gql`
47+ * query MyQuery {
48+ * # ...
49+ * }
50+ * `;
51+ *
52+ * isQueryOperation(query); // true
53+ * ```
2854 */
2955export function isQueryOperation ( document : DocumentNode ) {
3056 return isOperation ( document , "query" ) ;
@@ -34,8 +60,21 @@ export function isQueryOperation(document: DocumentNode) {
3460 * Determine if a document is a subscription document.
3561 *
3662 * @param document - The GraphQL document to check
63+ * @returns A boolean indicating if the document is a subscription operation
64+ *
65+ * @example
66+ *
67+ * ```ts
68+ * import { isSubscriptionOperation } from "@apollo/client/utilities";
69+ *
70+ * const subscription = gql`
71+ * subscription MySubscription {
72+ * # ...
73+ * }
74+ * `;
3775 *
38- * @since 3.8.0
76+ * isSubscriptionOperation(subscription); // true
77+ * ```
3978 */
4079export function isSubscriptionOperation ( document : DocumentNode ) {
4180 return isOperation ( document , "subscription" ) ;
0 commit comments