Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEBULA-1385: Add initialState to embedable sandbox based on config #6628

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -10,7 +10,7 @@ The version headers in this history reflect the versions of Apollo Server itself

## vNEXT

- Nothing yet! Stay tuned.
- Add `document`, `variables`, `headers` as an option in the `ApolloServerPluginLandingPageLocalDefault` plugins. The embedded version of Apollo Sandbox can now use these options as an initial state. [PR #6398](https://github.com/apollographql/apollo-server/pull/6628)
William010x marked this conversation as resolved.
Show resolved Hide resolved

## v3.9.0

Expand Down
48 changes: 47 additions & 1 deletion docs/source/api/plugin/landing-pages.md
Expand Up @@ -106,6 +106,52 @@ By default, the landing page displays a footer that links to the documentation t
<tr>
<td>

###### `document`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do these get passed through to sandbox in the regular landing page? We were just missing them before but they are supported right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup! they were always in ApolloServerPluginLandingPageDefaultBaseOptions, but just not mentioned in the docs


`string`
</td>
<td>

A GraphQL document (eg, query or mutation) to populate in the Studio Explorer's editor on load.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A GraphQL document (eg, query or mutation) to populate in the Studio Explorer's editor on load.
A GraphQL document (eg, query or mutation) to populate in the Studio Sandbox Explorer's editor on load.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want to add this? This API applies to both sandbox and explorer, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the local dev docs, so they will only ever lead to sandbox afaict

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no strong opinion tho!


If you omit this, the Explorer initially loads an example query based on your schema.

</td>
</tr>

<tr>
<td>

###### `variables`

`Record<string, string | Record>`
</td>
<td>

An object containing initial variable values to populate in the Explorer on load.

If provided, these variables should apply to the initial query you provide in `document`.

</td>
</tr>

<tr>
<td>

###### `headers`

`Record<string, string>`
</td>
<td>

An object containing initial HTTP header values to populate in the Explorer on load.

</td>
</tr>

<tr>
<td>

###### `includeCookies`

`boolean`
Expand Down Expand Up @@ -228,7 +274,7 @@ If you omit this, the Explorer initially loads an example query based on your sc

###### `variables`

`Record<string, string>`
`Record<string, string | Record>`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the right hand side here should just be unknown or any? i mean you can put numbers and bools and lists in variables...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ticket was for a new config (initialState) recently added to the embedded-explorer repo. These parameters (document, variables and headers) already existed, but yeah they weren't used or passed through for embedded Sandbox.

The parameters were added and the docs were updated accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this change in #6656

</td>
<td>

Expand Down
182 changes: 182 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -108,6 +108,7 @@
"jest-config": "28.1.1",
"jest-junit": "13.2.0",
"jest-mock-random": "1.1.1",
"jest-serializer-html": "^7.1.0",
"js-sha256": "0.9.0",
"koa": "2.13.4",
"koa-router": "10.1.1",
Expand Down