从falcor路由器返回数据和参考

从falcor路由器返回数据和参考,falcor,falcor-router,Falcor,Falcor Router,我有一个路由,它返回用户帐户上某个功能的详细信息: // games[{keys:games}].features[{integers:indices}] { $type : "atom", value : { id: "6", count: "1", ... } } 还有一个路由返回有关特定功能的一般详细信息: // features[{integers:features}] { $type : "atom",

我有一个路由,它返回用户帐户上某个功能的详细信息:

// games[{keys:games}].features[{integers:indices}]
{
    $type : "atom",
    value : {
        id: "6",
        count: "1",
        ...
    }
}
还有一个路由返回有关特定功能的一般详细信息:

// features[{integers:features}]
{
    $type : "atom",
    value : {
        name : "fooga",
        max : 10,
        ...
    }
}
我不想将通用特性数据合并到用户特定的数据中,因为这将是一堆重复数据,但我也希望能够在一个请求中获得所有数据

什么是构造路由/返回数据的智能方法,以便游戏[{keys:games}].features[{integers:index}]可以返回对功能[{integers:features}]的有用引用

我试着像这样把他们分开:

// games[{keys:games}].features[{integers:indices}].details
{
    $type : "atom",
    value : {
        id: "6",
        count: "1",
        ...
    }
}

// games[{keys:games}].features[{integers:indices}].meta
{
    $type : "ref",
    value : [
        "features",
        "15"
    ]
}
games[{keys:games}].features[{integers:indices}].details
games[{keys:games}].features[{integers:indices}].feature
features[{keys:games}][{integers:features}].details

但是我想不出一种方法来解决.meta引用,而不是写冗余的路径,比如…features.0.meta。[name,max,…]。理想情况下,ref只返回一个原子,因为它是一个小数据量。

我最终将其结构如下:

// games[{keys:games}].features[{integers:indices}].details
{
    $type : "atom",
    value : {
        id: "6",
        count: "1",
        ...
    }
}

// games[{keys:games}].features[{integers:indices}].meta
{
    $type : "ref",
    value : [
        "features",
        "15"
    ]
}
games[{keys:games}].features[{integers:indices}].details
games[{keys:games}].features[{integers:indices}].feature
features[{keys:games}][{integers:features}].details
丑陋的道路,但是“\_ツ_/“”