solarnetwork-datum-loader
    Preparing search index...

    Class DatumSourceFinder

    Class to find the available datum sources for a set of node datum URL helpers.

    This helper is useful for finding what source IDs are avaialble for a set of nodes. It returns an object with node ID properties with associated source ID array values, for example:

    { 123: ["a", "b", "c"] }
    
    // the simple case, all available sources for just one SolarNode
    const filter = new DatumFilter();
    filter.nodeId = 123;
    const sources = await new DatumSourceFinder(new SolarQueryApi(), filter).fetch();
    // find all sources matching a wildcard pattern within the past day
    const filter2 = new DatumFilter();
    filter2.startDate = new Date(Date.now() - 24 * 60 * 60 * 1000);
    filter2.sourceId = '/power/**';
    const sources2 = await new DatumSourceFinder(new SolarQueryApi(), filter2).fetch();
    // find all sources across multiple SolarNodes
    const filter3 = new DatumFilter();
    filter3.nodeId = 234;
    const sources3 = await new DatumSourceFinder(new SolarQueryApi(), [urlHelper1, urlHelper3]).fetch();

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Constructor.

      Parameters

      • api: SolarQueryApi

        the API helper to use

      • filters: DatumFilter | DatumFilter[]

        the filter(s) to find the sources for

      • OptionalauthBuilder: AuthorizationV2Builder

        the auth builder to authenticate requests with; if not provided then only public data can be queried; when provided a pre-signed key must be available

      Returns DatumSourceFinder

    Properties

    api: SolarQueryApi

    The API instance to use.

    authBuilder?: AuthorizationV2Builder

    An authorization builder to use to make authenticated HTTP requests.

    Methods

    • Create a URL fetch requestor.

      The returned function can be passed to d3.queue or invoked directly.

      Type Parameters

      • V

      Parameters

      • url: string

        the URL to request.

      • OptionalsignUrl: string

        the URL to sign (might be different to url if a proxy is used)

      Returns (cb: LoaderDataCallbackFn<V>) => void

      a function that accepts a callback argument