@types/falcor-router
TypeScript icon, indicating that this package has built-in type declarations

0.8.6 • Public • Published

Installation

npm install --save @types/falcor-router

Summary

This package contains type definitions for falcor-router (https://github.com/Netflix/falcor-router).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/falcor-router.

index.d.ts

/// <reference types="falcor" />
import * as FalcorModel from "falcor";
import * as FalcorJsonGraph from "falcor-json-graph";
import DataSource = FalcorModel.DataSource;
import { Observable } from "rx";

declare class FalcorRouter extends DataSource {
    constructor(routes: FalcorRouter.RouteDefinition[], options?: FalcorRouter.RouterOptions);

    /**
     * When a route misses on a call, get, or set the unhandledDataSource will
     * have a chance to fulfill that request.
     */
    routeUnhandledPathsTo(dataSource: DataSource): void;

    static createClass(routes?: FalcorRouter.RouteDefinition[]): typeof FalcorRouter.CreatedRouter;
}

declare namespace FalcorRouter {
    class CreatedRouter extends FalcorRouter {
        constructor(options?: RouterOptions);
    }

    interface Route {
        route: string;
    }

    type RoutePathSet = FalcorJsonGraph.PathSet;

    interface CallRoute extends Route {
        call(
            callPath: RoutePathSet,
            args: any[],
        ): CallRouteResult | Promise<CallRouteResult> | Observable<CallRouteResult>;
    }

    interface GetRoute extends Route {
        get(pathset: RoutePathSet): RouteResult | Promise<RouteResult> | Observable<RouteResult>;
    }

    interface SetRoute extends Route {
        set(jsonGraph: FalcorJsonGraph.JSONGraph): RouteResult | Promise<RouteResult> | Observable<RouteResult>;
    }

    type RouteDefinition = GetRoute | SetRoute | CallRoute;
    type RouteResult = FalcorJsonGraph.PathValue | FalcorJsonGraph.PathValue[] | FalcorJsonGraph.JSONEnvelope<any>;
    type CallRouteResult =
        | FalcorJsonGraph.PathValue
        | FalcorJsonGraph.InvalidPath
        | Array<FalcorJsonGraph.PathValue | FalcorJsonGraph.InvalidPath>
        | FalcorJsonGraph.JSONGraphEnvelope;

    interface RouterOptions {
        debug?: boolean | undefined;
        maxPaths?: number | undefined;
        maxRefFollow?: number | undefined;
    }
}

export = FalcorRouter;

Additional Details

Credits

These definitions were written by Quramy, cdhgee, and LukeRielley.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/falcor-router

Weekly Downloads

10

Version

0.8.6

License

MIT

Unpacked Size

7.16 kB

Total Files

5

Last publish

Collaborators

  • types