test-entity-library-asm 3.9.4 → 3.9.6

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.
Files changed (105) hide show
  1. package/dist/CustomRepository.js +21 -109
  2. package/dist/entities/AuthenticationCredential.js +54 -57
  3. package/dist/entities/Bank.js +50 -53
  4. package/dist/entities/BusinessType.js +47 -50
  5. package/dist/entities/BusinessTypeProduct.js +68 -71
  6. package/dist/entities/Category.js +148 -151
  7. package/dist/entities/CategoryDate.js +39 -42
  8. package/dist/entities/CategorySchedule.js +41 -44
  9. package/dist/entities/City.js +70 -73
  10. package/dist/entities/CodeRedemptionHistoryCompany.js +44 -47
  11. package/dist/entities/CodeRedemptionHistoryUser.js +54 -57
  12. package/dist/entities/Company.js +169 -172
  13. package/dist/entities/Configuration.d.ts +1 -1
  14. package/dist/entities/Configuration.js +25 -26
  15. package/dist/entities/Country.js +91 -94
  16. package/dist/entities/Day.js +38 -41
  17. package/dist/entities/DecorationReserve.js +46 -49
  18. package/dist/entities/DiscountCodeCompany.js +124 -129
  19. package/dist/entities/DiscountCodeUser.js +139 -142
  20. package/dist/entities/Gallery.js +88 -91
  21. package/dist/entities/Local.js +239 -242
  22. package/dist/entities/LocalDecorationReserve.js +64 -67
  23. package/dist/entities/LocalPaymentMethod.js +41 -44
  24. package/dist/entities/LocalPlan.js +88 -91
  25. package/dist/entities/LocalQualification.js +51 -54
  26. package/dist/entities/LocalReserve.js +177 -180
  27. package/dist/entities/LocalReserveStatus.js +85 -88
  28. package/dist/entities/LocalTable.js +163 -166
  29. package/dist/entities/LocalTableReserve.js +22 -25
  30. package/dist/entities/LocalTableReservePayment.js +156 -159
  31. package/dist/entities/LocalTableZone.js +84 -87
  32. package/dist/entities/Master.js +182 -185
  33. package/dist/entities/MasterNotification.js +96 -99
  34. package/dist/entities/MasterPermission.js +65 -68
  35. package/dist/entities/MasterRole.js +83 -86
  36. package/dist/entities/Partner.js +306 -309
  37. package/dist/entities/PartnerNotification.js +97 -100
  38. package/dist/entities/PartnerPlatform.js +66 -69
  39. package/dist/entities/PartnerPlatformSection.js +74 -79
  40. package/dist/entities/PartnerPlatformSectionPermission.js +113 -118
  41. package/dist/entities/PartnerPlatformSectionPermissionAssociate.js +26 -29
  42. package/dist/entities/PartnerRole.js +93 -96
  43. package/dist/entities/PartnerSession.js +94 -97
  44. package/dist/entities/PaymentMethod.js +91 -94
  45. package/dist/entities/Plan.js +86 -89
  46. package/dist/entities/PosSystem.js +69 -74
  47. package/dist/entities/Product.js +219 -222
  48. package/dist/entities/ProductDate.js +39 -42
  49. package/dist/entities/ProductGroup.js +76 -79
  50. package/dist/entities/ProductImage.js +33 -36
  51. package/dist/entities/ProductIngredient.js +54 -57
  52. package/dist/entities/ProductSchedule.js +41 -44
  53. package/dist/entities/ProductTopping.js +47 -50
  54. package/dist/entities/ReceiptConfig.js +184 -187
  55. package/dist/entities/Region.js +46 -49
  56. package/dist/entities/Request.js +152 -155
  57. package/dist/entities/RequestInvoice.js +125 -128
  58. package/dist/entities/RequestInvoiceCategory.js +34 -37
  59. package/dist/entities/RequestLocal.js +164 -169
  60. package/dist/entities/RequestLocalHistory.js +61 -64
  61. package/dist/entities/RequestLocalPayment.js +154 -157
  62. package/dist/entities/RequestLocalTable.js +34 -37
  63. package/dist/entities/RequestPrint.js +60 -63
  64. package/dist/entities/RequestProduct.js +58 -61
  65. package/dist/entities/RequestProductGroupComplement.js +51 -56
  66. package/dist/entities/ServiceDiscountsPlan.js +30 -33
  67. package/dist/entities/ServicePlan.js +84 -87
  68. package/dist/entities/Square.js +130 -133
  69. package/dist/entities/ToppingImage.js +56 -59
  70. package/dist/entities/TypeMeasureIngredient.js +45 -48
  71. package/dist/entities/User.js +234 -237
  72. package/dist/entities/UserAddress.js +114 -117
  73. package/dist/entities/UserPaymentMethod.js +118 -121
  74. package/dist/entities/VerificationCode.js +60 -63
  75. package/dist/entities/VerifyLocal.js +142 -145
  76. package/dist/entities/productGroupComplement.js +117 -120
  77. package/dist/filters/DiscountsCodeCompanyInformation.js +153 -202
  78. package/dist/filters/DiscountsCodeUserInformation.js +173 -220
  79. package/dist/filters/LocalReservesInformation.js +35 -81
  80. package/dist/filters/LocalsCompanyInformation.js +169 -218
  81. package/dist/filters/LocalsCompanyInformationForTheTable.js +157 -203
  82. package/dist/filters/VerifyLocalsInformation.js +131 -179
  83. package/dist/index.js +55 -130
  84. package/dist/transformers/dateTransformer.js +10 -13
  85. package/dist/transformers/jsonEncryptionTransformer.d.ts +2 -0
  86. package/dist/transformers/jsonEncryptionTransformer.js +57 -0
  87. package/dist/transformers/jsonTransformer.js +2 -2
  88. package/dist/utils.js +3 -3
  89. package/dist/views/DiscountsCodeUser.js +120 -123
  90. package/dist/views/LocalReserves.js +280 -283
  91. package/dist/views/LocalTableZonesFilter.js +76 -79
  92. package/dist/views/LocalsCompany.js +172 -175
  93. package/dist/views/LocalsCompanyInformationForTheMap.js +276 -279
  94. package/dist/views/LocalsCompanyInformationForTheTable.d.ts +1 -0
  95. package/dist/views/LocalsCompanyInformationForTheTable.js +384 -383
  96. package/dist/views/MasterNotifications.js +132 -135
  97. package/dist/views/PartnerNotifications.js +104 -107
  98. package/dist/views/Partners.js +140 -143
  99. package/dist/views/VerifyLocals.js +152 -155
  100. package/dist/views/ViewLocalsCompanies.js +100 -103
  101. package/package.json +2 -1
  102. package/src/entities/Configuration.ts +3 -1
  103. package/src/transformers/jsonEncryptionTransformer.ts +75 -0
  104. package/src/views/LocalsCompanyInformationForTheTable.ts +3 -0
  105. package/tsconfig.json +7 -3
