diff --git a/packages/server/src/__tests__/plugin/landingPage/getEmbeddedExplorerHTML.test.ts b/packages/server/src/__tests__/plugin/landingPage/getEmbeddedExplorerHTML.test.ts
index a61fc412941..76c88a20c87 100644
--- a/packages/server/src/__tests__/plugin/landingPage/getEmbeddedExplorerHTML.test.ts
+++ b/packages/server/src/__tests__/plugin/landingPage/getEmbeddedExplorerHTML.test.ts
@@ -8,28 +8,30 @@ const apolloServerVersion = '@apollo/server@4.0.0';
describe('Embedded Explorer Landing Page Config HTML', () => {
it('with document, variables, headers and displayOptions provided', () => {
- const config: ApolloServerPluginEmbeddedLandingPageProductionDefaultOptions =
- {
- includeCookies: true,
- document: 'query Test { id }',
- variables: {
- option: {
- a: 'val',
- b: 1,
- c: true,
- },
+ const config: ApolloServerPluginEmbeddedLandingPageProductionDefaultOptions & {
+ runtime: string;
+ } = {
+ includeCookies: true,
+ document: 'query Test { id }',
+ variables: {
+ option: {
+ a: 'val',
+ b: 1,
+ c: true,
},
- headers: { authorization: 'true' },
- embed: {
- displayOptions: {
- showHeadersAndEnvVars: true,
- docsPanelState: 'open',
- theme: 'light',
- },
- persistExplorerState: true,
+ },
+ headers: { authorization: 'true' },
+ embed: {
+ displayOptions: {
+ showHeadersAndEnvVars: true,
+ docsPanelState: 'open',
+ theme: 'light',
},
- graphRef: 'graph@current',
- };
+ persistExplorerState: true,
+ },
+ graphRef: 'graph@current',
+ runtime: '@apollo/server@4.0.0',
+ };
expect(getEmbeddedExplorerHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
@@ -49,11 +51,11 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
id="embeddableExplorer"
>
-
`);
});
it('for embedded sandbox with document, variables and headers excluded', () => {
- const config: LandingPageConfig = {
+ const config: LandingPageConfig & { runtime: string } = {
includeCookies: false,
embed: true,
+ runtime: '@apollo/server@4.0.0',
};
expect(getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
@@ -78,7 +81,7 @@ describe('Landing Page Config HTML', () => {
id="embeddableSandbox"
>
-
`);
diff --git a/packages/server/src/plugin/landingPage/default/getEmbeddedHTML.ts b/packages/server/src/plugin/landingPage/default/getEmbeddedHTML.ts
index 0a9879f4c6e..308fb45370e 100644
--- a/packages/server/src/plugin/landingPage/default/getEmbeddedHTML.ts
+++ b/packages/server/src/plugin/landingPage/default/getEmbeddedHTML.ts
@@ -22,7 +22,9 @@ function getConfigStringForHtml(config: LandingPageConfig) {
export const getEmbeddedExplorerHTML = (
explorerCdnVersion: string,
- config: ApolloServerPluginEmbeddedLandingPageProductionDefaultOptions,
+ config: ApolloServerPluginEmbeddedLandingPageProductionDefaultOptions & {
+ runtime: string;
+ },
apolloServerVersion: string,
) => {
interface EmbeddableExplorerOptions {
@@ -50,22 +52,25 @@ export const getEmbeddedExplorerHTML = (
persistExplorerState: false,
...(typeof config.embed === 'boolean' ? {} : config.embed),
};
- const embeddedExplorerParams: Omit =
- {
- graphRef: config.graphRef,
- target: '#embeddableExplorer',
- initialState: {
- document: config.document,
- headers: config.headers,
- variables: config.variables,
- displayOptions: {
- ...productionLandingPageConfigOrDefault.displayOptions,
- },
+ const embeddedExplorerParams: Omit<
+ EmbeddableExplorerOptions,
+ 'endpointUrl'
+ > & { runtime: string } = {
+ graphRef: config.graphRef,
+ target: '#embeddableExplorer',
+ initialState: {
+ document: config.document,
+ headers: config.headers,
+ variables: config.variables,
+ displayOptions: {
+ ...productionLandingPageConfigOrDefault.displayOptions,
},
- persistExplorerState:
- productionLandingPageConfigOrDefault.persistExplorerState,
- includeCookies: config.includeCookies,
- };
+ },
+ persistExplorerState:
+ productionLandingPageConfigOrDefault.persistExplorerState,
+ includeCookies: config.includeCookies,
+ runtime: config.runtime,
+ };
return `
@@ -81,7 +86,7 @@ export const getEmbeddedExplorerHTML = (
style="width: 100vw; height: 100vh; position: absolute; top: 0;"
id="embeddableExplorer"
>
-
+
+
`;
diff --git a/packages/server/src/plugin/landingPage/default/index.ts b/packages/server/src/plugin/landingPage/default/index.ts
index 4a2af3734af..a448e47795c 100644
--- a/packages/server/src/plugin/landingPage/default/index.ts
+++ b/packages/server/src/plugin/landingPage/default/index.ts
@@ -70,7 +70,7 @@ const getNonEmbeddedLandingPageHTML = (
The full landing page cannot be loaded; it appears that you might be offline.
-`;
+`;
};
// Helper for the two actual plugin functions.
@@ -85,7 +85,7 @@ function ApolloServerPluginLandingPageDefault(
const apolloServerVersion = `@apollo/server@${packageVersion}`;
const configWithVersion = {
...config,
- referrer: apolloServerVersion,
+ runtime: apolloServerVersion,
};
return {