From 0ec735177ddf9d585a6ea84e23618faa714d177b Mon Sep 17 00:00:00 2001 From: David Glasser Date: Thu, 25 Mar 2021 21:14:53 -0700 Subject: [PATCH] docs: sendVariableValues.transform should not mutate (#5061) See #5060. --- docs/source/api/plugin/usage-reporting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/api/plugin/usage-reporting.md b/docs/source/api/plugin/usage-reporting.md index f0106574136..1bcac354154 100644 --- a/docs/source/api/plugin/usage-reporting.md +++ b/docs/source/api/plugin/usage-reporting.md @@ -356,7 +356,7 @@ Specify this function to create a signature for a query. This option is not reco | `{ all: true }` | If you provide this object, **all** GraphQL variable values are sent to Apollo Studio. | | `{ onlyNames: ["apple", "orange"]}`| If you provide an object with this structure, only values of the GraphQL variables with names that appear in the array are sent to Apollo Studio. Case-sensitive. | | `{ exceptNames: ["apple", "orange"]}`| If you provide an object with this structure, all GraphQL variable values **except** values of variables with names that appear in the array are sent to Apollo Studio. Case-sensitive. | -| `{ transform: ({ variables, operationString)} => { ... } }` |

The value of `transform` is a function that takes the values of all GraphQL variables for an operation. The function should modify or delete necessary values in the `variables` map and return the result. You cannot _add_ variables to the map.

For security reasons, if an error occurs in the `transform` function, **all** variable values are replaced with `[PREDICATE_FUNCTION_ERROR]`. | +| `{ transform: ({ variables, operationString)} => { ... } }` |

The value of `transform` is a function that takes the values of all GraphQL variables for an operation and the operation string. The function returns a new variables map containing values for the operation's variables that should be sent to Apollo Studio. This map does not need to contain all of the operation's variables, but it cannot _add_ variables to the map. You should not mutate `variables` itself or any of the values contained in it.

For security reasons, if an error occurs in the `transform` function, **all** variable values are replaced with `[PREDICATE_FUNCTION_ERROR]`. | #### Valid `sendHeaders` object signatures