# FeatureQueryControls

How the feature query contract scripts a query. A real adapter implements
these by mocking its network layer, typically `fetch`.

This is an interface exported by `@mapcairn/core/contracts`, checked against version 0.2.0.

## Signature

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

## Methods

### failWith

```ts
failWith(kind: ScriptedFeatureQueryFailure): void;
```

Makes every later query fail the way `kind` describes.

- `kind` (`ScriptedFeatureQueryFailure`)

### hold

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

Keeps later queries pending until the returned function is called.

### respondWith

```ts
respondWith(hits: readonly SelectionHit[]): void;
```

Makes every later query find exactly these features inside
[`CONTRACT_AREA`](https://docs.mapcairn.com/api/core/contracts/CONTRACT_AREA.md), whichever layers they are in. The query itself
keeps only the layers it was asked about and the number it was asked for.

- `hits` (`readonly SelectionHit[]`)

## See also

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

Source: [packages/core/src/contracts/featureQuery.contract.ts:22](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/contracts/featureQuery.contract.ts#L22)
