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

# Frameworks

> List, retrieve, and iterate EU regulatory frameworks with the Law4Devs TypeScript SDK.

## Overview

Frameworks are the top-level objects in Law4Devs. Each framework represents one EU regulatory act (e.g. GDPR, NIS2, CRA) and acts as a namespace for articles, recitals, requirements, and annexes.

***

## Methods

### `list()`

Returns a page of framework summaries.

```typescript theme={null}
const page = await client.frameworks.list({ page: 1, perPage: 20 });

console.log(`${page.meta.total} frameworks across ${page.meta.pages} pages`);

for (const fw of page.data) {
  console.log(`${fw.slug}: ${fw.name} (${fw.articleCount} articles)`);
}
```

**Parameters**

| Parameter | Type     | Default | Description            |
| --------- | -------- | ------- | ---------------------- |
| `page`    | `number` | `1`     | Page number            |
| `perPage` | `number` | `20`    | Items per page (1–100) |

**Returns** `Promise<Page<Framework>>`

***

### `get()`

Fetch the full detail of a single framework by its slug.

```typescript theme={null}
const gdpr = await client.frameworks.get('gdpr');

console.log(gdpr.name);
console.log(`Coverage: ${gdpr.coverage}%`);
console.log(`EUR-Lex: ${gdpr.eurLexUrl}`);
```

**Parameters**

| Parameter | Type     | Description                                      |
| --------- | -------- | ------------------------------------------------ |
| `slug`    | `string` | Framework slug, e.g. `"gdpr"`, `"nis2"`, `"cra"` |

**Returns** `Promise<FrameworkDetail>`

***

### `iter()`

Iterate over all frameworks without managing pagination.

```typescript theme={null}
for await (const fw of client.frameworks.iter({ perPage: 50 })) {
  console.log(`${fw.shortName} — last synced: ${fw.lastSyncedAt}`);
}
```

**Parameters** — same options as `list()` (except `page`, which is managed internally).

**Returns** `AsyncGenerator<Framework>`

***

## Models

### `Framework`

Returned by `list()` and `iter()`.

| Field              | Type             | Description                                  |
| ------------------ | ---------------- | -------------------------------------------- |
| `id`               | `number`         | Internal numeric ID                          |
| `slug`             | `string`         | URL-safe identifier, e.g. `"gdpr"`           |
| `name`             | `string`         | Full official name                           |
| `shortName`        | `string`         | Short name, e.g. `"GDPR"`                    |
| `celexNumber`      | `string \| null` | EUR-Lex CELEX identifier                     |
| `description`      | `string \| null` | Plain-text summary                           |
| `isActive`         | `boolean`        | Whether the framework is published           |
| `status`           | `string`         | `"active"`, `"superseded"`, or `"draft"`     |
| `expectedArticles` | `number \| null` | Target article count for sync progress       |
| `expectedRecitals` | `number \| null` | Target recital count for sync progress       |
| `lastSyncedAt`     | `string \| null` | ISO 8601 timestamp of last content sync      |
| `createdAt`        | `string`         | ISO 8601 creation timestamp                  |
| `articleCount`     | `number`         | Number of articles currently in the database |
| `recitalCount`     | `number`         | Number of recitals currently in the database |

### `FrameworkDetail`

Returned by `get()`. Extends `Framework` with:

| Field              | Type             | Description                            |
| ------------------ | ---------------- | -------------------------------------- |
| `eurLexUrl`        | `string \| null` | Direct link to EUR-Lex source document |
| `requirementCount` | `number`         | Number of extracted requirements       |
| `annexCount`       | `number`         | Number of annexes                      |
| `tagCount`         | `number`         | Number of tags applied                 |
| `coverage`         | `number`         | Sync coverage percentage (0–100)       |

***

## Example: filter active frameworks

```typescript theme={null}
const activeFrameworks: string[] = [];

for await (const fw of client.frameworks.iter()) {
  if (fw.isActive && fw.status === 'active') {
    activeFrameworks.push(fw.slug);
  }
}

console.log('Active frameworks:', activeFrameworks.join(', '));
```

<Note>
  NIS1 has `status: "superseded"` and remains browsable for historical reference. Filter by `status === "active"` if you only want current legislation.
</Note>
