@solidxai/core 0.1.10-beta.3 → 0.1.10-beta.4

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 (156) hide show
  1. package/dist/controllers/action-metadata.controller.js +1 -1
  2. package/dist/controllers/action-metadata.controller.js.map +1 -1
  3. package/dist/controllers/facebook-authentication.controller.js +1 -1
  4. package/dist/controllers/facebook-authentication.controller.js.map +1 -1
  5. package/dist/controllers/google-authentication.controller.js +1 -1
  6. package/dist/controllers/google-authentication.controller.js.map +1 -1
  7. package/dist/controllers/menu-item-metadata.controller.js +1 -1
  8. package/dist/controllers/menu-item-metadata.controller.js.map +1 -1
  9. package/dist/controllers/microsoft-authentication.controller.js +1 -1
  10. package/dist/controllers/microsoft-authentication.controller.js.map +1 -1
  11. package/dist/controllers/mq-message-queue.controller.js +1 -1
  12. package/dist/controllers/mq-message-queue.controller.js.map +1 -1
  13. package/dist/controllers/mq-message.controller.js +1 -1
  14. package/dist/controllers/mq-message.controller.js.map +1 -1
  15. package/dist/controllers/view-metadata.controller.js +1 -1
  16. package/dist/controllers/view-metadata.controller.js.map +1 -1
  17. package/dist/entities/chatter-message-details.entity.d.ts.map +1 -1
  18. package/dist/entities/chatter-message-details.entity.js +0 -1
  19. package/dist/entities/chatter-message-details.entity.js.map +1 -1
  20. package/dist/helpers/field-crud-managers/BigIntFieldCrudManager.js.map +1 -1
  21. package/dist/helpers/field-crud-managers/SelectionDynamicFieldCrudManager.js.map +1 -1
  22. package/dist/helpers/module-metadata-helper.service.js.map +1 -1
  23. package/dist/jobs/database/chatter-queue-subscriber-database.service.d.ts.map +1 -1
  24. package/dist/jobs/database/chatter-queue-subscriber-database.service.js +3 -3
  25. package/dist/jobs/database/chatter-queue-subscriber-database.service.js.map +1 -1
  26. package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js.map +1 -1
  27. package/dist/jobs/rabbitmq/chatter-queue-subscriber.service.d.ts.map +1 -1
  28. package/dist/jobs/rabbitmq/chatter-queue-subscriber.service.js +3 -3
  29. package/dist/jobs/rabbitmq/chatter-queue-subscriber.service.js.map +1 -1
  30. package/dist/jobs/redis/chatter-queue-subscriber-redis.service.d.ts.map +1 -1
  31. package/dist/jobs/redis/chatter-queue-subscriber-redis.service.js +3 -3
  32. package/dist/jobs/redis/chatter-queue-subscriber-redis.service.js.map +1 -1
  33. package/dist/repository/security-rule.repository.js.map +1 -1
  34. package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
  35. package/dist/seeders/permission-metadata-seeder.service.js.map +1 -1
  36. package/dist/seeders/seed-data/solid-core-metadata.json +13 -2
  37. package/dist/services/authentication.service.d.ts.map +1 -1
  38. package/dist/services/authentication.service.js +5 -5
  39. package/dist/services/authentication.service.js.map +1 -1
  40. package/dist/services/chatter-message.service.d.ts +6 -3
  41. package/dist/services/chatter-message.service.d.ts.map +1 -1
  42. package/dist/services/chatter-message.service.js +23 -35
  43. package/dist/services/chatter-message.service.js.map +1 -1
  44. package/dist/services/crud.service.js.map +1 -1
  45. package/dist/services/csv.service.js.map +1 -1
  46. package/dist/services/dashboard.service.js.map +1 -1
  47. package/dist/services/database/database-bootstrap.service.js.map +1 -1
  48. package/dist/services/excel.service.js.map +1 -1
  49. package/dist/services/export-transaction.service.js.map +1 -1
  50. package/dist/services/field-metadata.service.js.map +1 -1
  51. package/dist/services/fixtures.service.js.map +1 -1
  52. package/dist/services/import-transaction.service.js.map +1 -1
  53. package/dist/services/list-of-values.service.js.map +1 -1
  54. package/dist/services/model-metadata.service.d.ts.map +1 -1
  55. package/dist/services/model-metadata.service.js +3 -13
  56. package/dist/services/model-metadata.service.js.map +1 -1
  57. package/dist/services/module-metadata.service.js.map +1 -1
  58. package/dist/services/queues/database-publisher.service.js +3 -3
  59. package/dist/services/queues/database-publisher.service.js.map +1 -1
  60. package/dist/services/queues/database-subscriber.service.js.map +1 -1
  61. package/dist/services/queues/rabbitmq-publisher.service.js +3 -3
  62. package/dist/services/queues/rabbitmq-publisher.service.js.map +1 -1
  63. package/dist/services/queues/rabbitmq-subscriber.service.js.map +1 -1
  64. package/dist/services/queues/redis-publisher.service.d.ts.map +1 -1
  65. package/dist/services/queues/redis-publisher.service.js +4 -1
  66. package/dist/services/queues/redis-publisher.service.js.map +1 -1
  67. package/dist/services/queues/redis-subscriber.service.js.map +1 -1
  68. package/dist/services/role-metadata.service.js.map +1 -1
  69. package/dist/services/scheduled-jobs/scheduler.service.js.map +1 -1
  70. package/dist/services/settings/default-settings-provider.service.d.ts +58 -8
  71. package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -1
  72. package/dist/services/settings/default-settings-provider.service.js +21 -4
  73. package/dist/services/settings/default-settings-provider.service.js.map +1 -1
  74. package/dist/services/sms/TwilioSMSService.js.map +1 -1
  75. package/dist/services/solid-introspect.service.js.map +1 -1
  76. package/dist/services/user-activity-history.service.js.map +1 -1
  77. package/dist/services/view-metadata.service.d.ts.map +1 -1
  78. package/dist/services/view-metadata.service.js +17 -2
  79. package/dist/services/view-metadata.service.js.map +1 -1
  80. package/dist/subscribers/computed-entity-field.subscriber.js.map +1 -1
  81. package/dist/subscribers/security-rule.subscriber.d.ts.map +1 -1
  82. package/dist/subscribers/security-rule.subscriber.js.map +1 -1
  83. package/dist/subscribers/view-metadata.subscriber.js.map +1 -1
  84. package/dist/testing/core/testing-engine.js.map +1 -1
  85. package/dist/testing/reporter/webhook-reporter.js.map +1 -1
  86. package/dist-tests/api/authenticate.spec.js +119 -0
  87. package/dist-tests/api/authenticate.spec.js.map +1 -0
  88. package/dist-tests/api/crud-service.findOne.cityMaster.spec.js +97 -0
  89. package/dist-tests/api/crud-service.findOne.cityMaster.spec.js.map +1 -0
  90. package/dist-tests/api/ping.spec.js +21 -0
  91. package/dist-tests/api/ping.spec.js.map +1 -0
  92. package/dist-tests/helpers/auth.js +41 -0
  93. package/dist-tests/helpers/auth.js.map +1 -0
  94. package/dist-tests/helpers/env.js +11 -0
  95. package/dist-tests/helpers/env.js.map +1 -0
  96. package/docs/grouping-enhancements.md +89 -0
  97. package/docs/java-spring/README.md +3 -0
  98. package/docs/java-spring/solid-core-module-deep-dive-report.md +1317 -0
  99. package/docs/seed-changes.md +65 -0
  100. package/docs/test-data-workflow.md +200 -0
  101. package/docs/type-declaration-import-issue.md +24 -0
  102. package/package.json +1 -1
  103. package/src/controllers/action-metadata.controller.ts +1 -1
  104. package/src/controllers/facebook-authentication.controller.ts +1 -1
  105. package/src/controllers/google-authentication.controller.ts +1 -1
  106. package/src/controllers/menu-item-metadata.controller.ts +1 -1
  107. package/src/controllers/microsoft-authentication.controller.ts +1 -1
  108. package/src/controllers/mq-message-queue.controller.ts +1 -1
  109. package/src/controllers/mq-message.controller.ts +1 -1
  110. package/src/controllers/view-metadata.controller.ts +1 -1
  111. package/src/entities/chatter-message-details.entity.ts +1 -2
  112. package/src/helpers/field-crud-managers/BigIntFieldCrudManager.ts +1 -1
  113. package/src/helpers/field-crud-managers/SelectionDynamicFieldCrudManager.ts +1 -1
  114. package/src/helpers/module-metadata-helper.service.ts +1 -1
  115. package/src/jobs/database/chatter-queue-subscriber-database.service.ts +4 -2
  116. package/src/jobs/database/trigger-mcp-client-subscriber-database.service.ts +1 -1
  117. package/src/jobs/rabbitmq/chatter-queue-subscriber.service.ts +4 -2
  118. package/src/jobs/redis/chatter-queue-subscriber-redis.service.ts +10 -3
  119. package/src/repository/security-rule.repository.ts +1 -1
  120. package/src/seeders/module-metadata-seeder.service.ts +4 -4
  121. package/src/seeders/permission-metadata-seeder.service.ts +1 -1
  122. package/src/seeders/seed-data/solid-core-metadata.json +13 -2
  123. package/src/services/authentication.service.ts +19 -31
  124. package/src/services/chatter-message.service.ts +28 -38
  125. package/src/services/crud.service.ts +1 -1
  126. package/src/services/csv.service.ts +1 -1
  127. package/src/services/dashboard.service.ts +1 -1
  128. package/src/services/database/database-bootstrap.service.ts +1 -1
  129. package/src/services/excel.service.ts +1 -1
  130. package/src/services/export-transaction.service.ts +2 -2
  131. package/src/services/field-metadata.service.ts +1 -1
  132. package/src/services/fixtures.service.ts +2 -2
  133. package/src/services/import-transaction.service.ts +2 -2
  134. package/src/services/list-of-values.service.ts +1 -1
  135. package/src/services/model-metadata.service.ts +22 -21
  136. package/src/services/module-metadata.service.ts +7 -7
  137. package/src/services/queues/database-publisher.service.ts +4 -4
  138. package/src/services/queues/database-subscriber.service.ts +1 -1
  139. package/src/services/queues/rabbitmq-publisher.service.ts +7 -7
  140. package/src/services/queues/rabbitmq-subscriber.service.ts +8 -8
  141. package/src/services/queues/redis-publisher.service.ts +7 -4
  142. package/src/services/queues/redis-subscriber.service.ts +4 -4
  143. package/src/services/role-metadata.service.ts +1 -1
  144. package/src/services/scheduled-jobs/scheduler.service.ts +5 -5
  145. package/src/services/settings/default-settings-provider.service.ts +21 -4
  146. package/src/services/sms/TwilioSMSService.ts +2 -2
  147. package/src/services/solid-introspect.service.ts +2 -2
  148. package/src/services/user-activity-history.service.ts +1 -1
  149. package/src/services/view-metadata.service.ts +25 -8
  150. package/src/subscribers/computed-entity-field.subscriber.ts +1 -1
  151. package/src/subscribers/security-rule.subscriber.ts +8 -8
  152. package/src/subscribers/view-metadata.subscriber.ts +1 -1
  153. package/src/testing/core/testing-engine.ts +2 -2
  154. package/src/testing/reporter/webhook-reporter.ts +1 -1
  155. package/.claude/settings.local.json +0 -15
  156. package/src/services/1.js +0 -6
