Skip to content

feat: Add NestJS ClassSerializerInterceptor integration #20

@Isqanderm

Description

@Isqanderm

Purpose

Implement a drop-in replacement for @nestjs/common's ClassSerializerInterceptor that uses om-data-mapper instead of class-transformer for object serialization.

Benefits

  • 17.28x faster serialization performance compared to class-transformer
  • Zero-config drop-in replacement for existing NestJS applications
  • Full compatibility with existing @Expose, @Exclude, @Type, and @Transform decorators
  • Leverages existing class-transformer compatibility layer in src/compat/class-transformer/

Scope

  • Create new directory: src/integrations/nestjs/
  • Implement ClassSerializerInterceptor as a thin wrapper over existing classToPlain function
  • Support all NestJS serialization options and decorators
  • Ensure tree-shaking works correctly (NestJS code should not be bundled if not used)
  • Add comprehensive tests
  • Update documentation with migration guide and usage examples

API Compatibility

Should work as a drop-in replacement - users only need to change the import path:

  • FROM: import { ClassSerializerInterceptor } from '@nestjs/common';
  • TO: import { ClassSerializerInterceptor } from 'om-data-mapper/nestjs';

References

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions