Skip to content
This repository was archived by the owner on Apr 14, 2023. It is now read-only.

Commit 01912e9

Browse files
author
Stephen Barlow
authored
Merge branch 'main' into sb/audit-enums
2 parents d12e6cc + a8e2844 commit 01912e9

File tree

3 files changed

+76
-6
lines changed

3 files changed

+76
-6
lines changed

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"serve": "gatsby serve"
77
},
88
"dependencies": {
9-
"gatsby": "^3.14.6",
10-
"gatsby-theme-apollo-docs": "^6.0.0",
9+
"gatsby": "3.14.6",
10+
"gatsby-theme-apollo-docs": "6.0.0",
1111
"react": "16.13.1",
1212
"react-dom": "16.12.0"
1313
}

studio-docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"serve": "gatsby serve"
77
},
88
"dependencies": {
9-
"gatsby": "^3.14.6",
10-
"gatsby-theme-apollo-docs": "^6.0.0",
9+
"gatsby": "3.14.6",
10+
"gatsby-theme-apollo-docs": "6.0.0",
1111
"react": "16.13.1",
1212
"react-dom": "16.12.0"
1313
}

studio-docs/source/explorer/connecting-authenticating.mdx

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Access-Control-Allow-Credentials: true
2525

2626
## Authentication
2727

28-
The Explorer currently enables you to authenticate via [request headers](#request-headers), [cookies](#cookies), and [preflight scripts](#preflight-scripts-beta).
28+
The Explorer currently enables you to authenticate via [request headers](#request-headers), [cookies](#cookies), and [preflight scripts](#preflight-scripts).
2929

3030
> If your graph has authentication requirements that aren't covered by these options, please contact **[email protected]** with questions or feedback.
3131
@@ -52,7 +52,7 @@ Once configured, requests sent from `https://studio.apollographql.com` will carr
5252

5353
### Environment variables
5454

55-
The bottom panel of the Explorer editor includes an Environment Variables tab. Here, you can provide sensitive information that you can then include in header values or [preflight scripts](#preflight-scripts-beta). This enables you to share operations (including headers) with other team members _without_ exposing sensitive data.
55+
The bottom panel of the Explorer editor includes an Environment Variables tab. Here, you can provide sensitive information that you can then include in header values or [preflight scripts](#preflight-scripts). This enables you to share operations (including headers) with other team members _without_ exposing sensitive data.
5656

5757
For example, you can define a `token` environment variable like so:
5858

@@ -101,6 +101,76 @@ To create a preflight script:
101101

102102
You're done! After you save your script, it's automatically loaded for any team member that uses the Explorer with the associated variant.
103103

104+
#### Preflight script API reference
105+
106+
These functions are available within the scope of a preflight script. Snippets for each are available via the **Show snippets** link in the preflight script dialog.
107+
108+
<table class="field-table api-ref">
109+
<thead>
110+
<tr>
111+
<th>Name /<br/>Type</th>
112+
<th>Description</th>
113+
</tr>
114+
</thead>
115+
116+
<tbody>
117+
118+
<tr>
119+
<td>
120+
121+
##### `explorer.environment.get`
122+
123+
`(key: string) => Readonly`
124+
</td>
125+
<td>
126+
127+
Function that returns the current value of the environment variable with the specified `key`.
128+
</td>
129+
</tr>
130+
131+
<tr>
132+
<td>
133+
134+
##### `explorer.environment.set`
135+
136+
`(key: string, value: JSONValue) => void`
137+
</td>
138+
<td>
139+
140+
Function that sets a new value for the environment variable with the specified `key`.
141+
</td>
142+
</tr>
143+
144+
<tr>
145+
<td>
146+
147+
##### `explorer.fetch`
148+
149+
`(href: string, options?: { method?: string, body?: string | null, headers?: Record<string, string> }) => Promise<{ code: number, body: string, json: () => any }>`
150+
</td>
151+
<td>
152+
153+
Function for making HTTP requests to external services from within a preflight script.
154+
</td>
155+
</tr>
156+
157+
<tr>
158+
<td>
159+
160+
##### `explorer.prompt`
161+
162+
`(msg: string, defaultResponse?: string) => Promise<string | null>`
163+
</td>
164+
<td>
165+
166+
Function that prompts the user for input and returns the value in a promise. If the user cancels the prompt, the promise resolves to `null`.
167+
</td>
168+
</tr>
169+
170+
</tbody>
171+
</table>
172+
173+
104174
#### Disabling preflight scripts
105175

106176
By default, a variant's preflight script runs automatically before every GraphQL operation that's executed in the Explorer. Team members can temporarily disable the script from the **Preflight script** section of the Settings tab. To do so, toggle the switch to **OFF**:

0 commit comments

Comments
 (0)