framework-do-dede 5.4.10 → 5.4.11

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.
package/README.md CHANGED
@@ -341,7 +341,7 @@ Regras principais:
341
341
 
342
342
  - `Model` guarda metadados de coluna (via `@column`) e nome da tabela (via `@model`)
343
343
  - a conversao entity -> model acontece no construtor do Model (ou em um factory)
344
- - `generateGetters()` cria getters para campos (ex.: `getName`, `isActive`, `hasProfile`)
344
+ - `generateGetters()` cria getters para campos (ex.: `getName`, `isActive`, `hasProfile`), mesmo quando o valor não foi definido.
345
345
 
346
346
  ### Storage Gateway
347
347
 
@@ -1,13 +1,15 @@
1
1
  export class Entity {
2
2
  generateGetters() {
3
- for (const property of Object.keys(this)) {
3
+ // @ts-ignore
4
+ const propertiesConfigs = (this.constructor.propertiesConfigs || {});
5
+ const properties = new Set([...Object.keys(this), ...Object.keys(propertiesConfigs)]);
6
+ for (const property of properties) {
4
7
  if (typeof this[property] === 'function')
5
8
  continue;
6
9
  let prefixName = null;
7
10
  // @ts-ignore
8
- if (this.constructor.propertiesConfigs && this.constructor.propertiesConfigs[property] && this.constructor.propertiesConfigs[property].prefix) {
9
- // @ts-ignore
10
- prefixName = this.constructor.propertiesConfigs[property].prefix;
11
+ if (propertiesConfigs[property] && propertiesConfigs[property].prefix) {
12
+ prefixName = propertiesConfigs[property].prefix;
11
13
  }
12
14
  else {
13
15
  const isBoolean = this[property] ? typeof this[property] === 'boolean' : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framework-do-dede",
3
- "version": "5.4.10",
3
+ "version": "5.4.11",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",