@@ -10,114 +10,111 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ViewLocalsCompanies = void 0;
13
- var typeorm_1 = require("typeorm");
14
- var moment = require("moment-timezone");
15
- var __1 = require("..");
13
+ const typeorm_1 = require("typeorm");
14
+ const moment = require("moment-timezone");
15
+ const __1 = require("..");
16
16
  // JSON Transformer
17
- var jsonTransformer = {
18
- to: function (value) { return JSON.stringify(value); },
19
- from: function (value) { return JSON.parse(value); },
17
+ const jsonTransformer = {
18
+ to: (value) => JSON.stringify(value),
19
+ from: (value) => JSON.parse(value),
20
20
  };
21
- var DateTransformer = {
22
- to: function (value) {
21
+ const DateTransformer = {
22
+ to(value) {
23
23
  return moment.utc(value).format("YYYY-MM-DD HH:mm:ss");
24
24
  },
25
- from: function (value) {
25
+ from(value) {
26
26
  return moment.utc(value).tz((0, __1.getTimeZone)()).format("YYYY-MM-DD HH:mm:ss");
27
27
  },
28
28
  };
29
- var ViewLocalsCompanies = /** @class */ (function () {
30
- function ViewLocalsCompanies() {
31
- }
32
- __decorate([
33
- (0, typeorm_1.ViewColumn)(),
34
- __metadata("design:type", Number)
35
- ], ViewLocalsCompanies.prototype, "id_local", void 0);
36
- __decorate([
37
- (0, typeorm_1.ViewColumn)(),
38
- __metadata("design:type", String)
39
- ], ViewLocalsCompanies.prototype, "name_local", void 0);
40
- __decorate([
41
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
42
- __metadata("design:type", String)
43
- ], ViewLocalsCompanies.prototype, "created_local", void 0);
44
- __decorate([
45
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
46
- __metadata("design:type", String)
47
- ], ViewLocalsCompanies.prototype, "updated_local", void 0);
48
- __decorate([
49
- (0, typeorm_1.ViewColumn)(),
50
- __metadata("design:type", Number)
51
- ], ViewLocalsCompanies.prototype, "status", void 0);
52
- __decorate([
53
- (0, typeorm_1.ViewColumn)(),
54
- __metadata("design:type", Number)
55
- ], ViewLocalsCompanies.prototype, "has_square", void 0);
56
- __decorate([
57
- (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
58
- __metadata("design:type", Object)
59
- ], ViewLocalsCompanies.prototype, "details_local", void 0);
60
- __decorate([
61
- (0, typeorm_1.ViewColumn)(),
62
- __metadata("design:type", String)
63
- ], ViewLocalsCompanies.prototype, "pos_system_name", void 0);
64
- __decorate([
65
- (0, typeorm_1.ViewColumn)(),
66
- __metadata("design:type", String)
67
- ], ViewLocalsCompanies.prototype, "city_name", void 0);
68
- __decorate([
69
- (0, typeorm_1.ViewColumn)(),
70
- __metadata("design:type", String)
71
- ], ViewLocalsCompanies.prototype, "region_name", void 0);
72
- __decorate([
73
- (0, typeorm_1.ViewColumn)(),
74
- __metadata("design:type", String)
75
- ], ViewLocalsCompanies.prototype, "country_name", void 0);
76
- __decorate([
77
- (0, typeorm_1.ViewColumn)(),
78
- __metadata("design:type", String)
79
- ], ViewLocalsCompanies.prototype, "prefix", void 0);
80
- __decorate([
81
- (0, typeorm_1.ViewColumn)(),
82
- __metadata("design:type", String)
83
- ], ViewLocalsCompanies.prototype, "country_code", void 0);
84
- __decorate([
85
- (0, typeorm_1.ViewColumn)(),
86
- __metadata("design:type", Number)
87
- ], ViewLocalsCompanies.prototype, "total_partners", void 0);
88
- __decorate([
89
- (0, typeorm_1.ViewColumn)(),
90
- __metadata("design:type", String)
91
- ], ViewLocalsCompanies.prototype, "cellphone", void 0);
92
- __decorate([
93
- (0, typeorm_1.ViewColumn)(),
94
- __metadata("design:type", String)
95
- ], ViewLocalsCompanies.prototype, "email", void 0);
96
- __decorate([
97
- (0, typeorm_1.ViewColumn)(),
98
- __metadata("design:type", Number)
99
- ], ViewLocalsCompanies.prototype, "isVerifyPhone", void 0);
100
- __decorate([
101
- (0, typeorm_1.ViewColumn)(),
102
- __metadata("design:type", Number)
103
- ], ViewLocalsCompanies.prototype, "isVerifyEmail", void 0);
104
- __decorate([
105
- (0, typeorm_1.ViewColumn)(),
106
- __metadata("design:type", String)
107
- ], ViewLocalsCompanies.prototype, "address", void 0);
108
- __decorate([
109
- (0, typeorm_1.ViewColumn)(),
110
- __metadata("design:type", Number)
111
- ], ViewLocalsCompanies.prototype, "visible", void 0);
112
- __decorate([
113
- (0, typeorm_1.ViewColumn)(),
114
- __metadata("design:type", Number)
115
- ], ViewLocalsCompanies.prototype, "company", void 0);
116
- ViewLocalsCompanies = __decorate([
117
- (0, typeorm_1.ViewEntity)({
118
- name: "view_locals_companies",
119
- })
120
- ], ViewLocalsCompanies);
121
- return ViewLocalsCompanies;
122
- }());
29
+ let ViewLocalsCompanies = class ViewLocalsCompanies {
30
+ };
123
31
  exports.ViewLocalsCompanies = ViewLocalsCompanies;
32
+ __decorate([
33
+ (0, typeorm_1.ViewColumn)(),
34
+ __metadata("design:type", Number)
35
+ ], ViewLocalsCompanies.prototype, "id_local", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.ViewColumn)(),
38
+ __metadata("design:type", String)
39
+ ], ViewLocalsCompanies.prototype, "name_local", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
42
+ __metadata("design:type", String)
43
+ ], ViewLocalsCompanies.prototype, "created_local", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
46
+ __metadata("design:type", String)
47
+ ], ViewLocalsCompanies.prototype, "updated_local", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.ViewColumn)(),
50
+ __metadata("design:type", Number)
51
+ ], ViewLocalsCompanies.prototype, "status", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.ViewColumn)(),
54
+ __metadata("design:type", Number)
55
+ ], ViewLocalsCompanies.prototype, "has_square", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
58
+ __metadata("design:type", Object)
59
+ ], ViewLocalsCompanies.prototype, "details_local", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.ViewColumn)(),
62
+ __metadata("design:type", String)
63
+ ], ViewLocalsCompanies.prototype, "pos_system_name", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.ViewColumn)(),
66
+ __metadata("design:type", String)
67
+ ], ViewLocalsCompanies.prototype, "city_name", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.ViewColumn)(),
70
+ __metadata("design:type", String)
71
+ ], ViewLocalsCompanies.prototype, "region_name", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.ViewColumn)(),
74
+ __metadata("design:type", String)
75
+ ], ViewLocalsCompanies.prototype, "country_name", void 0);
76
+ __decorate([
77
+ (0, typeorm_1.ViewColumn)(),
78
+ __metadata("design:type", String)
79
+ ], ViewLocalsCompanies.prototype, "prefix", void 0);
80
+ __decorate([
81
+ (0, typeorm_1.ViewColumn)(),
82
+ __metadata("design:type", String)
83
+ ], ViewLocalsCompanies.prototype, "country_code", void 0);
84
+ __decorate([
85
+ (0, typeorm_1.ViewColumn)(),
86
+ __metadata("design:type", Number)
87
+ ], ViewLocalsCompanies.prototype, "total_partners", void 0);
88
+ __decorate([
89
+ (0, typeorm_1.ViewColumn)(),
90
+ __metadata("design:type", String)
91
+ ], ViewLocalsCompanies.prototype, "cellphone", void 0);
92
+ __decorate([
93
+ (0, typeorm_1.ViewColumn)(),
94
+ __metadata("design:type", String)
95
+ ], ViewLocalsCompanies.prototype, "email", void 0);
96
+ __decorate([
97
+ (0, typeorm_1.ViewColumn)(),
98
+ __metadata("design:type", Number)
99
+ ], ViewLocalsCompanies.prototype, "isVerifyPhone", void 0);
100
+ __decorate([
101
+ (0, typeorm_1.ViewColumn)(),
102
+ __metadata("design:type", Number)
103
+ ], ViewLocalsCompanies.prototype, "isVerifyEmail", void 0);
104
+ __decorate([
105
+ (0, typeorm_1.ViewColumn)(),
106
+ __metadata("design:type", String)
107
+ ], ViewLocalsCompanies.prototype, "address", void 0);
108
+ __decorate([
109
+ (0, typeorm_1.ViewColumn)(),
110
+ __metadata("design:type", Number)
111
+ ], ViewLocalsCompanies.prototype, "visible", void 0);
112
+ __decorate([
113
+ (0, typeorm_1.ViewColumn)(),
114
+ __metadata("design:type", Number)
115
+ ], ViewLocalsCompanies.prototype, "company", void 0);
116
+ exports.ViewLocalsCompanies = ViewLocalsCompanies = __decorate([
117
+ (0, typeorm_1.ViewEntity)({
118
+ name: "view_locals_companies",
119
+ })
120
+ ], ViewLocalsCompanies);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "3.9.4",
3
+ "version": "3.9.6",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,6 +11,7 @@
11
11
  "author": "",
