@lewo-media/class-transformer
v0.7.1
Published
Proper decorator-based transformation / serialization / deserialization of plain javascript objects to class constructors
Readme
@lewo-media/class-transformer
An MIT-licensed continuation of TypeStack's decorator-based object transformer,
through Moritz Hein / Kage0x3B's @kage0x3b/[email protected] fork.
The first LEWO release is 0.7.1: an ownership and release-engineering change
with the intermediate release's runtime and declaration output preserved.
It is prepared for publication; this handoff has not published it.
Lineage and ownership
TypeStack contributors wrote the original library. The original
Copyright (c) 2015-2020 TypeStack and MIT terms remain in LICENSE,
together with credit to the intermediate fork. LEWO does not claim that work
as its own. UPSTREAM_CHANGES.md describes the patches that
LEWO now maintains and their edge cases. PROVENANCE.json
records immutable source revisions and archive checksums.
The source baseline is TypeStack [email protected], tag v0.5.1, commit
9c9012f1bfe720d5f0d5252e93b331aaf5fe9e4e. Intermediate public master
12a39661aef1943320bf8e6783c9f3db599a8ce7 identifies itself as 0.7.0.
The published 0.7.1 has no release tag or registry gitHead; one runtime
file differs from that master. All 38 TypeScript source files were therefore
recovered from the integrity-verified release's embedded sourcesContent.
Thirty-seven match public master. The original tests and build configuration
come from that pinned public source. This is verified source recovery, not an
assertion that a corresponding release commit exists.
All 114 rebuilt JavaScript, declaration and source-map files matched the
intermediate npm release byte for byte during preparation. LEWO added release
metadata, attribution, a working Jest adapter, explicit .js test imports,
regression and packed-artifact checks, lifecycle hooks, and standalone release
workflows. One inherited test expectation now reflects the shipped raw-value
transform contract; no runtime source was changed. See CHANGELOG.md.
Install and use after publication
For NestJS consumers, preserve the literal dependency key class-transformer:
pnpm add class-transformer@npm:@lewo-media/[email protected]NestJS declares and resolves its optional peer by that literal name. Installing only the scoped key does not supply that peer. Standalone consumers without that peer requirement may install the scoped name directly.
import 'reflect-metadata';
import { plainToInstance, Transform } from 'class-transformer';
class Config {
@Transform(({ value }) => value === 'true' || value === true)
enabled!: boolean;
}
const config = plainToInstance(Config, { enabled: 'false' }, {
enableImplicitConversion: true,
});
// config.enabled === falseThe package retains native ESM and the original export map: ., ./storage,
and ./package.json, with declarations under build/types. It does not add a
CommonJS build. Applications using reflected decorator types must load
reflect-metadata and enable TypeScript's experimentalDecorators and
emitDecoratorMetadata. The only runtime dependency remains luxon: ^3.3.0.
The historical API guide is preserved in UPSTREAM_README.md;
its upstream installation and build-format advice is not this fork's release contract.
Develop
Use Node 22 and pnpm 10.30.0. This directory has its own workspace boundary and
lockfile and can be copied directly into a public lewo-media/class-transformer
repository. It does not need any OSIO workspace package.
pnpm install --frozen-lockfile --ignore-scripts # First checkout only.
pnpm build
pnpm test
pnpm release:checkpnpm test runs the inherited Jest suite, the fork contracts, and an actual
packed-package consumer in a temporary directory. The consumer checks ESM alias
imports, ./storage, declaration resolution, nested DTO conversion, boolean
conversion and metadata shared between two physical copies. prepack builds
from TypeScript; prepublishOnly runs the complete tests. release:check also
leaves the release archive under artifacts/.
The first prepared release passes 17 suites / 102 tests. The original 0.7.1 source with the unmodified inherited suite passes 95 of 96 tests: its old Date-string expectation conflicts with the raw-timestamp transform introduced in 0.7.1. Both results were reproduced; the updated expectation preserves the installed behavior. The five new runtime cases fail against upstream 0.5.1; the boolean case and updated Date expectation fail against public master 0.7.0. The release-artifact test rejects the original publisher manifest.
Release
Follow RELEASING.md. The repository URL in package metadata is the intended public destination; no GitHub repository was created in this task. Keep this package MIT with its own release cycle. The workflows under this directory become active only when this directory is the root of that repository.
