How to use the @cubejs-backend/schema-compiler/compiler/PrepareCompiler.compile function in @cubejs-backend/schema-compiler

To help you get started, we’ve selected a few @cubejs-backend/schema-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cube-js / cube.js / packages / cubejs-server-core / core / CompilerApi.js View on Github external
async getCompilers() {
    let compilerVersion = (
      this.schemaVersion && this.schemaVersion() ||
      'default_schema_version'
    ).toString();
    if (this.options.devServer) {
      const files = await this.repository.dataSchemaFiles();
      compilerVersion += `_${crypto.createHash('md5').update(JSON.stringify(files)).digest("hex")}`;
    }
    if (!this.compilers || this.compilerVersion !== compilerVersion) {
      this.logger(this.compilers ? 'Recompiling schema' : 'Compiling schema', { version: compilerVersion });
      // TODO check if saving this promise can produce memory leak?
      this.compilers = PrepareCompiler.compile(this.repository, {
        allowNodeRequire: this.allowNodeRequire
      });
      this.compilerVersion = compilerVersion;
    }
    return this.compilers;
  }

@cubejs-backend/schema-compiler

Cube schema compiler

Apache-2.0
Latest version published 7 days ago

Package Health Score

89 / 100
Full package analysis