12
12
  "license": "ISC",
13
13
  "dependencies": {
14
+ "crypto": "^1.0.1",
14
15
  "dotenv": "^16.4.5",
15
16
  "express": "^4.19.2",
16
17
  "moment-timezone": "^0.5.45",
@@ -1,4 +1,5 @@
1
1
  import { Column, Entity, PrimaryColumn } from "typeorm";
2
+ import { JsonEncryptionTransformer } from "../transformers/jsonEncryptionTransformer";
2
3
 
3
4
  @Entity({
4
5
  comment:
@@ -14,8 +15,9 @@ export class Configuration {
14
15
 
15
16
  @Column({
16
17
  type: "longtext",
18
+ transformer: JsonEncryptionTransformer,
17
19
  comment:
18
20
  "Columna de tipo JSON para agregar la información y configuración respecto a la plataforma.",
19
21
  })
20
- settings: string;
22
+ settings: any;
21
23
  }
@@ -0,0 +1,75 @@
1
+ import { ValueTransformer } from "typeorm";
2
+ import * as crypto from "crypto";
3
+
4
+ const ENCRYPTION_KEY =
5
+ process.env.SECRET_ENCRYPTION_KEY || "clave-32-bytes-segura";
6
+ const ALGORITHM = "aes-256-cbc";
7
+
8
+ // Crear KeyObject con exactamente 32 bytes para AES-256
9
+ const keyObject = crypto.createSecretKey(
10
+ new Uint8Array(crypto.createHash("sha256").update(ENCRYPTION_KEY).digest())
11
+ );
12
+
13
+ function decryptValue(encrypted: string): string {
14
+ if (!encrypted.includes(":")) return encrypted;
15
+
16
+ const [ivHex, content] = encrypted.split(":");
17
+ const iv = Buffer.from(ivHex, "hex");
18
+
19
+ // Pasar IV como Uint8Array para que TypeScript no dé error
20
+ const decipher = crypto.createDecipheriv(
21
+ ALGORITHM,
22
+ keyObject,
23
+ new Uint8Array(iv)
24
+ );
25
+ let decrypted = decipher.update(content, "hex", "utf8");
26
+ decrypted += decipher.final("utf8");
27
+ return decrypted;
28
+ }
29
+
30
+ function encryptValue(plain: string): string {
31
+ const iv = crypto.randomBytes(16);
32
+
33
+ // Igual aquí: IV como Uint8Array
34
+ const cipher = crypto.createCipheriv(
35
+ ALGORITHM,
36
+ keyObject,
37
+ new Uint8Array(iv)
38
+ );
39
+ let encrypted = cipher.update(plain, "utf8", "hex");
40
+ encrypted += cipher.final("hex");
41
+
42
+ return iv.toString("hex") + ":" + encrypted;
43
+ }
44
+
45
+ export const JsonEncryptionTransformer: ValueTransformer = {
46
+ to(value: any): string {
47
+ if (typeof value !== "object" || value === null) return JSON.stringify({});
48
+
49
+ const encryptedJson: Record<string, any> = {};
50
+
51
+ for (const key in value) {
52
+ if (key.startsWith("encrypted_")) {
53
+ encryptedJson[key] = encryptValue(value[key]);
54
+ } else {
55
+ encryptedJson[key] = value[key];
56
+ }
57
+ }
58
+
59
+ return JSON.stringify(encryptedJson);
60
+ },
61
+
62
+ from(dbValue: string): any {
63
+ try {
64
+ const parsed = JSON.parse(dbValue);
65
+ for (const key in parsed) {
66
+ if (key.startsWith("encrypted_")) {
67
+ parsed[key] = decryptValue(parsed[key]);
68
+ }
69
+ }
70
+ return parsed;
71
+ } catch {
72
+ return {};
73
+ }
74
+ },
75
+ };
@@ -81,6 +81,9 @@ export class LocalsCompanyInformationForTheTable {
81
81
  @ViewColumn()
82
82
  type_local: string;
83
83
 
84
+ @ViewColumn()
85
+ address_local: string;
86
+
84
87
  @ViewColumn()
85
88
  company_id: number;
86
89
 
package/tsconfig.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es5",
4
- "module": "commonjs",
5
- "declaration": true,
3
+ "target": "ES2020",
4
+ "module": "CommonJS",
5
+ "lib": ["es2020"],
6
+ "types": ["node"],
7
+ "moduleResolution": "Node",
6
8
  "outDir": "./dist",
9
+ "declaration": true,
7
10
  "strict": true,
8
11
  "emitDecoratorMetadata": true,
9
12
  "experimentalDecorators": true,
10
13
  "strictPropertyInitialization": false,
14
+ "skipLibCheck": true
11
15
  },
12
16
  "include": ["src"]
13
17
  }