Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "10:00"
timezone: Europe/Budapest
open-pull-requests-limit: 5
versioning-strategy: increase
commit-message:
prefix: build
include: scope
ignore:
- dependency-name: "husky"
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "10:00"
timezone: Europe/Budapest
open-pull-requests-limit: 5
versioning-strategy: increase
commit-message:
prefix: build
include: scope
ignore:
- dependency-name: "husky"
14 changes: 14 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: continuous-integration

on: [push, pull_request]

jobs:
check:
name: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
- run: deno test
- run: deno lint
- run: deno fmt --check
35 changes: 0 additions & 35 deletions .github/workflows/continuous_integration.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/user_installation.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Custom
*.lock

# Log files
logs
*.log
Expand All @@ -16,6 +19,9 @@ coverage/**
# Dependency directories
node_modules

# NPM build output (from deno task build)
npm/

# MacOS related files
*.DS_Store
.AppleDouble
Expand Down
1 change: 0 additions & 1 deletion .npmignore

This file was deleted.

1 change: 0 additions & 1 deletion .prettierrc

This file was deleted.

66 changes: 43 additions & 23 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,30 @@

#### Changed

- re-added accidentally removed deprecated function names `classToPlain` and `plainToClass`
- re-added accidentally removed deprecated function names `classToPlain` and
`plainToClass`

### [0.5.0][v0.5.0] [BREAKING CHANGE] - 2021-11-20

> **NOTE:** This version fixes a security vulnerability allowing denial of service attacks with a specially crafted request payload. Please update as soon as possible.
> **NOTE:** This version fixes a security vulnerability allowing denial of
> service attacks with a specially crafted request payload. Please update as
> soon as possible.

#### Breaking Changes

See the breaking changes from `0.4.1` release. It was accidentally released as patch version.
See the breaking changes from `0.4.1` release. It was accidentally released as
patch version.

### [0.4.1][v0.4.1] [BREAKING CHANGE] - 2021-11-20

> **NOTE:** This version fixes a security vulnerability allowing denial of service attacks with a specially crafted request payload. Please update as soon as possible.
> **NOTE:** This version fixes a security vulnerability allowing denial of
> service attacks with a specially crafted request payload. Please update as
> soon as possible.

#### Breaking Changes

**Exported functions has been renamed**
Some of the exported functions has been renamed to better reflect what they are doing.
**Exported functions has been renamed** Some of the exported functions has been
renamed to better reflect what they are doing.

- `classToPlain` -> `instanceToPlain`
- `plainToClass` -> `plainToInstance`
Expand All @@ -52,7 +58,8 @@ Some of the exported functions has been renamed to better reflect what they are

#### Breaking Changes

See the breaking changes from `0.3.2` release. It was accidentally released as patch version.
See the breaking changes from `0.3.2` release. It was accidentally released as
patch version.

#### Added

Expand All @@ -72,9 +79,9 @@ See the breaking changes from `0.3.2` release. It was accidentally released as p

#### Breaking Changes

**Signature change for `@Transform` decorator**
From this version the `@Transform` decorator receives the transformation parameters in a a wrapper object. You need to
destructure the values you are interested in.
**Signature change for `@Transform` decorator** From this version the
`@Transform` decorator receives the transformation parameters in a a wrapper
object. You need to destructure the values you are interested in.

Old way:

Expand All @@ -90,8 +97,10 @@ New way with wrapper object:

#### Added

- `exposeDefaultValues` option has been added, when enabled properties will use their default values when no value is present for the property
- the name of the currently transformed parameter is exposed in the `@Transform` decorator
- `exposeDefaultValues` option has been added, when enabled properties will use
their default values when no value is present for the property
- the name of the currently transformed parameter is exposed in the `@Transform`
decorator

#### Fixed

Expand Down Expand Up @@ -122,7 +131,8 @@ New way with wrapper object:
#### Fixed

- circular dependency fixed
- dev dependencies removed from package.json before publishing (no more security warnings)
- dev dependencies removed from package.json before publishing (no more security
warnings)
- transformer order is deterministic now (#231)
- fix prototype pollution issue (#367)
- various fixes in documentation
Expand All @@ -131,14 +141,17 @@ New way with wrapper object:

#### Changed

- `enableImplicitConversion` has been added and imlplicit value conversion is disabled by default.
- reverted #234 - fix: write properties with defined default values on prototype which broke the `@Exclude` decorator.
- `enableImplicitConversion` has been added and imlplicit value conversion is
disabled by default.
- reverted #234 - fix: write properties with defined default values on prototype
which broke the `@Exclude` decorator.

### [0.2.2][v0.2.2] [BREAKING CHANGE]

> **NOTE:** This version is deprecated.

This version has introduced a breaking-change when this library is used with class-validator. See #257 for details.
This version has introduced a breaking-change when this library is used with
class-validator. See #257 for details.

#### Added

Expand All @@ -150,14 +163,16 @@ This version has introduced a breaking-change when this library is used with cla

#### Added

- add option to strip unkown properties via using the `excludeExtraneousValues` option
- add option to strip unkown properties via using the `excludeExtraneousValues`
option

### [0.2.0][v0.2.0] [BREAKING CHANGE]

#### Added

- add documentation for using `Set`s and `Map`s
- add opotion to pass a discriminator function to convert values into different types based on custom conditions
- add opotion to pass a discriminator function to convert values into different
types based on custom conditions
- added support for polymorphism based on a named type property

#### Fixed
Expand Down Expand Up @@ -192,13 +207,16 @@ This version has introduced a breaking-change when this library is used with cla

- renamed library from `constructor-utils` to `class-transform`
- completely renamed most of names
- renamed all main methods: `plainToConstructor` now is `plainToClass` and `constructorToPlain` is `classToPlain`, etc.
- renamed all main methods: `plainToConstructor` now is `plainToClass` and
`constructorToPlain` is `classToPlain`, etc.
- `plainToConstructorArray` method removed - now `plainToClass` handles it
- `@Skip()` decorator renamed to `@Exclude()`
- added `@Expose` decorator
- added lot of new options: groups, versioning, custom names, etc.
- methods and getters that should be exposed must be decorated with `@Expose` decorator
- added `excludedPrefix` to class transform options that allows exclude properties that start with one of the given prefix
- methods and getters that should be exposed must be decorated with `@Expose`
decorator
- added `excludedPrefix` to class transform options that allows exclude
properties that start with one of the given prefix

### 0.0.22

Expand All @@ -224,7 +242,8 @@ This version has introduced a breaking-change when this library is used with cla

#### Changed

- renamed `constructor-utils/constructor-utils` to `constructor-utils` package namespace
- renamed `constructor-utils/constructor-utils` to `constructor-utils` package
namespace

### 0.0.15

Expand All @@ -236,7 +255,8 @@ This version has introduced a breaking-change when this library is used with cla

#### Removed

- removed `import "reflect-metadata"` from source code. Now reflect metadata should be included like any other shims.
- removed `import "reflect-metadata"` from source code. Now reflect metadata
should be included like any other shims.

### 0.0.13

Expand Down
88 changes: 88 additions & 0 deletions DENO_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Class Transform - Deno Version

This project has been converted from Node.js/npm to Deno while maintaining the
ability to publish to NPM.

## Development with Deno

### Prerequisites

- [Deno](https://deno.land/) installed
- [Node.js and npm](https://nodejs.org/) (only needed for NPM publishing)

### Available Commands

```bash
# Format code
deno task fix

# Check formatting
deno task check

# Run tests
deno task test

# Build for NPM (requires Node.js/npm)
deno task build

# Run the sample
deno task dev
```

### Project Structure

- `lib/` - Source code (Deno-compatible ES modules)
- `scripts/` - Build and utility scripts
- `sample/` - Example usage
- `deno.json` - Deno configuration and tasks

### Usage

```javascript
import { Exposed, instanceToPlain, plainToInstance } from "./lib/index.js";

class Person {
name = Exposed.string();
age = Exposed.number();
}

// Transform plain object to class instance
const person = plainToInstance({ name: "John", age: 30 }, Person, []);

// Transform class instance back to plain object
const plain = instanceToPlain(person);
```

### Publishing

#### To JSR (JavaScript Registry) - Recommended for Deno projects

```bash
deno publish
```

#### To NPM - For Node.js compatibility

1. Ensure Node.js and npm are installed
2. Build the NPM package:
```bash
deno task build
```
3. Publish to NPM:
```bash
cd npm && npm publish
```

The NPM build will create a `npm/` directory with Node.js-compatible CommonJS
and ES module builds.

## Migration Notes

This project was migrated from package.json to deno.json:

- ✅ Source code already used ES modules with explicit extensions
(Deno-compatible)
- ✅ No external dependencies to convert
- ✅ TypeScript configuration integrated into deno.json
- ✅ Build pipeline using @deno/dnt for NPM compatibility
- ✅ Formatting and linting now use Deno's built-in tools
Loading