Search code examples
wakanda

cannot find the datastore during the compiling in Angular2


When I try to run my page in Wakanda studio 1.1.3, I am getting an error during the compiling when converting the TS to JS. It shows me an error stating "cannot find the datastore"; which is present in my wakanda database. Is anyone else getting the same error?

here is the code:

this.wakanda.catalog.then(ds=>{
    ds.TestDatabase.testmethod().then(op=>{
        console.log(op);
    });
});

my wakanda.service.ts is of the following

import {WakandaClient} from 'wakanda-client/browser/no-promise';

export class Wakanda {

  private _client: WakandaClient;
  private _catalog;

  constructor() {
    //this._client = new WakandaClient({ host: 'http://127.0.0.1:8081' });
    this._client = new WakandaClient({});
    this._catalog = null;
  }

  get catalog() {
    if (!this._catalog) {
      return this._client.getCatalog().then(c => {
        this._catalog = c;

        return c;
      });
    }

    return Promise.resolve(this._catalog);
  }

  get directory() {
    return this._client.directory;
  }

  get wakandaClientVersion() {
    return this._client.version();
  }
}

where TestDatavase is a table in my datastore and has a method called testmethod.

[default] /Users/adithyavinayak/Documents/Wakanda/solutions/TestDatabase/TestDatabase/web/src/app/home/home.component.ts:21:8 Property 'TestDatabase' does not exist on type 'Catalog'. [default] Checking finished with 4 errors

image

This one happens even if i make a call to any datastore during compile time.


Solution

  • The solution for this problem is by using the return type of the catalog to any

    this.wakanda.catalog.then((ds:any)=>{
        ds.TestDatabase.testmethod().then(op=>{
            console.log(op);
        });
    });
    

    This one works without any problem during the time of compilation.