Declarative soft-delete solution for MikroORM v6 (v1.x) and v5 (v0.x). v1.0.0-alpha.1 targets ORM v6 and requires registering SoftDeleteHandler as an extension. Active development under alpha. Uses decorators (@SoftDeletable) and filters to automatically intercept delete queries. Key differentiator: minimal configuration, supports custom field names and default values, inheritance, and cascade remove.
npm install mikro-orm-soft-deleteNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes MikroORM with soft-delete extension, defines a soft-deletable entity, performs soft delete, and queries with/without filter.
Update to v1: remove generic type params from base entities and add 'extensions: [SoftDeleteHandler]' to MikroORM.init().
Provide value function matching your field type, and specify 'valueInitial' option if default is not null.
Use repo.remove() for explicit deletions; avoid orphanRemoval on collections or handle deletions manually.
Migrate to v1.x and MikroORM v6.x.
Add 'extensions: [SoftDeleteHandler]' to your MikroORM.init() call.
Remove generic type parameters from base entities (e.g., change 'class MyEntity extends BaseEntity<...>' to 'class MyEntity extends BaseEntity').
Use arrow function returning the entity class (not the class itself) to defer resolution. Already done correctly in example.