test-entity-library-asm 1.6.5 → 1.6.7

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.
@@ -17,7 +17,7 @@ export declare class Partner {
17
17
  city: City;
18
18
  address: string;
19
19
  password: string;
20
- profile: Object;
20
+ profile: any;
21
21
  owner: number;
22
22
  created: Date;
23
23
  updated: Date;
@@ -19,8 +19,16 @@ var PartnerRole_1 = require("./PartnerRole");
19
19
  var Terminal_1 = require("./Terminal");
20
20
  var TerminalSession_1 = require("./TerminalSession");
21
21
  var jsonTransformer = {
22
- to: function (value) { return value; },
23
- from: function (value) { return JSON.parse(value); },
22
+ to: function (value) { return JSON.stringify(value); },
23
+ from: function (value) {
24
+ try {
25
+ return JSON.parse(value);
26
+ }
27
+ catch (error) {
28
+ console.error('Error parsing JSON:', error);
29
+ return null;
30
+ }
31
+ },
24
32
  };
25
33
  var Partner = /** @class */ (function () {
26
34
  function Partner() {
@@ -98,6 +106,7 @@ var Partner = /** @class */ (function () {
98
106
  ], Partner.prototype, "password", void 0);
99
107
  __decorate([
100
108
  (0, typeorm_1.Column)({
109
+ type: 'longtext',
101
110
  nullable: true,
102
111
  transformer: jsonTransformer,
103
112
  comment: 'Campo de tipo JSON donde se guarda información necesaria para el registro.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "1.6.5",
3
+ "version": "1.6.7",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,8 +17,15 @@ import { Terminal } from './Terminal'
17
17
  import { TerminalSession } from './TerminalSession'
18
18
 
19
19
  const jsonTransformer = {
20
- to: (value: any) => value,
21
- from: (value: string) => JSON.parse(value),
20
+ to: (value: any) => JSON.stringify(value),
21
+ from: (value: string) => {
22
+ try {
23
+ return JSON.parse(value)
24
+ } catch (error) {
25
+ console.error('Error parsing JSON:', error)
26
+ return null
27
+ }
28
+ },
22
29
  }
23
30
 
24
31
  @Entity({
@@ -87,12 +94,13 @@ export class Partner {
87
94
  password: string
88
95
 
89
96
  @Column({
97
+ type: 'longtext',
90
98
  nullable: true,
91
99
  transformer: jsonTransformer,
92
100
  comment:
93
101
  'Campo de tipo JSON donde se guarda información necesaria para el registro.',
94
102
  })
95
- profile: Object
103
+ profile: any
96
104
 
97
105
  @Column({
98
106
  default: 0,