# 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

```ts
import type { LayerSourceControls } from "@mapcairn/core/contracts";
 
interface LayerSourceControls
```

## Methods

### failIdentifyWith

```ts
failIdentifyWith(kind: "network" | "invalid"): void;
```

Makes the next identifies fail the way a source fails for that kind.

- `kind` (`"network" | "invalid"`)

### failWith

```ts
failWith(kind: "network" | "invalid"): void;
```

Makes the next loads fail the way a source fails for that kind.

- `kind` (`"network" | "invalid"`)

### hold

```ts
hold(): () => void;
```

Makes the next loads wait until the returned function is called.

### holdIdentify

```ts
holdIdentify(): () => void;
```

Makes the next identifies of [`CONTRACT_IDENTIFY_LAYER`](https://docs.mapcairn.com/api/core/contracts/CONTRACT_IDENTIFY_LAYER.md) alone wait
until the returned function is called. The other identifiable layer is
not held.

### respondToIdentifyWith

```ts
respondToIdentifyWith(points: readonly ContractPoint[]): void;
```

Makes the next identifies of [`CONTRACT_IDENTIFY_LAYER`](https://docs.mapcairn.com/api/core/contracts/CONTRACT_IDENTIFY_LAYER.md) and
[`CONTRACT_OTHER_IDENTIFY_LAYER`](https://docs.mapcairn.com/api/core/contracts/CONTRACT_OTHER_IDENTIFY_LAYER.md) find these points, or nothing when
the list is empty.

- `points` (`readonly ContractPoint[]`)

### respondWith

```ts
respondWith(points: readonly ContractPoint[]): void;
```

Makes the next loads of [`CONTRACT_LAYER`](https://docs.mapcairn.com/api/core/contracts/CONTRACT_LAYER.md) return these points.

- `points` (`readonly ContractPoint[]`)

### respondWithDetailLine

```ts
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

```ts
respondWithOversizeAnswer(kind: "feed" | "detail"): void;
```

Makes the next load of [`CONTRACT_LAYER`](https://docs.mapcairn.com/api/core/contracts/CONTRACT_LAYER.md) (`"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

- [`ContractPoint`](https://docs.mapcairn.com/api/core/contracts/ContractPoint.md)

Source: [packages/core/src/contracts/layerSource.contract.ts:108](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/contracts/layerSource.contract.ts#L108)
