# @onivoro/server-typeorm-mysql

> TypeORM MySQL integration for the Ivim monorepo: a NestJS dynamic module, an enhanced repository base class, and streaming support for large result sets.

Latest version **24.39.0** (published 2026-09-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @onivoro/server-typeorm-mysql
pnpm add @onivoro/server-typeorm-mysql
yarn add @onivoro/server-typeorm-mysql
bun add @onivoro/server-typeorm-mysql
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 24.39.0 |
| Published | 2026-09-23 |
| First published | 2024-10-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 26 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | icedlee337 |

## Links

- npm: https://www.npmjs.com/package/@onivoro/server-typeorm-mysql
- Repository: https://github.com/onivoro/monorepo
- Homepage: https://github.com/onivoro/monorepo#readme
- Issues: https://github.com/onivoro/monorepo/issues
- npm.io page: https://npm.io/package/@onivoro/server-typeorm-mysql

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0
- [@onivoro/server-typeorm-common](https://npm.io/package/@onivoro/server-typeorm-common.md) 24.39.0

## Recent versions

- 24.39.0 (latest) — 2026-09-23
- 24.38.2 — 2026-05-15
- 24.38.1 — 2026-05-12
- 24.38.0 — 2026-05-10
- 24.37.0 — 2026-05-10
- 24.36.0 — 2026-05-09
- 24.35.4 — 2026-05-09
- 24.35.3 — 2026-05-09
- 24.35.2 — 2026-04-27
- 24.35.1 — 2026-04-24
- 24.35.0 — 2026-04-23
- 24.34.2 — 2026-04-22
- 24.34.1 — 2026-04-22
- 24.34.0 — 2026-04-22
- 24.33.21 — 2026-04-19
- … 89 more at https://npm.io/package/@onivoro/server-typeorm-mysql/versions

## README

# @onivoro/server-typeorm-mysql

TypeORM MySQL integration for the Ivim monorepo: a NestJS dynamic module, an enhanced repository base class, and streaming support for large result sets.

Shared types and helpers (`IPagedData`, `IPageParams`, `manyToOneRelationOptions`, `removeFalseyKeys`, `getSkip`, `getPagingKey`) live in [`@onivoro/server-typeorm-common`](../typeorm-common/) and are re-exported from this package for convenience.

## Module setup

```typescript
import { ServerTypeormMysqlModule } from '@onivoro/server-typeorm-mysql';

@Module({
  imports: [
    ServerTypeormMysqlModule.configure(
      [UserRepository],           // injectables
      [User],                     // entities
      {
        host: 'localhost',
        port: '3306',
        username: 'root',
        password: 'password',
        database: 'myapp',
        synchronize: false,        // never true in production
        logging: false,
      },
      'default',                  // connection name (default: 'default')
    ),
  ],
})
export class AppModule {}
```

The module caches data sources by name, uses `SnakeNamingStrategy`, and destroys open pools on application shutdown.

## Repositories

### `TypeOrmRepository<TEntity>`

Thin wrapper over TypeORM's `Repository` with convenience methods:

```typescript
@Injectable()
export class UserRepository extends TypeOrmRepository<User> {
  constructor(entityManager: EntityManager) {
    super(User, entityManager);
  }
}

// Methods: getOne, getMany, getManyAndCount, postOne (save), postMany (save),
//          patch (update), put (save), delete, softDelete, head,
//          queryStream, forTransaction, buildWhereILike.
// `getOne` throws if the result set has more than one row.
```

### `TypeOrmPagingRepository<TEntity, TParams>`

Abstract subclass for paginated queries. Subclasses implement `getPage(pageParams, params)` and can use the inherited `getSkip`, `getPagingKey`, `removeFalseyKeys` helpers.

### Streaming

`queryStream({ query, onData, onError, onEnd })` emits rows through Node streams for large datasets without loading the full result set. Also available as a static on `TypeOrmRepository` when you want to pass a bespoke `QueryRunner`.

## License

MIT

---
_Source: https://npm.io/package/@onivoro/server-typeorm-mysql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
