Skip to content

Commit ed9d06e

Browse files
committed
New api design and filter argument
1 parent a6597cf commit ed9d06e

File tree

2 files changed

+323
-169
lines changed

2 files changed

+323
-169
lines changed

packages/cubejs-api-gateway/src/gateway.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -283,19 +283,23 @@ export class ApiGateway {
283283
const guestMiddlewares = [];
284284

285285
app.use(`${this.basePath}/graphql`, userMiddlewares, (() => {
286-
let schema; // memoized schema
286+
let cache;
287287
return (async (req, res) => {
288-
if (!schema) {
288+
if (!cache) {
289289
const metaConfig = await this.getCompilerApi(req.context).metaConfig({
290290
requestId: req.context.requestId,
291291
});
292-
schema = makeSchema(metaConfig);
292+
cache = {
293+
metaConfig,
294+
schema: makeSchema(metaConfig)
295+
};
293296
}
294297

295298
return graphqlHTTP({
296-
schema,
299+
schema: cache.schema,
297300
context: {
298301
req,
302+
metaConfig: cache.metaConfig,
299303
apiGateway: this
300304
},
301305
graphiql: getEnv('nodeEnv') !== 'production'

0 commit comments

Comments
 (0)