Skip to content

Commit

Permalink
chore(core): Fix some types and docs for GraphiQL playground
Browse files Browse the repository at this point in the history
  • Loading branch information
toBeOfUse committed Nov 30, 2024
1 parent 4a197e0 commit fc18ae8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 23 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/api/config/configure-graphql-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface GraphQLApiOptions {
typePaths: string[];
apiPath: string;
debug: boolean;
playground: boolean | any;
playground: boolean;
// eslint-disable-next-line @typescript-eslint/ban-types
resolverModule: Function;
validationRules: Array<(context: ValidationContext) => any>;
Expand Down Expand Up @@ -141,7 +141,8 @@ async function createGraphQLOptions(
// manually configure the graphql-upload package. See https://github.com/vendure-ecommerce/vendure/issues/396
uploads: false,
// similarly, the built-in playground is outdated and buggy, so we
// replace it with `GraphiQLPlugin` in the `plugins` array
// replace it with `GraphiQLPlugin` in the `plugins` array if
// `options.playground` is true
// https://github.com/vendure-ecommerce/vendure/issues/3244
playground: false,
csrfPrevention: false,
Expand Down
15 changes: 6 additions & 9 deletions packages/core/src/config/vendure-config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ApolloServerPlugin } from '@apollo/server';
import { RenderPageOptions } from '@apollographql/graphql-playground-html';
import { DynamicModule, Type } from '@nestjs/common';
import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.interface';
import { LanguageCode } from '@vendure/common/lib/generated-types';
Expand Down Expand Up @@ -96,32 +95,30 @@ export interface ApiOptions {
shopApiPath?: string;
/**
* @description
* The playground config to the admin GraphQL API
* [ApolloServer playground](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#constructoroptions-apolloserver).
* Whether to display the admin API's GraphiQL interface
* [GraphiQL](https://github.com/graphql/graphiql/).
*
* @default false
*/
adminApiPlayground?: boolean | RenderPageOptions;
adminApiPlayground?: boolean;
/**
* @description
* The playground config to the shop GraphQL API
* [ApolloServer playground](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#constructoroptions-apolloserver).
* Whether to display the shop API's GraphiQL interface.
* [GraphiQL](https://github.com/graphql/graphiql/).
*
* @default false
*/
shopApiPlayground?: boolean | RenderPageOptions;
shopApiPlayground?: boolean;
/**
* @description
* The debug config to the admin GraphQL API
* [ApolloServer playground](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#constructoroptions-apolloserver).
*
* @default false
*/
adminApiDebug?: boolean;
/**
* @description
* The debug config to the shop GraphQL API
* [ApolloServer playground](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#constructoroptions-apolloserver).
*
* @default false
*/
Expand Down
12 changes: 2 additions & 10 deletions packages/dev-server/dev-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,10 @@ export const devConfig: VendureConfig = {
apiOptions: {
port: API_PORT,
adminApiPath: ADMIN_API_PATH,
adminApiPlayground: {
settings: {
'request.credentials': 'include',
},
},
adminApiPlayground: false,
adminApiDebug: true,
shopApiPath: SHOP_API_PATH,
shopApiPlayground: {
settings: {
'request.credentials': 'include',
},
},
shopApiPlayground: false,
shopApiDebug: true,
},
authOptions: {
Expand Down
2 changes: 1 addition & 1 deletion packages/harden-plugin/src/harden.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { HardenPluginOptions } from './types';
*
* - It analyzes the complexity on incoming graphql queries and rejects queries that are too complex and
* could be used to overload the resources of the server.
* - It disables dev-mode API features such as introspection and the GraphQL playground app.
* - It disables dev-mode API features such as introspection and the GraphiQL playground app.
* - It removes field name suggestions to prevent trial-and-error schema sniffing.
*
* It is a recommended plugin for all production configurations.
Expand Down
2 changes: 1 addition & 1 deletion packages/harden-plugin/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export interface HardenPluginOptions {
* When set to `'prod'`, the plugin will disable dev-mode features of the GraphQL APIs:
*
* - introspection
* - GraphQL playground
* - GraphiQL playground
*
* @default 'prod'
*/
Expand Down

0 comments on commit fc18ae8

Please sign in to comment.