playground.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.createPlaygroundOptions = exports.defaultPlaygroundOptions = void 0;
  4. const playgroundVersion = '1.7.42';
  5. exports.defaultPlaygroundOptions = {
  6. version: playgroundVersion,
  7. settings: {
  8. 'general.betaUpdates': false,
  9. 'editor.theme': 'dark',
  10. 'editor.cursorShape': 'line',
  11. 'editor.reuseHeaders': true,
  12. 'tracing.hideTracingResponse': true,
  13. 'queryPlan.hideQueryPlanResponse': true,
  14. 'editor.fontSize': 14,
  15. 'editor.fontFamily': `'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace`,
  16. 'request.credentials': 'omit',
  17. },
  18. };
  19. function createPlaygroundOptions(playground) {
  20. const isDev = process.env.NODE_ENV !== 'production';
  21. const enabled = typeof playground !== 'undefined' ? !!playground : isDev;
  22. if (!enabled) {
  23. return undefined;
  24. }
  25. const playgroundOverrides = typeof playground === 'boolean' ? {} : playground || {};
  26. const settingsOverrides = playgroundOverrides.hasOwnProperty('settings')
  27. ? {
  28. settings: Object.assign(Object.assign({}, exports.defaultPlaygroundOptions.settings), playgroundOverrides.settings),
  29. }
  30. : { settings: undefined };
  31. const playgroundOptions = Object.assign(Object.assign(Object.assign({}, exports.defaultPlaygroundOptions), playgroundOverrides), settingsOverrides);
  32. return playgroundOptions;
  33. }
  34. exports.createPlaygroundOptions = createPlaygroundOptions;
  35. //# sourceMappingURL=playground.js.map