falcor-graph-syntax

    1.1.3 • Public • Published

    Falcor Graph Syntax
    Build Status Coverage Status bitHound Score

    Simplified GraphQL query syntax for Falcor.

    Falcor path syntax can get very long and redundant:

    [
        ["foo", 1, "foo", ["foo", "bar"]],
        ["foo", 1, "bar", 0, "foo"],
        ["bar", 0, "foo", { from: 0, to: 9 }, ["foo", "bar"]],
        ["bar", 0, "bar", { length: 10 }]
    ]
    

    The deeper you go in the model, the worse it gets.

    This library lets you use an alternative syntax, similar to that of GraphQL:

    `
        foo(id: 1) {
            foo { foo, bar },
            bar(index: 0) { foo }
        },
        bar(index: 0) {
            foo(from: 0, to: 9) { foo, bar },
            bar(length: 10)
        }
    `
    

    Installation

    npm install falcor-graph-syntax
    

    Usage

    Import the library.

    import FalcorGraphSyntax from "falcor-graph-syntax";
    

    Then replace your paths (strings or arrays)...

    model.get(paths).subscribe(...);
    

    ... with your query (string), wrapped in the FalcorQuerySyntax() function.

    model.get(FalcorQuerySyntax(query)).subscribe(...);
    

    Install

    npm i falcor-graph-syntax

    DownloadsWeekly Downloads

    26

    Version

    1.1.3

    License

    MIT

    Last publish

    Collaborators

    • giovannicalo