I am trying to use npm package apache-age-client
, in order to connect to my Apache Age instance.
The problem is that, in order to initialize connection, I need execute ApacheAgeClient.connect method; which is a static async method that is a class factory.
When I do so, tsx returns this error:
TypeError: ApacheAgeClient.connect is not a function
at Database (/home/mble/Code/repos/mbledkowski/interwebs/src/db.ts:8:46)
at main (/home/mble/Code/repos/mbledkowski/interwebs/src/main.ts:90:14)
Import:
import age from "apache-age-client";
export class Database {
connectionPromise: Promise<age>;
connection: age | undefined;
constructor() {
this.connectionPromise = age.connect({
database: "postgresDB",
host: "localhost",
password: "postgresDB",
graph: "interwebs",
port: 5455,
user: "interwebs",
});
}
async build() {
this.connection = await this.connectionPromise;
}
//[...]
}