> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowsbuilt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# atRiskAll()

> Stream all at-risk users as an async generator — no pagination needed.

## Overview

`atRiskAll()` is an async generator that yields all at-risk users above a threshold, handling pagination automatically. Use it when you need to process the full list without managing `offset` / `total` yourself.

## Signature

```typescript theme={null}
churn.atRiskAll(options?: AtRiskAllOptions): AsyncGenerator<AtRiskUser>
```

## AtRiskAllOptions

<ParamField path="threshold" type="number">
  Minimum score to include (0–1). Default: `0.5`.
</ParamField>

<ParamField path="plan" type="string">
  Filter by plan.
</ParamField>

<ParamField path="pageSize" type="number">
  Number of users to fetch per internal page. Default: `100`.
</ParamField>

## Examples

### Process all at-risk users

```typescript theme={null}
for await (const user of churn.atRiskAll({ threshold: 0.7 })) {
  await sendOutreachEmail(user.userId, user.recommendation)
}
```

### Collect into an array

```typescript theme={null}
const users: AtRiskUser[] = []
for await (const user of churn.atRiskAll()) {
  users.push(user)
}
console.log(`Total at-risk: ${users.length}`)
```

### Early exit

```typescript theme={null}
// Process only the first 50, then stop
let count = 0
for await (const user of churn.atRiskAll({ threshold: 0.8 })) {
  await alert(user)
  if (++count >= 50) break
}
```

### With transformations

```typescript theme={null}
// Build a map of userId → risk for a bulk email tool
const riskMap = new Map<string, AtRiskUser>()

for await (const user of churn.atRiskAll({ threshold: 0.6, plan: 'pro' })) {
  riskMap.set(user.userId, user)
}
```

## vs atRisk()

|            | `atRisk()`         | `atRiskAll()`                                 |
| ---------- | ------------------ | --------------------------------------------- |
| Returns    | One page           | All pages (streaming)                         |
| Pagination | Manual             | Automatic                                     |
| Memory     | Bounded            | Unbounded (collects all if you push to array) |
| Use case   | Dashboard, preview | Bulk processing, exports                      |