@@ -164,6 +164,8 @@ export class AuthenticationService {
164
164
  "mobile",
165
165
  "roles",
166
166
  "forcePasswordChange",
167
+ "isAllowedToGenerateApiKeys",
168
+ "failedLoginAttempts",
167
169
  ]);
168
170
 
169
171
  async signUp(
@@ -191,22 +193,11 @@ export class AuthenticationService {
191
193
  return this.performSignUp(signUpDto, new User(), this.userRepository);
192
194
  }
193
195
 
194
- private async performSignUp<T extends User>(
195
- signUpDto: SignUpDto,
196
- entity: T,
197
- repo: Repository<T>,
198
- ): Promise<T> {
196
+ private async performSignUp<T extends User>(signUpDto: SignUpDto, entity: T, repo: Repository<T>): Promise<T> {
199
197
  try {
200
- const onForcePasswordChange =
201
- this.settingService.getConfigValue<SolidCoreSetting>(
202
- "forceChangePasswordOnFirstLogin",
203
- );
204
- const activateUserOnRegistration =
205
- this.settingService.getConfigValue<SolidCoreSetting>(
206
- "activateUserOnRegistration",
207
- );
208
- const defaultRole =
209
- this.settingService.getConfigValue<SolidCoreSetting>("defaultRole");
198
+ const onForcePasswordChange = this.settingService.getConfigValue<SolidCoreSetting>("forceChangePasswordOnFirstLogin");
199
+ const activateUserOnRegistration = this.settingService.getConfigValue<SolidCoreSetting>("activateUserOnRegistration");
200
+ const defaultRole = this.settingService.getConfigValue<SolidCoreSetting>("defaultRole");
210
201
 
211
202
  var { user, pwd, autoGeneratedPwd } = await this.populateForSignup<T>(
212
203
  entity,
@@ -220,17 +211,14 @@ export class AuthenticationService {
220
211
  }
221
212
  const savedUser = await repo.save(user);
222
213
  const userRoles = signUpDto.roles ?? [];
223
- if (
224
- (signUpDto.roles?.length ?? 0) === 0 &&
225
- signUpDto.username !== "sa" &&
226
- defaultRole
227
- ) {
214
+ if ((signUpDto.roles?.length ?? 0) === 0 && signUpDto.username !== "sa" && defaultRole) {
228
215
  userRoles.push(defaultRole);
229
216
  }
230
217
  await this.handlePostSignup(savedUser, userRoles, pwd, autoGeneratedPwd);
231
218
 
232
219
  return savedUser;
233
- } catch (err) {
220
+ }
221
+ catch (err: any) {
234
222
  const pgUniqueViolationErrorCode = "23505";
235
223
  if (err.code === pgUniqueViolationErrorCode) {
236
224
  throw new ConflictException(
@@ -485,7 +473,7 @@ export class AuthenticationService {
485
473
  validationSource,
486
474
  );
487
475
  await this.notifyUserOnOtpInitiateRegistration(user, validationSource);
488
- } catch (err) {
476
+ } catch (err: any) {
489
477
  if (err.code === "23505") {
490
478
  throw new ConflictException(ERROR_MESSAGES.USER_ALREADY_EXISTS);
491
479
  }
@@ -1306,7 +1294,7 @@ export class AuthenticationService {
1306
1294
  // Assuming all users do not have mobile as mandatory.
1307
1295
  if (
1308
1296
  forgotPasswordSendVerificationTokenOn ==
1309
- ForgotPasswordSendVerificationTokenOn.MOBILE &&
1297
+ ForgotPasswordSendVerificationTokenOn.MOBILE &&
1310
1298
  user.mobile
1311
1299
  ) {
1312
1300
  const smsService = this.smsFactory.getSmsService();
@@ -1336,11 +1324,11 @@ export class AuthenticationService {
1336
1324
  confirmForgotPasswordDto.verificationToken,
1337
1325
  );
1338
1326
  if (!user)
1339
- throw new UnauthorizedException(ERROR_MESSAGES.INVALID_CREDENTIALS);
1327
+ throw new UnauthorizedException("Invalid verification token");
1340
1328
  if (user.lastLoginProvider !== "local")
1341
1329
  throw new UnauthorizedException(ERROR_MESSAGES.INVALID_CREDENTIALS);
1342
1330
  if (!user.active)
1343
- throw new UnauthorizedException(ERROR_MESSAGES.INVALID_CREDENTIALS);
1331
+ throw new UnauthorizedException("User is inactive");
1344
1332
 
1345
1333
  // 1) Atomically consume the token (only one request can succeed)
1346
1334
  const { affected } = await m
@@ -1432,7 +1420,7 @@ export class AuthenticationService {
1432
1420
  // Assuming all users do not have mobile as mandatory.
1433
1421
  if (
1434
1422
  forgotPasswordSendVerificationTokenOn ==
1435
- ForgotPasswordSendVerificationTokenOn.MOBILE &&
1423
+ ForgotPasswordSendVerificationTokenOn.MOBILE &&
1436
1424
  user.mobile
1437
1425
  ) {
1438
1426
  const smsService = this.smsFactory.getSmsService();
@@ -1548,7 +1536,7 @@ export class AuthenticationService {
1548
1536
  accessToken: await this.generateAccessToken(user),
1549
1537
  refreshToken: currentRefreshToken,
1550
1538
  };
1551
- } catch (err) {
1539
+ } catch (err: any) {
1552
1540
  if (err instanceof InvalidatedRefreshTokenError) {
1553
1541
  // Take action: notify user that his refresh token might have been stolen?
1554
1542
  throw new UnauthorizedException(ERROR_MESSAGES.ACCESS_DENIED);
@@ -1599,7 +1587,7 @@ export class AuthenticationService {
1599
1587
  } else {
1600
1588
  throw new UnauthorizedException(ERROR_MESSAGES.INVALID_USER_PROFILE);
1601
1589
  }
1602
- } catch (error) {
1590
+ } catch (error: any) {
1603
1591
  throw new UnauthorizedException(
1604
1592
  ERROR_MESSAGES.GOOGLE_OAUTH_PROFILE_FETCH_FAILED,
1605
1593
  );
@@ -1668,7 +1656,7 @@ export class AuthenticationService {
1668
1656
  } else {
1669
1657
  throw new UnauthorizedException(ERROR_MESSAGES.INVALID_USER_PROFILE);
1670
1658
  }
1671
- } catch (error) {
1659
+ } catch (error: any) {
1672
1660
  if (error instanceof UnauthorizedException) {
1673
1661
  throw error;
1674
1662
  }
@@ -1733,7 +1721,7 @@ export class AuthenticationService {
1733
1721
  } else {
1734
1722
  throw new UnauthorizedException(ERROR_MESSAGES.INVALID_USER_PROFILE);
1735
1723
  }
1736
- } catch (error) {
1724
+ } catch (error: any) {
1737
1725
  throw new UnauthorizedException("Microsoft OAuth profile fetch failed");
1738
1726
  }
1739
1727
  }
@@ -1880,7 +1868,7 @@ export class AuthenticationService {
1880
1868
  await this.userActivityHistoryService.logEvent("logout", user);
1881
1869
 
1882
1870
  return { message: SUCCESS_MESSAGES.LOGOUT_SUCCESS };
1883
- } catch (err) {
1871
+ } catch (err: any) {
1884
1872
  throw err instanceof UnauthorizedException ||
1885
1873
  err instanceof InternalServerErrorException
1886
1874
  ? err
@@ -47,6 +47,26 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
47
47
  super(entityManager, repo, 'chatterMessage', 'solid-core', moduleRef);
48
48
  }
49
49
 
50
+ private resolveMessageUserId(userId?: number | null): number | null {
51
+ if (userId) {
52
+ return userId;
53
+ }
54
+
55
+ return this.requestContextService.getActiveUser()?.sub ?? null;
56
+ }
57
+
58
+ private resolveMessageUser(userId?: number | null) {
59
+ const resolvedUserId = this.resolveMessageUserId(userId);
60
+ return resolvedUserId ? ({ id: resolvedUserId } as any) : null;
61
+ }
62
+
63
+ private stampMessageAuditFields(chatterMessage: ChatterMessage, userId?: number | null) {
64
+ const resolvedUserId = this.resolveMessageUserId(userId);
65
+ chatterMessage.user = resolvedUserId ? ({ id: resolvedUserId } as any) : null;
66
+ chatterMessage.createdBy = resolvedUserId;
67
+ chatterMessage.updatedBy = resolvedUserId;
68
+ }
69
+
50
70
  async markCompleted(id: number) {
51
71
  const activeUser = this.requestContextService.getActiveUser();
52
72
  if (!activeUser) {
@@ -78,14 +98,7 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
78
98
  });
79
99
  chatterMessage.modelDisplayName = model?.displayName ?? null;
80
100
 
81
- const activeUser = this.requestContextService.getActiveUser();
82
-
83
- if (activeUser) {
84
- const userId = activeUser?.sub;
85
- chatterMessage.user = { id: userId } as any;
86
- } else {
87
- chatterMessage.user = null;
88
- }
101
+ this.stampMessageAuditFields(chatterMessage);
89
102
 
90
103
  const savedMessage = await this.repo.save(chatterMessage);
91
104
 
@@ -114,7 +127,7 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
114
127
  return savedMessage;
115
128
  }
116
129
 
117
- async postAuditMessageOnInsert(entity: any, modelName: string, messageQueue: boolean = false) {
130
+ async postAuditMessageOnInsert(entity: any, modelName: string, messageQueue: boolean = false, userId?: number | null) {
118
131
  if (!entity) {
119
132
  return;
120
133
  }
@@ -139,8 +152,6 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
139
152
  !(field.type === 'relation' && field.relationType === 'one-to-many')
140
153
  );
141
154
 
142
- const activeUser = this.requestContextService.getActiveUser();
143
-
144
155
  const chatterMessage = new ChatterMessage();
145
156
  chatterMessage.messageType = CHATTER_MESSAGE_TYPE.AUDIT;
146
157
  chatterMessage.messageSubType = CHATTER_MESSAGE_SUBTYPE.AUDIT_INSERT;
@@ -150,13 +161,7 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
150
161
  chatterMessage.modelDisplayName = model?.displayName;
151
162
  chatterMessage.modelUserKey = entity[model?.userKeyField?.name];
152
163
  chatterMessage.messageBody = `New ${model?.displayName} created`;
153
-
154
- if (activeUser) {
155
- const userId = activeUser?.sub;
156
- chatterMessage.user = { id: userId } as any;
157
- } else {
158
- chatterMessage.user = null;
159
- }
164
+ this.stampMessageAuditFields(chatterMessage, userId);
160
165
 
161
166
  const savedMessage = await this.repo.save(chatterMessage);
162
167
 
@@ -177,7 +182,7 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
177
182
  }
178
183
  }
179
184
 
180
- async postAuditMessageOnUpdate(entity: any, modelName: string, databaseEntity: any, updatedColumns: any[] = [], messageQueue: boolean = false) {
185
+ async postAuditMessageOnUpdate(entity: any, modelName: string, databaseEntity: any, updatedColumns: any[] = [], messageQueue: boolean = false, userId?: number | null) {
181
186
  if (!databaseEntity || !entity) {
182
187
  return;
183
188
  }
@@ -259,8 +264,6 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
259
264
  return;
260
265
  }
261
266
 
262
- const activeUser = this.requestContextService.getActiveUser();
263
-
264
267
  const chatterMessage = new ChatterMessage();
265
268
  chatterMessage.messageType = CHATTER_MESSAGE_TYPE.AUDIT;
266
269
  chatterMessage.messageSubType = CHATTER_MESSAGE_SUBTYPE.AUDIT_UPDATE;
@@ -270,13 +273,7 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
270
273
  chatterMessage.modelDisplayName = model.displayName;
271
274
  chatterMessage.modelUserKey = entity[model?.userKeyField?.name];
272
275
  chatterMessage.messageBody = `${model?.displayName} updated`;
273
-
274
- if (activeUser) {
275
- const userId = activeUser?.sub;
276
- chatterMessage.user = { id: userId } as any;
277
- } else {
278
- chatterMessage.user = null;
279
- }
276
+ this.stampMessageAuditFields(chatterMessage, userId);
280
277
 
281
278
  const savedMessage = await this.repo.save(chatterMessage);
282
279
 
@@ -294,7 +291,7 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
294
291
  }
295
292
  }
296
293
 
297
- async postAuditMessageOnDelete(modelName: string, databaseEntity: any, messageQueue: boolean = false) {
294
+ async postAuditMessageOnDelete(modelName: string, databaseEntity: any, messageQueue: boolean = false, userId?: number | null) {
298
295
  const model = await this.modelMetadataRepo.findOne({
299
296
  where: {
300
297
  singularName: lowerFirst(modelName)
@@ -335,14 +332,7 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
335
332
  chatterMessage.modelUserKey = databaseEntity[model?.userKeyField?.name];
336
333
  chatterMessage.messageBody = `${model?.displayName} deleted`;
337
334
 
338
- const activeUser = this.requestContextService.getActiveUser();
339
-
340
- if (activeUser) {
341
- const userId = activeUser?.sub;
342
- chatterMessage.user = { id: userId } as any;
343
- } else {
344
- chatterMessage.user = null;
345
- }
335
+ this.stampMessageAuditFields(chatterMessage, userId);
346
336
 
347
337
  const savedMessage = await this.repo.save(chatterMessage);
348
338
 
@@ -421,7 +411,7 @@ export class ChatterMessageService extends CRUDService<ChatterMessage> {
421
411
  if (value.id) {
422
412
  return value.id.toString();
423
413
  }
424
- } catch (error) {
414
+ } catch (error: any) {
425
415
  console.error('Error fetching related model metadata:', error);
426
416
  return value.id ? value.id.toString() : '';
427
417
  }
@@ -129,7 +129,7 @@ export class CRUDService<T extends CommonEntity> { // Add two generic value i.e
129
129
  await this.saveMedia(model, files, savedEntity);
130
130
  }
131
131
  return savedEntity;
132
- } catch (error) {
132
+ } catch (error: any) {
133
133
  if (error instanceof QueryFailedError && error.message.includes('duplicate key value violates unique constraint')) {
134
134
  throw new BadRequestException(ERROR_MESSAGES.DUPLICATE_ENTRY);
135
135
  }
@@ -68,7 +68,7 @@ export class CsvService {
68
68
  }
69
69
 
70
70
  csvStream.end(); // ✅ Ensure CSV stream is finalized
71
- } catch (error) {
71
+ } catch (error: any) {
72
72
  this.logger.error(`❌ Error writing CSV: ${error.message}`);
73
73
  passThrough.destroy(error); // ✅ Properly destroy stream on error
74
74
  throw error;
@@ -117,7 +117,7 @@ export class DashboardService extends CRUDService<Dashboard> {
117
117
  const filePath = await this.moduleMetadataHelperService.getModuleMetadataFilePath(moduleName);
118
118
  try {
119
119
  await fs.access(filePath);
120
- } catch (error) {
120
+ } catch (error: any) {
121
121
  throw new Error(`Configuration file not found for module: ${moduleName}`);
122
122
  }
123
123
  const metaData = await this.moduleMetadataHelperService.getModuleMetadataConfiguration(filePath);
@@ -80,7 +80,7 @@ export class DatabaseBootstrapService implements OnModuleInit {
80
80
  await this.dataSource.query(sql);
81
81
 
82
82
  this.logger.debug(`[${this.dataSource.name}] Applied ${fileName}`);
83
- } catch (error) {
83
+ } catch (error: any) {
84
84
  // DO NOT THROW — continue with next file
85
85
  this.logger.error(
86
86
  `[${this.dataSource.name}] Failed ${fileName}`,
@@ -93,7 +93,7 @@ export class ExcelService {
93
93
 
94
94
  workbook.commit();
95
95
  // passThrough.end(); // ✅ Properly close the stream
96
- } catch (error) {
96
+ } catch (error: any) {
97
97
  this.logger.error(`❌ Error writing Excel: ${error.message}`);
98
98
  passThrough.destroy(error); // Destroy stream
99
99
  throw error;
@@ -90,7 +90,7 @@ export class ExportTransactionService extends CRUDService<ExportTransaction> {
90
90
  const fileName = this.getFileName(templateName, uuid, templateFormat);
91
91
  const mimeType = this.getMimeType(templateFormat);
92
92
  return { exportStream, fileName, mimeType, exportTransaction };
93
- } catch (error) {
93
+ } catch (error: any) {
94
94
  this.updateExportTransaction(id, ExportStatus.FAILED, error.message);
95
95
  throw error;
96
96
  }
@@ -114,7 +114,7 @@ export class ExportTransactionService extends CRUDService<ExportTransaction> {
114
114
  // Store the file using the appropriate storage provider
115
115
  await this.storeExportStream(exportStream, exportTransaction, this.getFileName(templateName, uuid, templateFormat));
116
116
  this.updateExportTransaction(id, ExportStatus.COMPLETED);
117
- } catch (error) {
117
+ } catch (error: any) {
118
118
  this.updateExportTransaction(id, ExportStatus.FAILED, error.message);
119
119
  throw error;
120
120
 
@@ -1256,7 +1256,7 @@ export class FieldMetadataService implements OnApplicationBootstrap {
1256
1256
  // Write the updated object back to the file
1257
1257
  const updatedContent = JSON.stringify(metaData, null, 2);
1258
1258
  await fs.writeFile(filePath, updatedContent);
1259
- } catch (error) {
1259
+ } catch (error: any) {
1260
1260
  this.logger.error('File creation failed:', error);
1261
1261
  throw new Error(ERROR_MESSAGES.FILE_WRITE_FAILED); // Trigger rollback
1262
1262
  }
@@ -35,7 +35,7 @@ export class FixturesService {
35
35
  // Create the model instance in the database
36
36
  const createdInstance = await modelServiceInstance.create(modelFixture.data);
37
37
  this.logger.log(`Successfully created fixture for model: ${modelFixture.singularName} with ID: ${createdInstance.id}`);
38
- } catch (error) {
38
+ } catch (error: any) {
39
39
  this.logger.error(`Error creating fixture for model: ${modelFixture.singularName} - ${error.message}`);
40
40
  }
41
41
  }
@@ -59,7 +59,7 @@ export class FixturesService {
59
59
  const deleteCriteria = modelFixture.data; // This should be adjusted based on actual criteria
60
60
  await modelServiceInstance.delete(deleteCriteria);
61
61
  this.logger.log(`Successfully deleted fixture for model: ${modelFixture.singularName}`);
62
- } catch (error) {
62
+ } catch (error: any) {
63
63
  this.logger.error(`Error deleting fixture for model: ${modelFixture.singularName} - ${error.message}`);
64
64
  }
65
65
  }
@@ -25,7 +25,7 @@ import { SolidIntrospectService } from './solid-introspect.service';
25
25
  import { ModelMetadataHelperService } from 'src/helpers/model-metadata-helper.service';
26
26
  import { getUserExcludedFields } from 'src/helpers/user-helper';
27
27
  import { ActiveUserData } from 'src/interfaces/active-user-data.interface';
28
- import {upperFirst, camelCase} from 'lodash';
28
+ import { upperFirst, camelCase } from 'lodash';
29
29
  import { classify } from '../helpers/string.helper';
30
30
 
31
31
  interface ImportTemplateFileInfo {
@@ -557,7 +557,7 @@ export class ImportTransactionService extends CRUDService<ImportTransaction> {
557
557
  const createdRecord = await this.insertRecord(record, JSON.parse(importTransaction.mapping) as ImportMapping[], importTransaction.modelMetadata, modelService);
558
558
  ids.push(createdRecord.id); // Add the ID of the created record to the ids array
559
559
  }
560
- catch (error) {
560
+ catch (error: any) {
561
561
  this.logger.debug(`Error inserting record: ${JSON.stringify(record)}. Error: ${error.message}`);
562
562
  // Get the Import transaction error log repo
563
563
  const errorLog = await this.createErrorLogEntry(importTransaction, record, error);
@@ -140,7 +140,7 @@ export class ListOfValuesService extends CRUDService<ListOfValues> {
140
140
  const filePath = await this.moduleMetadataHelperService.getModuleMetadataFilePath(moduleName);
141
141
  try {
142
142
  await fs.access(filePath);
143
- } catch (error) {
143
+ } catch (error: any) {
144
144
  throw new Error(`Configuration file not found for module: ${moduleName}`);
145
145
  }
146
146
  const metaData = await this.moduleMetadataHelperService.getModuleMetadataConfiguration(filePath);
@@ -154,7 +154,7 @@ export class ModelMetadataService {
154
154
 
155
155
  return model
156
156
  });
157
- } catch (error) {
157
+ } catch (error: any) {
158
158
  // console.error('Transaction failed:', error);
159
159
  this.logger.error('Transaction failed:', error);
160
160
  throw error;
@@ -189,7 +189,7 @@ export class ModelMetadataService {
189
189
 
190
190
  // return model
191
191
  });
192
- } catch (error) {
192
+ } catch (error: any) {
193
193
  // console.error('Transaction failed:', error);
194
194
  this.logger.error('Transaction failed:', error);
195
195
  throw error;
@@ -309,7 +309,7 @@ export class ModelMetadataService {
309
309
  const updatedContent = JSON.stringify(metaData, null, 2);
310
310
  await fs.writeFile(filePath, updatedContent);
311
311
 
312
- } catch (error) {
312
+ } catch (error: any) {
313
313
  // console.error('File creation failed:', error);
314
314
  this.logger.error('File creation failed:', error);
315
315
  throw new Error(ERROR_MESSAGES.FILE_WRITE_FAILED); // Trigger rollback
@@ -490,7 +490,7 @@ export class ModelMetadataService {
490
490
  const updatedContent = JSON.stringify(metaData, null, 2);
491
491
  await fs.writeFile(filePath, updatedContent);
492
492
 
493
- } catch (error) {
493
+ } catch (error: any) {
494
494
  // console.error('File creation failed:', error);
495
495
  this.logger.error('File creation failed:', error);
496
496
  throw new Error(ERROR_MESSAGES.FILE_WRITE_FAILED); // Trigger rollback
@@ -524,7 +524,7 @@ export class ModelMetadataService {
524
524
  await this.cleanupOnDelete(entity.id);
525
525
  const r = await this.modelMetadataRepo.remove(entity);
526
526
  return r;
527
- } catch (error) {
527
+ } catch (error: any) {
528
528
  }
529
529
  }
530
530
 
@@ -621,7 +621,7 @@ export class ModelMetadataService {
621
621
  try {
622
622
  await fs.unlink(fileToDelete);
623
623
  this.logger.log(`Deleted file: ${fileToDelete}`);
624
- } catch (error) {
624
+ } catch (error: any) {
625
625
  this.logger.error(`Error deleting file: ${fileToDelete}`, error);
626
626
  }
627
627
  }
@@ -725,7 +725,7 @@ export class ModelMetadataService {
725
725
  );
726
726
  this.solidTsMorphService.removeModuleMembers(moduleFilePath, removedIdentifiers);
727
727
  await this.solidTsMorphService.commit();
728
- } catch (error) {
728
+ } catch (error: any) {
729
729
  this.solidTsMorphService.rollback();
730
730
  this.logger.error(`Failed to clean up module file for model '${modelEntity.singularName}':`, error);
731
731
  }
@@ -789,7 +789,7 @@ export class ModelMetadataService {
789
789
  await this.populateVAMConfigInDb(model);
790
790
  await this.populateVAMConfigInFile(model);
791
791
  });
792
- } catch (error) {
792
+ } catch (error: any) {
793
793
  this.logger.error('generateVAMConfig Transaction failed:', error);
794
794
  throw error;
795
795
  }
@@ -816,7 +816,7 @@ export class ModelMetadataService {
816
816
  const updatedContent = JSON.stringify(metaData, null, 2);
817
817
  await fs.writeFile(filePath, updatedContent);
818
818
 
819
- } catch (error) {
819
+ } catch (error: any) {
820
820
  // console.error('File creation failed:', error);
821
821
  this.logger.error('File updation failed for View, action, menus config:', error);
822
822
  throw new Error('File updation failed for View, action, menus config'); // Trigger rollback
@@ -826,15 +826,15 @@ export class ModelMetadataService {
826
826
  // Populate the View, Actions and Menus in the config file
827
827
  private populateVAMConfigInFileInternal(formViewLayoutFields: any[], model: ModelMetadata, listViewLayoutFields: { type: string; attrs: { name: string; }; }[], treeViewLayoutFields: { type: string; attrs: { name: string; }; }[], metaData: any) {
828
828
  const column1Fields = [];
829
- const column2Fields = [];
829
+ // const column2Fields = [];
830
830
 
831
831
  // Distribute fields between two columns
832
832
  for (let i = 0; i < formViewLayoutFields.length; i++) {
833
- if (i % 2 === 0) {
834
- column1Fields.push(formViewLayoutFields[i]);
835
- } else {
836
- column2Fields.push(formViewLayoutFields[i]);
837
- }
833
+ // if (i % 2 === 0) {
834
+ column1Fields.push(formViewLayoutFields[i]);
835
+ // } else {
836
+ // column2Fields.push(formViewLayoutFields[i]);
837
+ // }
838
838
  }
839
839
  const actionName = `${model.singularName}-list-action`;
840
840
  const treeViewActionName = `${model.singularName}-tree-action`;
@@ -842,6 +842,7 @@ export class ModelMetadataService {
842
842
  const treeViewName = `${model.singularName}-tree-view`;
843
843
  const formViewName = `${model.singularName}-form-view`;
844
844
  const menuName = `${model.singularName}-menu-item`;
845
+ const nextMenuSequenceNumber = (metaData.menus?.length ?? 0) + 1;
845
846
 
846
847
  const action = {
847
848
  displayName: `${model.displayName} List Action`,
@@ -874,7 +875,7 @@ export class ModelMetadataService {
874
875
  const menu = {
875
876
  displayName: `${model.displayName}`,
876
877
  name: menuName,
877
- sequenceNumber: 1,
878
+ sequenceNumber: nextMenuSequenceNumber,
878
879
  actionUserKey: actionName,
879
880
  moduleUserKey: `${model.module.name}`,
880
881
  parentMenuItemUserKey: "",
@@ -955,11 +956,11 @@ export class ModelMetadataService {
955
956
  attrs: { name: "group-1", label: "", className: "col-12 sm:col-12 md:col-6 lg:col-6" },
956
957
  children: column1Fields
957
958
  },
958
- {
959
- type: "column",
960
- attrs: { name: "group-2", label: "", className: "col-12 sm:col-12 md:col-6 lg:col-6" },
961
- children: column2Fields
962
- }
959
+ // {
960
+ // type: "column",
961
+ // attrs: { name: "group-2", label: "", className: "col-12 sm:col-12 md:col-6 lg:col-6" },
962
+ // children: column2Fields
963
+ // }
963
964
  ]
964
965
  },
965
966
  ]
@@ -123,7 +123,7 @@ export class ModuleMetadataService {
123
123
  await this.createInFile(module);
124
124
  return module
125
125
  });
126
- } catch (error) {
126
+ } catch (error: any) {
127
127
  // console.error('Transaction failed:', error);
128
128
  this.logger.error('Transaction failed:', error);
129
129
  throw error;
@@ -181,7 +181,7 @@ export class ModuleMetadataService {
181
181
  actionUserKey: `${module?.name}-home-action`,
182
182
  moduleUserKey: module?.name,
183
183
  parentMenuItemUserKey: "",
184
- iconName : "home"
184
+ iconName: "home"
185
185
  }
186
186
  ],
187
187
  views: [],
@@ -204,7 +204,7 @@ export class ModuleMetadataService {
204
204
  // Write the JSON to the file
205
205
  await fs.writeFile(filePath, metadataJson);
206
206
 
207
- } catch (error) {
207
+ } catch (error: any) {
208
208
  // console.error('File creation failed:', error);
209
209
  this.logger.error('File creation failed:', error);
210
210
  throw new Error(ERROR_MESSAGES.FILE_WRITE_FAILED); // Trigger rollback
@@ -219,7 +219,7 @@ export class ModuleMetadataService {
219
219
  await this.updateInFile(module);
220
220
  return module
221
221
  });
222
- } catch (error) {
222
+ } catch (error: any) {
223
223
  // console.error('Transaction failed:', error);
224
224
  this.logger.error('Transaction failed:', error);
225
225
  throw error;
@@ -255,7 +255,7 @@ export class ModuleMetadataService {
255
255
  try {
256
256
  metaData = await this.moduleMetadataHelperService.getModuleMetadataConfiguration(filePath);
257
257
 
258
- } catch (error) {
258
+ } catch (error: any) {
259
259
  metaData = {
260
260
  moduleMetadata: {
261
261
  name: null,
@@ -290,7 +290,7 @@ export class ModuleMetadataService {
290
290
  const updatedContent = JSON.stringify(metaData, null, 2);
291
291
  await fs.writeFile(filePath, updatedContent);
292
292
 
293
- } catch (error) {
293
+ } catch (error: any) {
294
294
  // console.error('File creation failed:', error);
295
295
  this.logger.error('File creation failed:', error);
296
296
  throw new Error(ERROR_MESSAGES.FILE_WRITE_FAILED); // Trigger rollback
@@ -365,7 +365,7 @@ export class ModuleMetadataService {
365
365
  await fs.rm(modulePath, { recursive: true, force: true });
366
366
  await fs.rm(moduleMetadataPAth, { recursive: true, force: true });
367
367
  this.logger.log(`Deleted file: ${moduleMetadataPAth}`);
368
- } catch (error) {
368
+ } catch (error: any) {
369
369
  this.logger.error(`Error deleting file: ${moduleMetadataPAth}`, error);
370
370
  throw new Error(ERROR_MESSAGES.FILE_DELETE_FAILED); // Trigger rollback
371
371
  }
@@ -15,9 +15,9 @@ export abstract class DatabasePublisher<T> implements QueuePublisher<T> {
15
15
  protected readonly mqMessageService: MqMessageService,
16
16
  protected readonly mqMessageQueueService: MqMessageQueueService,
17
17
  ) {
18
- this.serviceRole = process.env.QUEUES_SERVICE_ROLE;
19
- if (!this.serviceRole) {
20
- this.logger.debug('Queue service Role is not defined in the environment variables');
18
+ this.serviceRole = process.env.QUEUES_SERVICE_ROLE || 'both';
19
+ if (!process.env.QUEUES_SERVICE_ROLE) {
20
+ this.logger.debug('QUEUES_SERVICE_ROLE is not defined. Defaulting DatabasePublisher service role to "both".');
21
21
  }
22
22
  // this.logger.debug(`DatabasePublisher instance created with options: ${JSON.stringify(this.options())}`);
23
23
  }
@@ -74,7 +74,7 @@ export abstract class DatabasePublisher<T> implements QueuePublisher<T> {
74
74
  mqMessageQueueId: mqMessageQueue.id,
75
75
  });
76
76
  }
77
- catch (error) {
77
+ catch (error: any) {
78
78
  this.logger.error(error.message, error.stack);
79
79
  }
80
80
 
@@ -108,7 +108,7 @@ export abstract class DatabaseSubscriber<T> implements OnModuleInit, QueueSubscr
108
108
  this.logger.log(`DatabaseSubscriber for queue ${queueName} is disabled because it does not match QUEUES_QUEUE_NAME_REGEX_TO_ENABLE=${queueNameRegex}`);
109
109
  return;
110
110
  }
111
- } catch (error) {
111
+ } catch (error: any) {
112
112
  this.logger.error(`Invalid QUEUES_QUEUE_NAME_REGEX_TO_ENABLE regex "${queueNameRegex}". Subscriber for queue ${queueName} will not start.`);
113
113
  return;
114
114
  }