> For the complete documentation index, see [llms.txt](https://docs.conanjs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.conanjs.io/api/asaps/asap.md).

# Asap

This interface defines the helper methods around a Conan Asap

```typescript
export interface Asap<T> {
    catch(error: IConsumer<Error>): this;

    then(consumer: IConsumer<T>): this;

    onCancel(consumer: ICallback): this;

    map<Z>(mapper: IFunction<T, Z>): Asap<Z>;

    chain<Z>(chainProducer: IFunction<T, Asap<Z>>): Asap<Z>;

    type: AsapType;

    cancel(): boolean;
}
```

�

### ***catch***

it will be invoked when an error is thrown while resolving the Asap's Promise

| Input |                                                                                                                          |
| ----- | ------------------------------------------------------------------------------------------------------------------------ |
| error | <p><strong>Type:</strong>  <code>IConsumer\<Error></code><em><code>required</code></em></p><p>the function to invoke</p> |

| Returns |   |
| ------- | - |
| this    |   |

### then <a href="#catch" id="catch"></a>

‌it will be invoked when the Asap's Promise is resolved

| Input    | ​Title                                                                                                              |
| -------- | ------------------------------------------------------------------------------------------------------------------- |
| consumer | <p><strong>Type:</strong> <code>IConsumer\<T></code><em><code>required</code></em></p><p>the function to invoke</p> |

| Returns | ​Title |
| ------- | ------ |
| this    | ​      |

### chain\<Z> <a href="#catch" id="catch"></a>

‌allows chaning Asaps

| Input         | ​Title                                                                                                                        |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| chainProducer | <p><strong>Type:</strong> <code>IFunction\<T, Asap\<Z>></code><em><code>required</code></em></p><p>the function to invoke</p> |

| Returns | ​Title |
| ------- | ------ |
| this    | ​      |

### map\<Z> <a href="#catch" id="catch"></a>

‌maps an Asap into a another one

| Input  | ​Title                                                                                                                 |
| ------ | ---------------------------------------------------------------------------------------------------------------------- |
| mapper | <p><strong>Type:</strong> <code>IFunction\<T, Z></code><em><code>required</code></em></p><p>the function to invoke</p> |

| Returns  | ​Title              |
| -------- | ------------------- |
| Asap\<Z> | ​the re-mapped Asap |

### map\<Z> <a href="#catch" id="catch"></a>

‌maps an Asap into a another one

| Input  | ​Title                                                                                                                                      |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| mapper | <p><strong>Type:</strong> <code>IFunction\<T, Z></code><em><code>required</code></em></p><p>the function producing the new chained Asap</p> |

| Returns  | ​Title            |
| -------- | ----------------- |
| Asap\<Z> | ​the chained Asap |

### cancel <a href="#catch" id="catch"></a>

‌cancels an Asap

| Returns |
| ------- |

| ​Title |   |
| ------ | - |
| void   | ​ |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.conanjs.io/api/asaps/asap.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
