mirror of
https://github.com/vale981/Vulcan
synced 2025-03-05 09:31:43 -05:00
Merge branch 'apollo2-merge-devel' of https://github.com/lbke/Vulcan into apollo2
This commit is contained in:
commit
d318c69c96
8 changed files with 25 additions and 22 deletions
|
@ -3,7 +3,8 @@ import {ApolloLink} from 'apollo-link';
|
|||
import watchedMutationLink from './links/watchedMutation';
|
||||
import httpLink from './links/http';
|
||||
import meteorAccountsLink from './links/meteor';
|
||||
import {createStateLink, errorLink} from '../../modules/apollo-common';
|
||||
import errorLink from './links/error';
|
||||
import {createStateLink} from '../../modules/apollo-common';
|
||||
import cache from './cache';
|
||||
|
||||
// these links do not change once created
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
export * from './links/state';
|
||||
export {default as errorLink} from './links/error';
|
||||
|
|
|
@ -30,7 +30,10 @@ import {enableSSR} from '../apollo-ssr';
|
|||
|
||||
import universalCookiesMiddleware from 'universal-cookie-express';
|
||||
|
||||
import { getApolloApplyMiddlewareOptions, getApolloServerOptions } from './settings';
|
||||
import {
|
||||
getApolloApplyMiddlewareOptions,
|
||||
getApolloServerOptions,
|
||||
} from './settings';
|
||||
|
||||
import {getSetting} from '../../modules/settings.js';
|
||||
import {formatError} from 'apollo-errors';
|
||||
|
@ -44,9 +47,8 @@ import {formatError} from 'apollo-errors';
|
|||
const createApolloServer = ({
|
||||
apolloServerOptions = {}, // apollo options
|
||||
config = {}, // Vulcan options
|
||||
apolloApplyMiddlewareOptions // apollo.applyMiddleware,
|
||||
apolloApplyMiddlewareOptions, // apollo.applyMiddleware,
|
||||
}) => {
|
||||
|
||||
const initialContext = initContext(apolloServerOptions.context);
|
||||
|
||||
// this replace the previous syntax graphqlExpress(async req => { ... })
|
||||
|
@ -84,7 +86,7 @@ const createApolloServer = ({
|
|||
app: WebApp.connectHandlers,
|
||||
path: config.path,
|
||||
// @see https://www.apollographql.com/docs/apollo-server/api/apollo-server.html#Parameters-2
|
||||
...apolloApplyMiddlewareOptions
|
||||
...apolloApplyMiddlewareOptions,
|
||||
});
|
||||
|
||||
// setup the end point
|
||||
|
@ -147,7 +149,7 @@ Meteor.startup(() => {
|
|||
config: {
|
||||
path: '/graphql',
|
||||
maxAccountsCacheSizeInMB: 1,
|
||||
configServer: apolloServer => { },
|
||||
configServer: apolloServer => {},
|
||||
voyagerPath: '/graphql-voyager',
|
||||
graphiqlPath: '/graphiql',
|
||||
// customConfigFromReq
|
||||
|
@ -157,9 +159,9 @@ Meteor.startup(() => {
|
|||
formatError,
|
||||
tracing: getSetting('apolloTracing', Meteor.isDevelopment),
|
||||
cacheControl: true,
|
||||
...getApolloServerOptions()
|
||||
...getApolloServerOptions(),
|
||||
},
|
||||
apolloApplyMiddlewareOptions: getApolloApplyMiddlewareOptions()
|
||||
apolloApplyMiddlewareOptions: getApolloApplyMiddlewareOptions(),
|
||||
// config: ....
|
||||
// contextFromReq: ....
|
||||
});
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export * from './apollo_server2';
|
||||
export * from './settings';
|
||||
export * from './settings';
|
||||
|
|
|
@ -12,19 +12,20 @@ import _merge from 'lodash/merge';
|
|||
//);
|
||||
// registerSetting('apolloServer.jsonParserOptions.limit', undefined, 'DEPRECATED bodyParser jsonParser limit');
|
||||
|
||||
// NOTE: some option can be functions, so they cannot be
|
||||
// NOTE: some option can be functions, so they cannot be
|
||||
// defined as Meteor settings, which are pure JSON (no function)
|
||||
|
||||
// @see https://www.apollographql.com/docs/apollo-server/api/apollo-server.html#constructor-options-lt-ApolloServer-gt
|
||||
let apolloServerOptions = { };
|
||||
export const registerApolloServerOptions = (options) => {
|
||||
apolloServerOptions = _merge(apolloServerOptions, options);
|
||||
let apolloServerOptions = {};
|
||||
export const registerApolloServerOptions = options => {
|
||||
apolloServerOptions = _merge(apolloServerOptions, options);
|
||||
};
|
||||
export const getApolloServerOptions = () => apolloServerOptions;
|
||||
|
||||
// @see https://www.apollographql.com/docs/apollo-server/api/apollo-server.html#Parameters-2
|
||||
let apolloApplyMiddlewareOptions = { };
|
||||
export const registerApolloApplyMiddlewareOptions = (options) => {
|
||||
apolloApplyMiddlewareOptions = _merge(apolloApplyMiddlewareOptions, options);
|
||||
let apolloApplyMiddlewareOptions = {};
|
||||
export const registerApolloApplyMiddlewareOptions = options => {
|
||||
apolloApplyMiddlewareOptions = _merge(apolloApplyMiddlewareOptions, options);
|
||||
};
|
||||
export const getApolloApplyMiddlewareOptions = () => apolloApplyMiddlewareOptions;
|
||||
export const getApolloApplyMiddlewareOptions = () =>
|
||||
apolloApplyMiddlewareOptions;
|
||||
|
|
|
@ -11,7 +11,7 @@ import {InMemoryCache} from 'apollo-cache-inmemory';
|
|||
import {SchemaLink} from 'apollo-link-schema';
|
||||
import {GraphQLSchema} from '../../modules/graphql.js';
|
||||
|
||||
import {createStateLink, errorLink} from '../../modules/apollo-common';
|
||||
import {createStateLink} from '../../modules/apollo-common';
|
||||
import {ApolloLink} from 'apollo-link';
|
||||
|
||||
// @see https://www.apollographql.com/docs/react/features/server-side-rendering.html#local-queries
|
||||
|
@ -30,7 +30,7 @@ export const createClient = async ({req, computeContext}) => {
|
|||
const schemaLink = new SchemaLink({schema, context});
|
||||
const client = new ApolloClient({
|
||||
ssrMode: true,
|
||||
link: ApolloLink.from([stateLink, errorLink, schemaLink]),
|
||||
link: ApolloLink.from([stateLink, schemaLink]),
|
||||
// @see https://www.apollographql.com/docs/react/features/server-side-rendering.html#local-queries
|
||||
// Remember that this is the interface the SSR server will use to connect to the
|
||||
// API server, so we need to ensure it isn't firewalled, etc
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// see https://github.com/apollographql/graphql-tools/blob/master/docs/source/schema-directives.md#marking-strings-for-internationalization
|
||||
|
||||
import {addGraphQLDirective, addGraphQLSchema} from '../modules/graphql';
|
||||
import {SchemaDirectiveVisitor} from 'apollo-server';
|
||||
import {SchemaDirectiveVisitor} from 'graphql-tools';
|
||||
import {defaultFieldResolver} from 'graphql';
|
||||
import {Collections} from '../modules/collections';
|
||||
import {getSetting} from '../modules/settings';
|
||||
|
@ -79,7 +79,7 @@ Migration function
|
|||
const migrateIntlFields = async defaultLocale => {
|
||||
if (!defaultLocale) {
|
||||
throw new Error(
|
||||
"Please pass the id of the locale to which to migrate your current content (e.g. migrateIntlFields('en'))"
|
||||
'Please pass the id of the locale to which to migrate your current content (e.g. migrateIntlFields(\'en\'))'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue