Skip to content

Commit a610157

Browse files
authored
chore(server-core): Create a getCompilersInstances public method (#9779)
1 parent 75f4813 commit a610157

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

packages/cubejs-server-core/src/core/CompilerApi.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import crypto from 'crypto';
2-
import { createQuery, compile, queryClass, PreAggregations, QueryFactory } from '@cubejs-backend/schema-compiler';
2+
import {
3+
createQuery,
4+
compile,
5+
queryClass,
6+
PreAggregations,
7+
QueryFactory,
8+
prepareCompiler
9+
} from '@cubejs-backend/schema-compiler';
310
import { v4 as uuidv4, parse as uuidParse } from 'uuid';
411
import { LRUCache } from 'lru-cache';
512
import { NativeInstance } from '@cubejs-backend/native';
@@ -88,6 +95,25 @@ export class CompilerApi {
8895
return this.compilers;
8996
}
9097

98+
/**
99+
* Returns the compilers instances without model compilation,
100+
* because it could fail and no compilers will be returned.
101+
*/
102+
getCompilersInstances() {
103+
if (this.compilers) {
104+
return this.compilers;
105+
}
106+
107+
return prepareCompiler(this.repository, {
108+
allowNodeRequire: this.allowNodeRequire,
109+
compileContext: this.compileContext,
110+
allowJsDuplicatePropsInSchema: this.allowJsDuplicatePropsInSchema,
111+
standalone: this.standalone,
112+
nativeInstance: this.nativeInstance,
113+
compiledScriptCache: this.compiledScriptCache,
114+
});
115+
}
116+
91117
async compileSchema(compilerVersion, requestId) {
92118
const startCompilingTime = new Date().getTime();
93119
try {

0 commit comments

Comments
 (0)