# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.0] - 2026-09-30

### Changed

- `MaatClient.__init__()` no longer performs an 'eager Keycloak token refresh'.
  The client can now be constructed even when Keycloak is unreachable, so application factories (`create_app()`) no longer fail at startup. The token is fetched lazily on the first API call; configuration errors (missing credentials, unsupported grant type) are still detected eagerly via parameter validation.

### Added

- `MaatClient.authenticate()` — explicit connectivity/credentials check that
  forces a fresh Keycloak token fetch. Intended for health checks and startup
  probes. Returns `True` on success, `False` when Keycloak is not configured,
  and raises `MaatAuthError` when Keycloak is unreachable or rejects the
  credentials.
- Regression test suite for the lazy authentication behaviour
  (`tests/test_maat_client_auth.py`)

- `characteristic_utils` module with conversion functions between flat name/value
  characteristics (dotted notation) and nested JSON structures:
  - `flatten_json()` — recursively flattens nested JSON into `list[Characteristic]`
  - `unflatten_characteristics()` — reconstructs nested JSON from `list[Characteristic]`
  - `unflatten_dict_list()` — reconstructs nested JSON from `list[dict]`
- `Characteristic.from_json()` class method for creating `list[Characteristic]`
  from a nested JSON structure
- Export of `flatten_json`, `unflatten_characteristics`, `unflatten_dict_list`
  in package `__init__.py`
- Comprehensive test suite for characteristic utils (31 tests) including
  round-trip verification and spec example coverage

### Fixed

- Bug in `Characteristic.__init__`: condition checked `type` instead of `value`
  when setting the `value` attribute

## [0.1.1] - 2026-08-27

PyPi pacakre prepared

## [0.1.0] - 2026-01-01

### Added

- `MaatClient` class implementing communication interface with Maat API
  - Basic auth and Keycloak (OIDC) authentication support
  - CRUD operations: `find()`, `get_resource()`, `add_resource()`,
    `update_resource()`, `delete_resource()`
  - Automatic `resourceCharacteristic` merging on update
  - Proactive Keycloak token refresh with configurable margin
- `MaatAuthError` and `MaatAPIError` exception classes
- Model classes following TMF specification:
  - `BaseResource` — base resource model
  - `PhysicalResource` — physical resource with extended attributes
  - `Service` — service model
  - `Characteristic` — name/value pair model
  - `ResourceRelationship` — resource relationship model
- `get_active_params()` method on `PhysicalResource` and `Service` for
  serializing only non-None parameters
- `to_dict()` and `to_str()` serialization methods on all models
- Initial test suite (12 tests)
