LayerSourceControls
What the layer source contract needs besides the source itself.
This is an interface exported by @mapcairn/core/contracts, checked against version 0.2.0.
Signature
import type { LayerSourceControls } from "@mapcairn/core/contracts";
interface LayerSourceControls
Methods
failIdentifyWith
failIdentifyWith(kind: "network" | "invalid"): void;
Makes the next identifies fail the way a source fails for that kind.
kind("network" | "invalid")
failWith
failWith(kind: "network" | "invalid"): void;
Makes the next loads fail the way a source fails for that kind.
kind("network" | "invalid")
hold
hold(): () => void;
Makes the next loads wait until the returned function is called.
holdIdentify
holdIdentify(): () => void;
Makes the next identifies of CONTRACT_IDENTIFY_LAYER alone wait
until the returned function is called. The other identifiable layer is
not held.
respondToIdentifyWith
respondToIdentifyWith(points: readonly ContractPoint[]): void;
Makes the next identifies of CONTRACT_IDENTIFY_LAYER and
CONTRACT_OTHER_IDENTIFY_LAYER find these points, or nothing when
the list is empty.
points(readonly ContractPoint[])
respondWith
respondWith(points: readonly ContractPoint[]): void;
Makes the next loads of CONTRACT_LAYER return these points.
points(readonly ContractPoint[])
respondWithDetailLine
respondWithDetailLine(from: readonly [number, number], to: readonly [number, number]): void;
Makes the next detail loads return one line from the first to the second position.
from(readonly [number, number])to(readonly [number, number])
respondWithOversizeAnswer
respondWithOversizeAnswer(kind: "feed" | "detail"): void;
Makes the next load of CONTRACT_LAYER ("feed"), or the next
detail load ("detail"), read an answer larger than whatever limit the
source applies to the size of an answer. A source is free to choose its
limit (the subject can lower it so the answer stays small), and the
suite requires only that the answer is refused.
kind("feed" | "detail")
See also
Source: packages/core/src/contracts/layerSource.contract.ts:108