# Changelog

## [11.0.4] - 2026-09-18

### ⬆️ Dependencies

- Updated dependencies

## [11.0.3] - 2026-08-26

### ⬆️ Dependencies

- Updated dependencies
- Bumped `mongodb` to `7.5.0` and raised dev `typescript` to `^7.0.2`, `@types/node` to `^26.1.1`, and `vitest` to `^4.1.10`. No source changes — dependency bump only.

## [11.0.2] - 2026-06-05

### 👷 CI

- Raised the minimum supported Node.js to `>=24.0.0` (Node 24 LTS) in `engines`, dropping Node 22.

### ⬆️ Dependencies

- Bumped dev `vitest` to `^4.1.8`. No source changes — dev-tooling bump only.

## [11.0.1] - 2026-05-21

### ♻️ Refactoring

### `update` throws `NotFoundError` for missing entities

`MongodbStore.update` now throws `NotFoundError` from `@furystack/core` (instead of a plain `Error`) when no document matches the given id. Callers can branch on `instanceof NotFoundError` without parsing messages. The message was tightened from `... cannot update!` to `... cannot update` — substring matches that look for `cannot update` keep working.

### ⬆️ Dependencies

- Bump `mongodb` to `7.2.0`.
- Bump dev `vitest` to `^4.1.5`.
- Bumped `@types/node` to `^25.9.1` and `vitest` to `^4.1.7`. No source changes — dev-tooling bump only.

### 📚 Documentation

- Rewrote JSDoc on `MongodbStore`, `defineMongodbStore`, and `MongoClientFactory` to follow the new value-test guidance: dropped restate-the-type narration, called out the lazy-init contract, the `_id`/`ObjectId` coercion behavior, and the fact that the store has no `[Symbol.asyncDispose]` because client lifetime belongs to the factory.

## [11.0.0] - 2026-04-25

### 💥 Breaking Changes

Stores are now first-class DI tokens. See the [v7 migration guide](../../docs/migrations/v7-functional-di.md) for rationale, recipes, and pitfalls.

- Removed `useMongoDb(...)`. Declare the store at module scope with `defineMongoDbStore<T, PK>({ name, model, primaryKey, url, db, collection, options? })`.
- `MongoClientFactory` is now an exported interface + `defineService({ lifetime: 'singleton' })` token. It pools `MongoClient` instances per URL and closes every pooled client on injector teardown.
- Dropped the unused `EventHub<{ onClientCreated, onDisposed }>` surface from the factory (no consumers in-repo).

## [10.1.7] - 2026-04-17

### ⬆️ Dependencies

- Raised `@types/node` to ^25.6.0, `typescript` to ^6.0.3, and `vitest` to ^4.1.4 so package development matches the workspace toolchain.

## [10.1.6] - 2026-03-27

### ⬆️ Dependencies

- Updated `vitest` to ^4.1.2

## [10.1.5] - 2026-03-25

### 📦 Build

- Removed deprecated `baseUrl` from tsconfig.json for TypeScript 6 compatibility

### ⬆️ Dependencies

- Upgraded `typescript` from ^5.9.3 to ^6.0.2
- Upgraded `vitest` from ^4.1.0 to ^4.1.1
- Upgraded `mongodb` from 7.1.0 to 7.1.1

## [10.1.4] - 2026-03-19

### ✨ Features

- Updated `@furystack/core` dependency to the latest major version.
- Added `MongoClientFactory` lifecycle events (`onClientCreated`, `onDisposed`).

### ⬆️ Dependencies

- Upgraded `vite` from ^7.3.1 to ^8.0.0 for improved build performance and new features
- Upgraded `vitest` from ^4.0.18 to ^4.1.0
- Upgraded `@vitest/coverage-istanbul` from ^4.0.18 to ^4.1.0

## [10.1.3] - 2026-03-10

### ⬆️ Dependencies

- Updated `@furystack/core` dependency to the new major version

## [10.1.2] - 2026-03-07

### ⬆️ Dependencies

- Updated `@types/node` from `^25.3.1` to `^25.3.5`

## [10.1.1] - 2026-03-06

### ⬆️ Dependencies

- Updated internal FuryStack dependencies

## [10.1.0] - 2026-03-03

### ✨ Features

### Lifecycle events in `MongoClientFactory`

`MongoClientFactory` now extends `EventHub` and emits events for client lifecycle:

- `onClientCreated` — emitted when a new MongoDB client is created, with `{ url }`
- `onDisposed` — emitted when the factory is disposed

```typescript
const factory = injector.getInstance(MongoClientFactory)

factory.addListener('onClientCreated', ({ url }) => {
  console.log(`MongoDB client created for ${url}`)
})
```

### 🧪 Tests

- Added tests for `onClientCreated` event emission on new client creation
- Added test verifying `onClientCreated` is not emitted when returning a cached client

## [10.0.41] - 2026-02-26

### ⬆️ Dependencies

- Updated internal `@furystack/*` dependencies
- Bumped `@types/node` from ^25.3.0 to ^25.3.1

## [10.0.40] - 2026-02-26

### 📝 Documentation

- Added tip about wrapping the physical store with a Repository DataSet for application-level data access

## [10.0.39] - 2026-02-22

### ⬆️ Dependencies

- Updated `@furystack/core` dependency

## [10.0.38] - 2026-02-19

### ⬆️ Dependencies

- Updated `@furystack/core`

## [10.0.37] - 2026-02-11

### ♻️ Refactoring

- Replaced semaphore-based initialization lock with promise deduplication for MongoDB collection setup. Concurrent calls to `getCollection()` now reuse a single in-flight initialization promise instead of queuing behind a semaphore. On initialization failure, the promise is reset to allow retry.

### ⬆️ Dependencies

- Bump `mongodb` from `7.0.0` to `7.1.0`
- Bump `vitest` from `^4.0.17` to `^4.0.18`
- Bump `@types/node` from `^25.0.10` to `^25.2.3`
- Removed `semaphore-async-await` dependency
- Updated internal dependencies

## [10.0.36] - 2026-02-09

### ⬆️ Dependencies

- Updated `@furystack/core` dependency
- Updated `@furystack/*` dependencies

## [10.0.35] - 2026-01-26

### 🔧 Chores

- Standardized author format, improved keywords, removed obsolete `gitHead`, added `engines` (Node 22+) and `sideEffects: false`

## [10.0.34] - 2026-01-26

### 🔧 Chores

- Fixed repository URL in package.json from `furystack/core` to `furystack/furystack`

## [10.0.33] - 2026-01-26

### ⬆️ Dependencies

- Updated `@furystack/inject` with fix for singleton injector reference being overwritten by child injectors

## [10.0.32] - 2026-01-22

### ⬆️ Dependencies

- Dependency updates

### 🔧 Chores

- Migrated to centralized changelog management system
