GithubHelp home page GithubHelp logo

Comments (14)

MichaelNino avatar MichaelNino commented on May 28, 2024 2

Awesome! I was counting the days ;-) until your response!

Thank you for the clarification. I am very happy to contribute.

from typedb-driver-nodejs.

MichaelNino avatar MichaelNino commented on May 28, 2024

Any idea if this request might be accomplished in the near future? We would like to consume Grakn upcoming project.

from typedb-driver-nodejs.

flyingsilverfin avatar flyingsilverfin commented on May 28, 2024

I don't think we have the bandwitdh to implement and maintain this ourselves right now. That being said, I believe the bindings would be relatively easy to create for your use case! Perhaps we can help you collaborate and design the bindings and contribute them as an open source project?

from typedb-driver-nodejs.

flyingsilverfin avatar flyingsilverfin commented on May 28, 2024

@sorsaffari would be the one to talk to as he has the relevant experience.

from typedb-driver-nodejs.

sorsaffari avatar sorsaffari commented on May 28, 2024

I agree @flyingsilverfin.

A PR to this repo or DefinitelyTyped would be much appreciated @MichaelNino.

from typedb-driver-nodejs.

MichaelNino avatar MichaelNino commented on May 28, 2024

from typedb-driver-nodejs.

MichaelNino avatar MichaelNino commented on May 28, 2024

Hi @sorsaffari

I have begun writing the Typescript definition. Below is the definition file so I might better ask my questions.

// Type definitions for grakn-client 1.6.0
// Project: Grakn Client API: NodeJS
// Definitions by: Michael Niño https://www.michaelnino.com

export = GraknClient;

interface Credentials {
    username: string;
    password: string;
}

interface KeyspacesResponse {
   retrieve(): Promise<any>;
   delete(keyspace: string): Promise<any>;
}

declare class GraknClient {
    constructor(uri: string, credentials?: Credentials);

    session(keyspace: string): Session;

    /*
    this.keyspaces = () => ({
        delete: (keyspace) => keyspaceService.delete(keyspace),
        retrieve: () => keyspaceService.retrieve()
    });
    */
    keyspaces(): KeyspacesResponse[];  // <-- The method "keyspaces" is plural. Are we intending to destructure to an array of object literals? 

    close(): void;
}

/*
module.exports.dataType = {
    STRING: messages.AttributeType.DATA_TYPE.STRING,
    BOOLEAN: messages.AttributeType.DATA_TYPE.BOOLEAN,
    INTEGER: messages.AttributeType.DATA_TYPE.INTEGER,
    LONG: messages.AttributeType.DATA_TYPE.LONG,
    FLOAT: messages.AttributeType.DATA_TYPE.FLOAT,
    DOUBLE: messages.AttributeType.DATA_TYPE.DOUBLE,
    DATE: messages.AttributeType.DATA_TYPE.DATE
};
 */
declare namespace GraknClient {
    export interface dataType {
        STRING: any;
        BOOLEAN: any;
        INTEGER: any;
        LONG: any;
        FLOAT: any;
        DOUBLE: any;
        DATE: any;
    }
}

I have included comments from the your project's JavaScript source file for reference as well.

  1. Could you elaborate on your intention to destructure object literals in the method keyspaces. I would like to better understand the approach so I may create necessary typing but not over-typing.
  2. Could you provide me with the URL to the declaration of messages.AttributeType.DATA so I might create the correct types for that part of the Typescript definition? Thank you I couldn't easily locate it.

Thanks for your assistance. I think this definition file will increase overall adoption of Grakn/NodeJS.

from typedb-driver-nodejs.

MichaelNino avatar MichaelNino commented on May 28, 2024

@sorsaffari your input would be greatly appreciated :-)

from typedb-driver-nodejs.

MichaelNino avatar MichaelNino commented on May 28, 2024

Perhaps we can help you collaborate and design the bindings and contribute them as an open source project?

Perhaps @flyingsilverfin. Not sure if @sorsaffari could reply. I have been waiting almost 3 yrs. to begin using Grakn. Will anyone be interested in answering a couple of questions (above).

from typedb-driver-nodejs.

sorsaffari avatar sorsaffari commented on May 28, 2024

Hi @MichaelNino. Sorry for the late response. I'll be back at the office on the 28th and will attend to this right away.

Thank you for willing to contribute the type definitions to Client Node.js. I'm sure this will be much appreciated by the community :)

from typedb-driver-nodejs.

MichaelNino avatar MichaelNino commented on May 28, 2024

Got it! :-) Thanks again for your guidance.

from typedb-driver-nodejs.

sorsaffari avatar sorsaffari commented on May 28, 2024

Could you elaborate on your intention to destructure object literals in the method keyspaces.

There isn't a specific reason for it. It's been the design the decision made initially for Client Java which then has been replicated in the other clients.

Could you provide me with the URL to the declaration of messages.AttributeType.DATA

Here is the enum Datatype within Concept.proto of graknlabs/protocol.

The method "keyspaces" is plural. Are we intending to destructure to an array of object literals?

Despite its plurality, keyspaces() returns a single object. It's a bit confusing, I know, but I kind of see why it's been made plural considering the methods that can be called on the object it returns (i.e. delete and retrieve)

Once again, thanks for the effort @MichaelNino and do let me know if any of these answers are unclear or if you have any more questions :)

from typedb-driver-nodejs.

tchupp avatar tchupp commented on May 28, 2024

Hi! I'm very interested in using Grakn with a NodeJS project I'm working on, written in TypeScript.
Is there anything I could do to help make this Type Def file happen?

from typedb-driver-nodejs.

alexjpwalker avatar alexjpwalker commented on May 28, 2024

The NodeJS client for Grakn 2.0 is a TypeScript project, and the npm package grakn-client contains both .js and .d.ts files as of 2.0.

See: https://www.npmjs.com/package/grakn-client

from typedb-driver-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.