framework-do-dede 5.2.3 → 5.3.3

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,10 +1,10 @@
1
1
  import { Entity as DomainEntity } from "../../domain/entity";
2
2
  export declare abstract class Entity extends DomainEntity {
3
3
  [x: string]: any;
4
- to(transform?: boolean): Record<string, any>;
4
+ data(transform?: boolean): Promise<Record<string, any>>;
5
5
  protected generateGetters(): void;
6
6
  }
7
7
  export declare function Restrict(): (target: any, propertyKey: string) => void;
8
8
  export declare function VirtualProperty(propertyName: string): (target: any, methodName: string) => void;
9
- export declare function Transform(callback: (value: any) => any): PropertyDecorator;
9
+ export declare function Transform(callback: (value: any) => any | Promise<any>): PropertyDecorator;
10
10
  export declare function GetterPrefix(prefix: string): (target: any, propertyKey: string) => void;
@@ -1,6 +1,6 @@
1
1
  import { Entity as DomainEntity } from "../../domain/entity";
2
2
  export class Entity extends DomainEntity {
3
- to(transform = true) {
3
+ async data(transform = true) {
4
4
  // @ts-ignore
5
5
  const propertiesConfigs = this.constructor.propertiesConfigs;
6
6
  // @ts-ignore
@@ -14,7 +14,7 @@ export class Entity extends DomainEntity {
14
14
  // @ts-ignore
15
15
  let value = this[propName];
16
16
  if (transform && propertiesConfigs && propertiesConfigs[propName]?.transform && value) {
17
- value = propertiesConfigs[propName].transform(value);
17
+ value = await propertiesConfigs[propName].transform(value);
18
18
  }
19
19
  result[propName] = value;
20
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framework-do-dede",
3
- "version": "5.2.3",
3
+ "version": "5.3.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",