@velajs/vela 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,18 @@
1
1
  export function createZodDto(schema, options = {}) {
2
- let ZodDto = class ZodDto {
3
- static schema = schema;
4
- constructor(initial){
5
- if (initial && typeof initial === 'object') {
6
- Object.assign(this, initial);
2
+ // Computed-property-name idiom: NamedEvaluation reads the property key and
3
+ // stamps `name` on the class at creation, so callers see `MyDto` (or the
4
+ // override) directly in stack traces and OpenAPI output — no post-hoc
5
+ // `Object.defineProperty` patching of the class's `name` slot.
6
+ const className = options.name ?? 'ZodDto';
7
+ const ZodDto = {
8
+ [className]: class {
9
+ static schema = schema;
10
+ constructor(initial){
11
+ if (initial && typeof initial === 'object') {
12
+ Object.assign(this, initial);
13
+ }
7
14
  }
8
15
  }
9
- };
10
- if (options.name) {
11
- Object.defineProperty(ZodDto, 'name', {
12
- value: options.name,
13
- configurable: true
14
- });
15
- }
16
+ }[className];
16
17
  return ZodDto;
17
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velajs/vela",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "NestJS-compatible framework for edge runtimes, powered by Hono",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",