@solidstarters/solid-core 1.2.155 → 1.2.157

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 (161) hide show
  1. package/dist/config/common.config.d.ts +2 -0
  2. package/dist/config/common.config.d.ts.map +1 -1
  3. package/dist/config/common.config.js +1 -0
  4. package/dist/config/common.config.js.map +1 -1
  5. package/dist/decorators/whatsapp-provider.decorator.d.ts +3 -0
  6. package/dist/decorators/whatsapp-provider.decorator.d.ts.map +1 -0
  7. package/dist/decorators/whatsapp-provider.decorator.js +11 -0
  8. package/dist/decorators/whatsapp-provider.decorator.js.map +1 -0
  9. package/dist/dtos/create-list-of-values.dto.d.ts +2 -0
  10. package/dist/dtos/create-list-of-values.dto.d.ts.map +1 -1
  11. package/dist/dtos/create-list-of-values.dto.js +12 -1
  12. package/dist/dtos/create-list-of-values.dto.js.map +1 -1
  13. package/dist/dtos/update-list-of-values.dto.d.ts +2 -0
  14. package/dist/dtos/update-list-of-values.dto.d.ts.map +1 -1
  15. package/dist/dtos/update-list-of-values.dto.js +12 -1
  16. package/dist/dtos/update-list-of-values.dto.js.map +1 -1
  17. package/dist/entities/list-of-values.entity.d.ts +2 -0
  18. package/dist/entities/list-of-values.entity.d.ts.map +1 -1
  19. package/dist/entities/list-of-values.entity.js +7 -1
  20. package/dist/entities/list-of-values.entity.js.map +1 -1
  21. package/dist/factories/whatsapp.factory.d.ts +14 -0
  22. package/dist/factories/whatsapp.factory.d.ts.map +1 -0
  23. package/dist/factories/whatsapp.factory.js +53 -0
  24. package/dist/factories/whatsapp.factory.js.map +1 -0
  25. package/dist/helpers/solid-registry.d.ts +3 -0
  26. package/dist/helpers/solid-registry.d.ts.map +1 -1
  27. package/dist/helpers/solid-registry.js +7 -0
  28. package/dist/helpers/solid-registry.js.map +1 -1
  29. package/dist/index.d.ts +3 -3
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +3 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/interfaces.d.ts +3 -0
  34. package/dist/interfaces.d.ts.map +1 -1
  35. package/dist/interfaces.js.map +1 -1
  36. package/dist/jobs/database/{whatsapp-publisher-database.service.d.ts → msg91-whatsapp-publisher-database.service.d.ts} +2 -2
  37. package/dist/jobs/database/msg91-whatsapp-publisher-database.service.d.ts.map +1 -0
  38. package/dist/jobs/database/{whatsapp-publisher-database.service.js → msg91-whatsapp-publisher-database.service.js} +8 -8
  39. package/dist/jobs/database/msg91-whatsapp-publisher-database.service.js.map +1 -0
  40. package/dist/jobs/database/{whatsapp-queue-options-database.d.ts → msg91-whatsapp-queue-options-database.d.ts} +1 -1
  41. package/dist/jobs/database/msg91-whatsapp-queue-options-database.d.ts.map +1 -0
  42. package/dist/jobs/database/{whatsapp-queue-options-database.js → msg91-whatsapp-queue-options-database.js} +2 -2
  43. package/dist/jobs/database/msg91-whatsapp-queue-options-database.js.map +1 -0
  44. package/dist/jobs/database/{whatsapp-subscriber-database.service.d.ts → msg91-whatsapp-subscriber-database.service.d.ts} +2 -2
  45. package/dist/jobs/database/msg91-whatsapp-subscriber-database.service.d.ts.map +1 -0
  46. package/dist/jobs/database/{whatsapp-subscriber-database.service.js → msg91-whatsapp-subscriber-database.service.js} +9 -9
  47. package/dist/jobs/database/msg91-whatsapp-subscriber-database.service.js.map +1 -0
  48. package/dist/jobs/database/three60-whatsapp-publisher-database.service.d.ts +11 -0
  49. package/dist/jobs/database/three60-whatsapp-publisher-database.service.d.ts.map +1 -0
  50. package/dist/jobs/database/three60-whatsapp-publisher-database.service.js +39 -0
  51. package/dist/jobs/database/three60-whatsapp-publisher-database.service.js.map +1 -0
  52. package/dist/jobs/database/three60-whatsapp-queue-options-database.d.ts +8 -0
  53. package/dist/jobs/database/three60-whatsapp-queue-options-database.d.ts.map +1 -0
  54. package/dist/jobs/database/three60-whatsapp-queue-options-database.js +10 -0
  55. package/dist/jobs/database/three60-whatsapp-queue-options-database.js.map +1 -0
  56. package/dist/jobs/database/three60-whatsapp-subscriber-database.service.d.ts +17 -0
  57. package/dist/jobs/database/three60-whatsapp-subscriber-database.service.d.ts.map +1 -0
  58. package/dist/jobs/database/three60-whatsapp-subscriber-database.service.js +48 -0
  59. package/dist/jobs/database/three60-whatsapp-subscriber-database.service.js.map +1 -0
  60. package/dist/jobs/{whatsapp-publisher.service.d.ts → msg91-whatsapp-publisher.service.d.ts} +2 -2
  61. package/dist/jobs/msg91-whatsapp-publisher.service.d.ts.map +1 -0
  62. package/dist/jobs/{whatsapp-publisher.service.js → msg91-whatsapp-publisher.service.js} +8 -8
  63. package/dist/jobs/msg91-whatsapp-publisher.service.js.map +1 -0
  64. package/dist/jobs/{whatsapp-queue-options.d.ts → msg91-whatsapp-queue-options.d.ts} +1 -1
  65. package/dist/jobs/msg91-whatsapp-queue-options.d.ts.map +1 -0
  66. package/dist/jobs/msg91-whatsapp-queue-options.js +10 -0
  67. package/dist/jobs/msg91-whatsapp-queue-options.js.map +1 -0
  68. package/dist/jobs/{whatsapp-subscriber.service.d.ts → msg91-whatsapp-subscriber.service.d.ts} +2 -2
  69. package/dist/jobs/msg91-whatsapp-subscriber.service.d.ts.map +1 -0
  70. package/dist/jobs/{whatsapp-subscriber.service.js → msg91-whatsapp-subscriber.service.js} +9 -9
  71. package/dist/jobs/msg91-whatsapp-subscriber.service.js.map +1 -0
  72. package/dist/jobs/three60-whatsapp-publisher.service.d.ts +11 -0
  73. package/dist/jobs/three60-whatsapp-publisher.service.d.ts.map +1 -0
  74. package/dist/jobs/three60-whatsapp-publisher.service.js +39 -0
  75. package/dist/jobs/three60-whatsapp-publisher.service.js.map +1 -0
  76. package/dist/jobs/three60-whatsapp-queue-options.d.ts +8 -0
  77. package/dist/jobs/three60-whatsapp-queue-options.d.ts.map +1 -0
  78. package/dist/jobs/{whatsapp-queue-options.js → three60-whatsapp-queue-options.js} +3 -3
  79. package/dist/jobs/three60-whatsapp-queue-options.js.map +1 -0
  80. package/dist/jobs/three60-whatsapp-subscriber.service.d.ts +15 -0
  81. package/dist/jobs/three60-whatsapp-subscriber.service.d.ts.map +1 -0
  82. package/dist/jobs/three60-whatsapp-subscriber.service.js +45 -0
  83. package/dist/jobs/three60-whatsapp-subscriber.service.js.map +1 -0
  84. package/dist/mappers/list-of-values-mapper.d.ts +5 -0
  85. package/dist/mappers/list-of-values-mapper.d.ts.map +1 -0
  86. package/dist/mappers/list-of-values-mapper.js +28 -0
  87. package/dist/mappers/list-of-values-mapper.js.map +1 -0
  88. package/dist/seeders/module-metadata-seeder.service.js +1 -1
  89. package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
  90. package/dist/seeders/seed-data/solid-core-metadata.json +27 -137
  91. package/dist/services/chatter-message.service.d.ts.map +1 -1
  92. package/dist/services/chatter-message.service.js +6 -0
  93. package/dist/services/chatter-message.service.js.map +1 -1
  94. package/dist/services/list-of-values-metadata.service.d.ts +34 -0
  95. package/dist/services/list-of-values-metadata.service.d.ts.map +1 -0
  96. package/dist/services/list-of-values-metadata.service.js +213 -0
  97. package/dist/services/list-of-values-metadata.service.js.map +1 -0
  98. package/dist/services/solid-introspect.service.d.ts +1 -0
  99. package/dist/services/solid-introspect.service.d.ts.map +1 -1
  100. package/dist/services/solid-introspect.service.js +14 -0
  101. package/dist/services/solid-introspect.service.js.map +1 -1
  102. package/dist/services/whatsapp/Msg91WhatsappService.d.ts +8 -6
  103. package/dist/services/whatsapp/Msg91WhatsappService.d.ts.map +1 -1
  104. package/dist/services/whatsapp/Msg91WhatsappService.js +24 -7
  105. package/dist/services/whatsapp/Msg91WhatsappService.js.map +1 -1
  106. package/dist/services/whatsapp/Three60WhatsappService.d.ts +18 -0
  107. package/dist/services/whatsapp/Three60WhatsappService.d.ts.map +1 -0
  108. package/dist/services/whatsapp/Three60WhatsappService.js +61 -0
  109. package/dist/services/whatsapp/Three60WhatsappService.js.map +1 -0
  110. package/dist/solid-core.module.d.ts.map +1 -1
  111. package/dist/solid-core.module.js +26 -8
  112. package/dist/solid-core.module.js.map +1 -1
  113. package/dist/subscribers/list-of-values-metadata.subscriber.d.ts +18 -0
  114. package/dist/subscribers/list-of-values-metadata.subscriber.d.ts.map +1 -0
  115. package/dist/subscribers/list-of-values-metadata.subscriber.js +101 -0
  116. package/dist/subscribers/list-of-values-metadata.subscriber.js.map +1 -0
  117. package/dist/tsconfig.tsbuildinfo +1 -1
  118. package/package.json +1 -1
  119. package/src/config/common.config.ts +1 -0
  120. package/src/decorators/whatsapp-provider.decorator.ts +7 -0
  121. package/src/dtos/create-list-of-values.dto.ts +7 -0
  122. package/src/dtos/update-list-of-values.dto.ts +8 -1
  123. package/src/entities/list-of-values.entity.ts +5 -1
  124. package/src/factories/whatsapp.factory.ts +41 -0
  125. package/src/helpers/solid-registry.ts +9 -0
  126. package/src/index.ts +3 -3
  127. package/src/interfaces.ts +12 -2
  128. package/src/jobs/database/{whatsapp-publisher-database.service.ts → msg91-whatsapp-publisher-database.service.ts} +2 -2
  129. package/src/jobs/database/{whatsapp-queue-options-database.ts → msg91-whatsapp-queue-options-database.ts} +1 -1
  130. package/src/jobs/database/{whatsapp-subscriber-database.service.ts → msg91-whatsapp-subscriber-database.service.ts} +3 -4
  131. package/src/jobs/database/three60-whatsapp-publisher-database.service.ts +23 -0
  132. package/src/jobs/database/three60-whatsapp-queue-options-database.ts +9 -0
  133. package/src/jobs/database/three60-whatsapp-subscriber-database.service.ts +32 -0
  134. package/src/jobs/{whatsapp-publisher.service.ts → msg91-whatsapp-publisher.service.ts} +2 -2
  135. package/src/jobs/msg91-whatsapp-queue-options.ts +12 -0
  136. package/src/jobs/{whatsapp-subscriber.service.ts → msg91-whatsapp-subscriber.service.ts} +3 -3
  137. package/src/jobs/three60-whatsapp-publisher.service.ts +23 -0
  138. package/src/jobs/{whatsapp-queue-options.ts → three60-whatsapp-queue-options.ts} +2 -2
  139. package/src/jobs/three60-whatsapp-subscriber.service.ts +30 -0
  140. package/src/mappers/list-of-values-mapper.ts +17 -0
  141. package/src/seeders/module-metadata-seeder.service.ts +1 -1
  142. package/src/seeders/seed-data/solid-core-metadata.json +27 -137
  143. package/src/services/chatter-message.service.ts +6 -0
  144. package/src/services/list-of-values-metadata.service.ts +219 -0
  145. package/src/services/solid-introspect.service.ts +22 -0
  146. package/src/services/whatsapp/Msg91WhatsappService.ts +34 -10
  147. package/src/services/whatsapp/Three60WhatsappService.ts +52 -0
  148. package/src/solid-core.module.ts +26 -8
  149. package/src/subscribers/list-of-values-metadata.subscriber.ts +115 -0
  150. package/dist/jobs/database/whatsapp-publisher-database.service.d.ts.map +0 -1
  151. package/dist/jobs/database/whatsapp-publisher-database.service.js.map +0 -1
  152. package/dist/jobs/database/whatsapp-queue-options-database.d.ts.map +0 -1
  153. package/dist/jobs/database/whatsapp-queue-options-database.js.map +0 -1
  154. package/dist/jobs/database/whatsapp-subscriber-database.service.d.ts.map +0 -1
  155. package/dist/jobs/database/whatsapp-subscriber-database.service.js.map +0 -1
  156. package/dist/jobs/whatsapp-publisher.service.d.ts.map +0 -1
  157. package/dist/jobs/whatsapp-publisher.service.js.map +0 -1
  158. package/dist/jobs/whatsapp-queue-options.d.ts.map +0 -1
  159. package/dist/jobs/whatsapp-queue-options.js.map +0 -1
  160. package/dist/jobs/whatsapp-subscriber.service.d.ts.map +0 -1
  161. package/dist/jobs/whatsapp-subscriber.service.js.map +0 -1
@@ -86,6 +86,9 @@ export class ChatterMessageService extends CRUDService<ChatterMessage>{
86
86
  }
87
87
 
88
88
  async postAuditMessageOnInsert(entity: any, metadata: EntityMetadata, messageQueue: boolean = false) {
89
+ if(!entity){
90
+ return;
91
+ }
89
92
  const model = await this.modelMetadataRepo.findOne({
90
93
  where: {
91
94
  displayName: metadata.name
@@ -140,6 +143,9 @@ export class ChatterMessageService extends CRUDService<ChatterMessage>{
140
143
  }
141
144
 
142
145
  async postAuditMessageOnUpdate(entity: any, metadata: EntityMetadata, databaseEntity: any, messageQueue: boolean = false) {
146
+ if(!databaseEntity || !entity){
147
+ return;
148
+ }
143
149
  const model = await this.modelMetadataRepo.findOne({
144
150
  where: {
145
151
  displayName: metadata.name
@@ -0,0 +1,219 @@
1
+ import { Injectable, Logger } from '@nestjs/common';
2
+ import { DiscoveryService, ModuleRef } from "@nestjs/core";
3
+ import { InjectEntityManager, InjectRepository } from '@nestjs/typeorm';
4
+ import { EntityManager, Repository } from 'typeorm';
5
+
6
+ import { ConfigService } from '@nestjs/config';
7
+ import { CrudHelperService } from 'src/services/crud-helper.service';
8
+ import { CRUDService } from 'src/services/crud.service';
9
+ import { FileService } from 'src/services/file.service';
10
+ import { ModelMetadataService } from 'src/services/model-metadata.service';
11
+ import { ModuleMetadataService } from 'src/services/module-metadata.service';
12
+
13
+
14
+ import * as fs from 'fs/promises'; // Use the Promise-based version of fs for async/await
15
+ import { ModuleMetadataHelperService } from 'src/helpers/module-metadata-helper.service';
16
+
17
+ import { ListOfValues } from 'src/entities/list-of-values.entity';
18
+ import { ListOfValuesMapper } from 'src/mappers/list-of-values-mapper';
19
+
20
+
21
+
22
+ @Injectable()
23
+ export class ListOfValuesMetadataService extends CRUDService<ListOfValues> {
24
+ private readonly logger = new Logger(this.constructor.name);
25
+ constructor(
26
+ readonly modelMetadataService: ModelMetadataService,
27
+ readonly moduleMetadataService: ModuleMetadataService,
28
+ readonly configService: ConfigService,
29
+ readonly fileService: FileService,
30
+ readonly discoveryService: DiscoveryService,
31
+ readonly crudHelperService: CrudHelperService,
32
+ readonly listOfValuesMapper: ListOfValuesMapper,
33
+ @InjectEntityManager()
34
+ readonly entityManager: EntityManager,
35
+ @InjectRepository(ListOfValues, 'default')
36
+ readonly repo: Repository<ListOfValues>,
37
+ readonly moduleRef: ModuleRef,
38
+ readonly moduleMetadataHelperService: ModuleMetadataHelperService,
39
+
40
+ ) {
41
+ super(modelMetadataService, moduleMetadataService, configService, fileService, discoveryService, crudHelperService, entityManager, repo, 'listOfValues', 'solid-core', moduleRef);
42
+ }
43
+
44
+ async saveListofValuesToConfig(entity: ListOfValues) {
45
+ if (!entity) {
46
+ this.logger.debug('No entity found in the ListofValuesSubscriber saveListofvalueToConfig method');
47
+ return;
48
+ }
49
+
50
+ // Validate list of value details
51
+ const listofvalue = entity as ListOfValues;
52
+ const moduleMetadata = entity.module;
53
+ if (!moduleMetadata) {
54
+ throw new Error(`Module metadata not found for listofvalue id ${entity.id}`);
55
+ }
56
+
57
+ // Get config file details
58
+ const { filePath, metaData } = await this.getConfigFileDetails(moduleMetadata.name); // sting expected module name
59
+ if (!filePath || !metaData) {
60
+ throw new Error(`Configuration details not found for module: ${moduleMetadata.name}`);
61
+ }
62
+
63
+ // Write the listofvalue to the config file
64
+ await this.writeToConfig(metaData, listofvalue, filePath);
65
+ }
66
+
67
+ async updateListofValuesToConfig(oldentity: ListOfValues, entity: ListOfValues) {
68
+ if (!entity) {
69
+ this.logger.debug('No entity found in the ListofValuesSubscriber saveListofvalueToConfig method');
70
+ return;
71
+ }
72
+
73
+ // Validate list of value details
74
+ const oldlistofvalue = oldentity as ListOfValues;
75
+ const listofvalue = entity as ListOfValues;
76
+ const moduleMetadata = entity.module;
77
+ if (!moduleMetadata) {
78
+ throw new Error(`Module metadata not found for listofvalue id ${entity.id}`);
79
+ }
80
+
81
+ // Get config file details
82
+ const { filePath, metaData } = await this.getConfigFileDetails(moduleMetadata.name); // sting expected module name
83
+ if (!filePath || !metaData) {
84
+ throw new Error(`Configuration details not found for module: ${moduleMetadata.name}`);
85
+ }
86
+
87
+ // Write the listofvalue to the config file
88
+ await this.updateToConfig(metaData, oldlistofvalue, listofvalue, filePath);
89
+ }
90
+
91
+ async deleteListOfValuesFromConfig(entity: ListOfValues) {
92
+ if (!entity) {
93
+ this.logger.debug('No entity found in the ListofValuesSubscriber saveListofvalueToConfig method');
94
+ return;
95
+ }
96
+
97
+ // Validate list of value details
98
+ const listofvalue = entity as ListOfValues;
99
+ const moduleMetadata = entity.module;
100
+ if (!moduleMetadata) {
101
+ throw new Error(`Module metadata not found for listofvalue id ${entity.id}`);
102
+ }
103
+
104
+ // Get config file details
105
+ const { filePath, metaData } = await this.getConfigFileDetails(moduleMetadata.name); // sting expected module name
106
+ if (!filePath || !metaData) {
107
+ throw new Error(`Configuration details not found for module: ${moduleMetadata.name}`);
108
+ }
109
+
110
+ // delete the listofvalue to the config file
111
+ await this.deleteFromConfig(metaData, listofvalue, filePath);
112
+ }
113
+
114
+
115
+
116
+ private async getConfigFileDetails(moduleName: string): Promise<{ filePath: string; metaData: any }> {
117
+ const filePath = await this.moduleMetadataHelperService.getModuleMetadataFilePath(moduleName);
118
+ try {
119
+ await fs.access(filePath);
120
+ } catch (error) {
121
+ throw new Error(`Configuration file not found for module: ${moduleName}`);
122
+ }
123
+ const metaData = await this.moduleMetadataHelperService.getModuleMetadataConfiguration(filePath);
124
+ return { filePath, metaData };
125
+ }
126
+
127
+ private async writeToConfig(metaData: any, listofvalues: ListOfValues, filePath: string) {
128
+ const dto = await this.listOfValuesMapper.toDto(listofvalues);
129
+
130
+ if (!Array.isArray(metaData.listOfValues)) {
131
+ metaData.listOfValues = [];
132
+ }
133
+
134
+ // Match by type + value + module
135
+ const existingIndex = metaData.listOfValues.findIndex(
136
+ (item: { type: string; value: string; module: number }) =>
137
+ item.type === dto.type &&
138
+ item.value === dto.value &&
139
+ item.module === dto.module
140
+ );
141
+
142
+ if (existingIndex !== -1) {
143
+ // Replace existing entry
144
+ metaData.listOfValues[existingIndex] = dto;
145
+ } else {
146
+ // Insert new entry
147
+ // metaData.listOfValues.unshift(dto);
148
+
149
+ if (metaData.listOfValues.length === 0) {
150
+ // Case 1: Empty array → add first item
151
+ metaData.listOfValues.push(dto);
152
+ } else {
153
+ // Case 2: Insert new item right after index 0
154
+ metaData.listOfValues.unshift(dto);
155
+ }
156
+
157
+ }
158
+
159
+ const updatedContent = JSON.stringify(metaData, null, 2);
160
+ await fs.writeFile(filePath, updatedContent);
161
+ }
162
+
163
+ private async updateToConfig(metaData: any, oldlistofvalues: ListOfValues, listofvalues: ListOfValues, filePath: string) {
164
+ const newvalue = await this.listOfValuesMapper.toDto(listofvalues);
165
+ const oldvalue = await this.listOfValuesMapper.toDto(oldlistofvalues);
166
+
167
+ if (!Array.isArray(metaData.listOfValues)) {
168
+ metaData.listOfValues = [];
169
+ }
170
+
171
+ const searchType = oldvalue.type || newvalue.type;
172
+ const searchValue = oldvalue.value || newvalue.value;
173
+ const searchModule = oldvalue.module || newvalue.module;
174
+
175
+ const existingIndex = metaData.listOfValues.findIndex(
176
+ (item: { type: string; value: string; module: number }) =>
177
+ item.type === searchType && item.value === searchValue && item.module === searchModule
178
+ );
179
+ if (existingIndex !== -1) {
180
+ // Replace existing match
181
+ metaData.listOfValues[existingIndex] = newvalue;
182
+ }
183
+
184
+ const updatedContent = JSON.stringify(metaData, null, 2);
185
+ await fs.writeFile(filePath, updatedContent);
186
+ }
187
+
188
+
189
+ private async deleteFromConfig(metaData: any, listofvalues: ListOfValues, filePath: string) {
190
+ const dto = await this.listOfValuesMapper.toDto(listofvalues);
191
+
192
+ if (!Array.isArray(metaData.listOfValues)) {
193
+ metaData.listOfValues = [];
194
+ }
195
+
196
+ // Match by type + value + module
197
+ const existingIndex = metaData.listOfValues.findIndex(
198
+ (item: { type: string; value: string; module: number }) =>
199
+ item.type === dto.type &&
200
+ item.value === dto.value &&
201
+ item.module === dto.module
202
+ );
203
+
204
+ if (existingIndex !== -1) {
205
+ // Remove the item
206
+ metaData.listOfValues.splice(existingIndex, 1);
207
+ this.logger.debug(`Deleted LOV ${dto.type}:${dto.value} (module ${dto.module}) from config`);
208
+ } else {
209
+ this.logger.warn(
210
+ `LOV ${dto.type}:${dto.value} (module ${dto.module}) not found in config during delete`
211
+ );
212
+ }
213
+ const updatedContent = JSON.stringify(metaData, null, 2);
214
+ await fs.writeFile(filePath, updatedContent);
215
+
216
+ }
217
+
218
+
219
+ }
@@ -11,6 +11,7 @@ import { IS_SCHEDULED_JOB_PROVIDER } from 'src/decorators/scheduled-job-provider
11
11
  import { IS_DASHBOARD_VARIABLE_SELECTION_PROVIDER } from 'src/decorators/dashboard-selection-provider.decorator';
12
12
  import { IS_DASHBOARD_QUESTION_DATA_PROVIDER } from 'src/decorators/dashboard-question-data-provider.decorator';
13
13
  import { IS_MAIL_PROVIDER } from 'src/decorators/mail-provider.decorator';
14
+ import { IS_WA_PROVIDER } from 'src/decorators/whatsapp-provider.decorator';
14
15
 
15
16
  @Injectable()
16
17
  export class SolidIntrospectService implements OnApplicationBootstrap {
@@ -118,6 +119,15 @@ export class SolidIntrospectService implements OnApplicationBootstrap {
118
119
  mailProviders.forEach((mailProvider) => {
119
120
  this.solidRegistry.registerMailProvider(mailProvider);
120
121
  });
122
+
123
+ // Register all IMail implementations
124
+ const whatsappProviders = this.discoveryService
125
+ .getProviders()
126
+ .filter((provider) => this.isWhatsappProvider(provider));
127
+
128
+ whatsappProviders.forEach((whatsappProvider) => {
129
+ this.solidRegistry.registerWhatsappProvider(whatsappProvider);
130
+ });
121
131
  }
122
132
 
123
133
  isDashboardQuestionDataProvider(providerWrapper: InstanceWrapper<any>) {
@@ -212,6 +222,18 @@ export class SolidIntrospectService implements OnApplicationBootstrap {
212
222
  return !!isMailProvider;
213
223
  }
214
224
 
225
+ private isWhatsappProvider(provider: InstanceWrapper) {
226
+ const { instance } = provider;
227
+ if (!instance) return false;
228
+
229
+ const isWhatsappProvider = this.reflector.get<boolean>(
230
+ IS_WA_PROVIDER,
231
+ instance.constructor,
232
+ );
233
+
234
+ return !!isWhatsappProvider;
235
+ }
236
+
215
237
  private isModule(provider: InstanceWrapper): boolean {
216
238
  const metatype = provider.metatype;
217
239
  // Check if it's a Static Module (Class-Based)
@@ -3,10 +3,9 @@ import { Inject, Injectable, Logger } from '@nestjs/common';
3
3
  import { ConfigType } from '@nestjs/config';
4
4
  import commonConfig from 'src/config/common.config';
5
5
  import { QueueMessage } from 'src/interfaces/mq';
6
- import { SmsTemplateService } from '../sms-template.service';
7
- import { Msg91BaseSMSService } from '../sms/Msg91BaseSMSService';
8
- import { ISMS } from "../../interfaces";
6
+ import { IWhatsAppTransport } from "../../interfaces";
9
7
  import { PublisherFactory } from '../queues/publisher-factory.service';
8
+ import { WhatsAppProvider } from 'src/decorators/whatsapp-provider.decorator';
10
9
 
11
10
  enum Msg91WhatsappParameterHeaderType {
12
11
  image,
@@ -51,21 +50,46 @@ interface WhatsappToAndComponents {
51
50
  }
52
51
 
53
52
  @Injectable()
54
- export class Msg91WhatsappService extends Msg91BaseSMSService implements ISMS {
53
+ @WhatsAppProvider()
54
+ export class Msg91WhatsappService implements IWhatsAppTransport {
55
55
  readonly logger = new Logger(Msg91WhatsappService.name);
56
56
 
57
57
  constructor(
58
58
  @Inject(commonConfig.KEY)
59
- commonConfiguration: ConfigType<typeof commonConfig>,
59
+ private readonly commonConfiguration: ConfigType<typeof commonConfig>,
60
60
  // whatsappPublisher: WhatsappQueuePublisher,
61
- publisherFactory: PublisherFactory<any>,
62
- smsTemplateService: SmsTemplateService,
61
+ private readonly publisherFactory: PublisherFactory<any>,
63
62
  private readonly httpService: HttpService,
64
- ) {
65
- super(commonConfiguration, 'WhatsappQueuePublisher', publisherFactory, smsTemplateService);
63
+ ) {}
64
+
65
+ async sendWhatsAppMessage(
66
+ to: string,
67
+ templateId: string,
68
+ parameters: any,
69
+ parentEntity?: any,
70
+ parentEntityId?: any
71
+ ): Promise<any> {
72
+ const message = {
73
+ payload: {
74
+ to,
75
+ templateId,
76
+ ...parameters,
77
+ },
78
+ parentEntity,
79
+ parentEntityId,
80
+ };
81
+
82
+ // All messages are always queued as per requirement
83
+ return this.sendWhatsAppMessageAsynchronously(message);
84
+ }
85
+
86
+ private async sendWhatsAppMessageAsynchronously(message: any): Promise<any> {
87
+ const { to, templateId } = message.payload;
88
+ this.logger.debug(`Queueing WhatsApp message to ${to} with template ${templateId}`);
89
+ return this.publisherFactory.publish(message, 'Msg91WhatsappQueuePublisher');
66
90
  }
67
91
 
68
- async sendSMSSynchronously(message: QueueMessage<any>): Promise<void> {
92
+ async sendWhatsAppMessageSynchronously(message: QueueMessage<any>): Promise<void> {
69
93
  const body = this.createWhatsappRequest(message);
70
94
  const headers = { authkey: this.commonConfiguration.msg91Whatsapp.apiKey };
71
95
  await this.httpService.axiosRef.post(
@@ -0,0 +1,52 @@
1
+ import { HttpService } from '@nestjs/axios';
2
+ import { Inject, Injectable, Logger } from '@nestjs/common';
3
+ import { ConfigType } from '@nestjs/config';
4
+ import commonConfig from 'src/config/common.config';
5
+ import { QueueMessage } from 'src/interfaces/mq';
6
+ import { IWhatsAppTransport } from "../../interfaces";
7
+ import { PublisherFactory } from '../queues/publisher-factory.service';
8
+ import { WhatsAppProvider } from 'src/decorators/whatsapp-provider.decorator';
9
+
10
+ @Injectable()
11
+ @WhatsAppProvider()
12
+ export class Three60WhatsappService implements IWhatsAppTransport {
13
+ readonly logger = new Logger(Three60WhatsappService.name);
14
+
15
+ constructor(
16
+ @Inject(commonConfig.KEY)
17
+ private readonly commonConfiguration: ConfigType<typeof commonConfig>,
18
+ private readonly publisherFactory: PublisherFactory<any>,
19
+ private readonly httpService: HttpService,
20
+ ) { }
21
+
22
+ async sendWhatsAppMessage(
23
+ to: string,
24
+ templateId: string,
25
+ parameters: any,
26
+ parentEntity?: any,
27
+ parentEntityId?: any
28
+ ): Promise<any> {
29
+ const message = {
30
+ payload: {
31
+ to,
32
+ templateId,
33
+ ...parameters,
34
+ },
35
+ parentEntity,
36
+ parentEntityId,
37
+ };
38
+
39
+ // All messages are always queued as per requirement
40
+ return this.sendWhatsAppMessageAsynchronously(message);
41
+ }
42
+
43
+ private async sendWhatsAppMessageAsynchronously(message: any): Promise<any> {
44
+ const { to, templateId } = message.payload;
45
+ this.logger.debug(`Queueing WhatsApp message to ${to} with template ${templateId}`);
46
+ return this.publisherFactory.publish(message, 'Three60WhatsappQueuePublisher');
47
+ }
48
+
49
+ async sendWhatsAppMessageSynchronously(message: QueueMessage<any>): Promise<void> {
50
+ throw new Error(`Currently not implemented.`);
51
+ }
52
+ }
@@ -94,8 +94,8 @@ import { SmsQueuePublisher } from './jobs/sms-publisher.service';
94
94
  import { SmsQueueSubscriber } from './jobs/sms-subscriber.service';
95
95
  import { TestQueuePublisher } from './jobs/test-queue-publisher.service';
96
96
  import { TestQueueSubscriber } from './jobs/test-queue-subscriber.service';
97
- import { WhatsappQueuePublisher } from './jobs/whatsapp-publisher.service';
98
- import { WhatsappQueueSubscriber } from './jobs/whatsapp-subscriber.service';
97
+ import { Msg91WhatsappQueuePublisher } from './jobs/msg91-whatsapp-publisher.service';
98
+ import { Msg91WhatsappQueueSubscriber } from './jobs/msg91-whatsapp-subscriber.service';
99
99
  import { UserRegistrationListener } from './listeners/user-registration.listener';
100
100
  import { GoogleOauthStrategy } from './passport-strategies/google-oauth.strategy';
101
101
  import { LocalStrategy } from './passport-strategies/local.strategy';
@@ -193,8 +193,8 @@ import { TwilioSmsQueueSubscriberDatabase } from './jobs/database/twilio-sms-sub
193
193
 
194
194
  import { TriggerMcpClientPublisherDatabase } from './jobs/database/trigger-mcp-client-publisher-database.service';
195
195
  import { TriggerMcpClientSubscriberDatabase } from './jobs/database/trigger-mcp-client-subscriber-database.service';
196
- import { WhatsappQueuePublisherDatabase } from './jobs/database/whatsapp-publisher-database.service';
197
- import { WhatsappQueueSubscriberDatabase } from './jobs/database/whatsapp-subscriber-database.service';
196
+ import { Msg91WhatsappQueuePublisherDatabase } from './jobs/database/msg91-whatsapp-publisher-database.service';
197
+ import { Msg91WhatsappQueueSubscriberDatabase } from './jobs/database/msg91-whatsapp-subscriber-database.service';
198
198
  import { DashboardMapper } from './mappers/dashboard-mapper';
199
199
  import { DashboardRepository } from './repository/dashboard.repository';
200
200
  import { FieldMetadataRepository } from './repository/field-metadata.repository';
@@ -266,6 +266,9 @@ import { NoopsEntityComputedFieldProviderService } from './services/computed-fie
266
266
  import { ScheduledJobRepository } from './repository/scheduled-job.repository';
267
267
  import { ScheduledJobSubscriber } from './subscribers/scheduled-job.subscriber';
268
268
  import { AlphaNumExternalIdComputationProvider } from './services/computed-fields/entity/alpha-num-external-id-computed-field-provider';
269
+ import { ListOfValuesMapper } from './mappers/list-of-values-mapper';
270
+ import { ListOfValuesMetadataSubscriber } from './subscribers/list-of-values-metadata.subscriber';
271
+ import { ListOfValuesMetadataService } from './services/list-of-values-metadata.service';
269
272
  import { MailFactory } from './factories/mail.factory';
270
273
  import { TwilioSMSService } from './services/sms/TwilioSMSService';
271
274
  import { PollerService } from './services/poller.service';
@@ -273,6 +276,11 @@ import { TextractService } from './services/textract.service';
273
276
  import { seconds, ThrottlerModule } from '@nestjs/throttler';
274
277
  import { ChatterMessageRepository } from './repository/chatter-message.repository';
275
278
  import { ChatterMessageDetailsRepository } from './repository/chatter-message-details.repository';
279
+ import { Three60WhatsappQueuePublisher } from './jobs/three60-whatsapp-publisher.service';
280
+ import { Three60WhatsappQueueSubscriber } from './jobs/three60-whatsapp-subscriber.service';
281
+ import { Three60WhatsappQueuePublisherDatabase } from './jobs/database/three60-whatsapp-publisher-database.service';
282
+ import { Three60WhatsappQueueSubscriberDatabase } from './jobs/database/three60-whatsapp-subscriber-database.service';
283
+ import { Three60WhatsappService } from './services/whatsapp/Three60WhatsappService';
276
284
 
277
285
 
278
286
  @Global()
@@ -489,10 +497,17 @@ import { ChatterMessageDetailsRepository } from './repository/chatter-message-de
489
497
  OTPQueueSubscriber,
490
498
  OTPQueuePublisherDatabase,
491
499
  OTPQueueSubscriberDatabase,
492
- WhatsappQueuePublisher,
493
- WhatsappQueueSubscriber,
494
- WhatsappQueuePublisherDatabase,
495
- WhatsappQueueSubscriberDatabase,
500
+ Msg91WhatsappQueuePublisher,
501
+ Msg91WhatsappQueueSubscriber,
502
+ Msg91WhatsappQueuePublisherDatabase,
503
+ Msg91WhatsappQueueSubscriberDatabase,
504
+ Three60WhatsappQueuePublisher,
505
+ Three60WhatsappQueueSubscriber,
506
+ Three60WhatsappQueuePublisherDatabase,
507
+ Three60WhatsappQueueSubscriberDatabase,
508
+ Three60WhatsappService,
509
+ MqMessageService,
510
+ MqMessageQueueService,
496
511
  EmailTemplateSeederService,
497
512
  SmsTemplateSeederService,
498
513
  TinyUrlService,
@@ -587,6 +602,9 @@ import { ChatterMessageDetailsRepository } from './repository/chatter-message-de
587
602
  ScheduledJobRepository,
588
603
  ScheduledJobSubscriber,
589
604
  AlphaNumExternalIdComputationProvider,
605
+ ListOfValuesMetadataService,
606
+ ListOfValuesMetadataSubscriber,
607
+ ListOfValuesMapper,
590
608
  MailFactory,
591
609
  ChatterMessageRepository,
592
610
  ChatterMessageDetailsRepository,
@@ -0,0 +1,115 @@
1
+ import { Injectable, Logger } from '@nestjs/common';
2
+ import { InjectDataSource } from "@nestjs/typeorm";
3
+ import { ListOfValues } from 'src/entities/list-of-values.entity';
4
+ import { ModuleMetadataHelperService } from "src/helpers/module-metadata-helper.service";
5
+ import { ListOfValuesMetadataService } from 'src/services/list-of-values-metadata.service';
6
+ import { DataSource, EntityManager, EntitySubscriberInterface, InsertEvent, RemoveEvent, UpdateEvent } from "typeorm";
7
+
8
+ @Injectable()
9
+ export class ListOfValuesMetadataSubscriber implements EntitySubscriberInterface<ListOfValues> {
10
+ private readonly logger = new Logger(this.constructor.name);
11
+ constructor(
12
+ @InjectDataSource()
13
+ private readonly dataSource: DataSource,
14
+ readonly moduleMetadataHelperService: ModuleMetadataHelperService,
15
+ readonly listOfValuesMetadataService: ListOfValuesMetadataService,
16
+ ) {
17
+ this.dataSource.subscribers.push(this);
18
+ }
19
+
20
+ listenTo() {
21
+ return ListOfValues;
22
+ }
23
+
24
+ async afterInsert(event: InsertEvent<ListOfValues>) {
25
+ if (!event.entity) {
26
+ this.logger.debug('No listofvalue entity found in the ListofValueSubscriber afterInsert method');
27
+ return;
28
+ }
29
+ await this.saveListOfValuesToConfig(event.entity, event.queryRunner.manager);
30
+ }
31
+
32
+ async afterUpdate(event: UpdateEvent<ListOfValues>) {
33
+ if (!event.entity) {
34
+ this.logger.debug('No listofvalue entity found in the ListofValueSubscriber afterInsert method');
35
+ return;
36
+ }
37
+
38
+ //@ts-ignore
39
+ await this.updateListOfValuesToConfig(event.databaseEntity, event.entity, event.queryRunner.manager);
40
+ }
41
+
42
+ // async beforeRemove(event: RemoveEvent<ListOfValues>) {
43
+ // if (!event.entity) {
44
+ // this.logger.debug('No listofvalue entity found in the ListofValueSubscriber beforeRemove method');
45
+ // return;
46
+ // }
47
+
48
+ // await this.deleteListOfValuesFromConfig(event.entity, event.queryRunner.manager);
49
+ // }
50
+
51
+
52
+ private async saveListOfValuesToConfig(listOfValues: ListOfValues, entityManager: EntityManager): Promise<void> {
53
+ if (!listOfValues || !listOfValues.id) {
54
+ this.logger.debug('on save Listofvalue id is undefined');
55
+ return;
56
+ }
57
+
58
+ // Load the Listofvalue with module relation populated
59
+ const populatedLov = await entityManager.findOne(ListOfValues, {
60
+ where: { id: listOfValues.id },
61
+ relations: ['module'],
62
+ });
63
+
64
+ if (!populatedLov) {
65
+ this.logger.error(`Listofvalue not found for id ${listOfValues.id}`);
66
+ return;
67
+ }
68
+
69
+ // Call the saveListofValuesToConfig method from the ListOfValuesMetadataService
70
+ await this.listOfValuesMetadataService.saveListofValuesToConfig(populatedLov);
71
+ }
72
+
73
+ private async updateListOfValuesToConfig(oldlistOfValues: ListOfValues, listOfValues: ListOfValues, entityManager: EntityManager): Promise<void> {
74
+ if (!listOfValues || !listOfValues.id) {
75
+ this.logger.debug('on update Listofvalue id is undefined');
76
+ return;
77
+ }
78
+
79
+ // Load the Listofvalue with module relation populated
80
+ const populatedLov = await entityManager.findOne(ListOfValues, {
81
+ where: { id: listOfValues.id },
82
+ relations: ['module'],
83
+ });
84
+
85
+ if (!populatedLov) {
86
+ this.logger.error(`Listofvalue not found for id ${listOfValues.id}`);
87
+ return;
88
+ }
89
+
90
+ // Call the updateListofValuesToConfig method from the ListOfValuesMetadataService
91
+ await this.listOfValuesMetadataService.updateListofValuesToConfig(oldlistOfValues, populatedLov);
92
+ }
93
+
94
+ private async deleteListOfValuesFromConfig(listOfValues: ListOfValues, entityManager: EntityManager): Promise<void> {
95
+ if (!listOfValues || !listOfValues.id) {
96
+ this.logger.debug('on delete Listofvalue id is undefined');
97
+ return;
98
+ }
99
+
100
+ // Load the Listofvalue with module relation populated
101
+ const populatedLov = await entityManager.findOne(ListOfValues, {
102
+ where: { id: listOfValues.id },
103
+ relations: ['module'],
104
+ });
105
+
106
+ if (!populatedLov) {
107
+ this.logger.error(`Listofvalue not found for id ${listOfValues.id}`);
108
+ return;
109
+ }
110
+
111
+ // Call the deleteListOfValuesFromConfig method from the ListOfValuesMetadataService
112
+ await this.listOfValuesMetadataService.deleteListOfValuesFromConfig(populatedLov);
113
+ }
114
+
115
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-publisher-database.service.d.ts","sourceRoot":"","sources":["../../../src/jobs/database/whatsapp-publisher-database.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF,qBACa,8BAA+B,SAAQ,iBAAiB,CAAC,GAAG,CAAC;IAElE,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB;IACrD,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB;gBAD5C,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,qBAAqB;IAKnE,OAAO,IAAI,mBAAmB;CAKjC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-publisher-database.service.js","sourceRoot":"","sources":["../../../src/jobs/database/whatsapp-publisher-database.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAE5C,wGAAqE;AACrE,0EAAmE;AACnE,sFAA8E;AAE9E,iGAAmF;AAG5E,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,8CAAsB;IACtE,YACuB,gBAAkC,EAClC,qBAA4C;QAE/D,KAAK,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;QAH5B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,0BAAqB,GAArB,qBAAqB,CAAuB;IAGnE,CAAC;IAED,OAAO;QACH,OAAO;YACH,GAAG,yCAAoB;SAC1B,CAAA;IACL,CAAC;CACJ,CAAA;AAbY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;qCAGgC,qCAAgB;QACX,gDAAqB;GAH1D,8BAA8B,CAa1C","sourcesContent":["import { Injectable } from '@nestjs/common';\n\nimport whatsappQueueOptions from './whatsapp-queue-options-database';\nimport { MqMessageService } from 'src/services/mq-message.service';\nimport { MqMessageQueueService } from 'src/services/mq-message-queue.service';\nimport { QueuesModuleOptions } from 'src/interfaces';\nimport { DatabasePublisher } from 'src/services/queues/database-publisher.service';\n\n@Injectable()\nexport class WhatsappQueuePublisherDatabase extends DatabasePublisher<any> {\n constructor(\n protected readonly mqMessageService: MqMessageService,\n protected readonly mqMessageQueueService: MqMessageQueueService,\n ) {\n super(mqMessageService, mqMessageQueueService);\n }\n\n options(): QueuesModuleOptions {\n return {\n ...whatsappQueueOptions\n }\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-queue-options-database.d.ts","sourceRoot":"","sources":["../../../src/jobs/database/whatsapp-queue-options-database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;;;;;;AAI5C,wBAIE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-queue-options-database.js","sourceRoot":"","sources":["../../../src/jobs/database/whatsapp-queue-options-database.ts"],"names":[],"mappings":";;AAAA,iDAA4C;AAE5C,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AAEtD,kBAAe;IACX,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,uBAAU,CAAC,QAAQ;IACzB,SAAS,EAAE,mBAAmB;CACjC,CAAC","sourcesContent":["import { BrokerType } from \"src/interfaces\";\n\nconst WHATSAPP_QUEUE_NAME = 'whatsapp_queue_database';\n\nexport default {\n name: 'whatsappInstance',\n type: BrokerType.Database,\n queueName: WHATSAPP_QUEUE_NAME,\n};"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-subscriber-database.service.d.ts","sourceRoot":"","sources":["../../../src/jobs/database/whatsapp-subscriber-database.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,qBACa,+BAAgC,SAAQ,kBAAkB,CAAC,GAAG,CAAC;IAEpE,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB;IAC3C,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB;IACrD,QAAQ,CAAC,MAAM,EAAE,aAAa;gBAHb,eAAe,EAAE,oBAAoB,EAC7C,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,qBAAqB,EAC5C,MAAM,EAAE,aAAa;IAKlC,OAAO,IAAI,mBAAmB;IAM9B,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC;CAGvC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-subscriber-database.service.js","sourceRoot":"","sources":["../../../src/jobs/database/whatsapp-subscriber-database.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAI5C,wGAAqE;AACrE,0EAAmE;AACnE,sFAA8E;AAC9E,uFAAkF;AAElF,mGAAqF;AACrF,kEAA4D;AAGrD,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,gDAAuB;IACxE,YACqB,eAAqC,EAC7C,gBAAkC,EAClC,qBAA4C,EAC5C,MAAqB;QAE9B,KAAK,CAAC,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,CAAC,CAAC;QALtC,oBAAe,GAAf,eAAe,CAAsB;QAC7C,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,WAAM,GAAN,MAAM,CAAe;IAGlC,CAAC;IAED,OAAO;QACH,OAAO;YACH,GAAG,yCAAoB;SAC1B,CAAA;IACL,CAAC;IAED,SAAS,CAAC,OAA0B;QAChC,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;CACJ,CAAA;AAnBY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,mBAAU,GAAE;qCAG6B,2CAAoB;QAC3B,qCAAgB;QACX,gDAAqB;QACpC,8BAAa;GALzB,+BAA+B,CAmB3C","sourcesContent":["import { Injectable } from '@nestjs/common';\n\nimport { RabbitMqSubscriber } from 'src/services/queues/rabbitmq-subscriber.service';\nimport { QueueMessage } from 'src/interfaces/mq';\nimport whatsappQueueOptions from './whatsapp-queue-options-database';\nimport { MqMessageService } from 'src/services/mq-message.service';\nimport { MqMessageQueueService } from 'src/services/mq-message-queue.service';\nimport { Msg91WhatsappService } from 'src/services/whatsapp/Msg91WhatsappService';\nimport { QueuesModuleOptions } from 'src/interfaces';\nimport { DatabaseSubscriber } from 'src/services/queues/database-subscriber.service';\nimport { PollerService } from 'src/services/poller.service';\n\n@Injectable()\nexport class WhatsappQueueSubscriberDatabase extends DatabaseSubscriber<any> {\n constructor(\n private readonly whatsappService: Msg91WhatsappService,\n readonly mqMessageService: MqMessageService,\n readonly mqMessageQueueService: MqMessageQueueService,\n readonly poller: PollerService,\n ) {\n super(mqMessageService, mqMessageQueueService, poller);\n }\n\n options(): QueuesModuleOptions {\n return {\n ...whatsappQueueOptions\n }\n }\n\n subscribe(message: QueueMessage<any>) {\n this.whatsappService.sendSMSSynchronously(message);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-publisher.service.d.ts","sourceRoot":"","sources":["../../src/jobs/whatsapp-publisher.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,qBACa,sBAAuB,SAAQ,iBAAiB,CAAC,GAAG,CAAC;IAE1D,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB;IACrD,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB;gBAD5C,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,qBAAqB;IAKnE,OAAO,IAAI,mBAAmB;CAKjC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-publisher.service.js","sourceRoot":"","sources":["../../src/jobs/whatsapp-publisher.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAE5C,8FAAmF;AACnF,sFAA4D;AAC5D,uEAAmE;AACnE,mFAA8E;AAIvE,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,8CAAsB;IAC9D,YACuB,gBAAkC,EAClC,qBAA4C;QAE/D,KAAK,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;QAH5B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,0BAAqB,GAArB,qBAAqB,CAAuB;IAGnE,CAAC;IAED,OAAO;QACH,OAAO;YACH,GAAG,gCAAoB;SAC1B,CAAA;IACL,CAAC;CACJ,CAAA;AAbY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;qCAGgC,qCAAgB;QACX,gDAAqB;GAH1D,sBAAsB,CAalC","sourcesContent":["import { Injectable } from '@nestjs/common';\n\nimport { RabbitMqPublisher } from 'src/services/queues/rabbitmq-publisher.service';\nimport whatsappQueueOptions from './whatsapp-queue-options';\nimport { MqMessageService } from 'src/services/mq-message.service';\nimport { MqMessageQueueService } from 'src/services/mq-message-queue.service';\nimport { QueuesModuleOptions } from \"../interfaces\";\n\n@Injectable()\nexport class WhatsappQueuePublisher extends RabbitMqPublisher<any> {\n constructor(\n protected readonly mqMessageService: MqMessageService,\n protected readonly mqMessageQueueService: MqMessageQueueService,\n ) {\n super(mqMessageService, mqMessageQueueService);\n }\n\n options(): QueuesModuleOptions {\n return {\n ...whatsappQueueOptions\n }\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-queue-options.d.ts","sourceRoot":"","sources":["../../src/jobs/whatsapp-queue-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;;;;;AAG3C,wBAQE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-queue-options.js","sourceRoot":"","sources":["../../src/jobs/whatsapp-queue-options.ts"],"names":[],"mappings":";;AAAA,8CAA2C;AAE3C,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAC7C,kBAAe;IACX,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,uBAAU,CAAC,QAAQ;IACzB,SAAS,EAAE,mBAAmB;CAKjC,CAAC","sourcesContent":["import { BrokerType } from \"../interfaces\";\n\nconst WHATSAPP_QUEUE_NAME = 'whatsapp_queue';\nexport default {\n name: 'whatsappInstance',\n type: BrokerType.RabbitMQ,\n queueName: WHATSAPP_QUEUE_NAME,\n // receive: async (message: QueueMessage<any>) => { // Default receive handler\n // console.log(`Received message: ${JSON.stringify(message)} from queue ${SMS_QUEUE_NAME}`);\n // return 'Received';\n // },\n};"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-subscriber.service.d.ts","sourceRoot":"","sources":["../../src/jobs/whatsapp-subscriber.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,qBACa,uBAAwB,SAAQ,kBAAkB,CAAC,GAAG,CAAC;IAE5D,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB;IAC3C,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB;gBAFpC,eAAe,EAAE,oBAAoB,EAC7C,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,qBAAqB;IAKzD,OAAO,IAAI,mBAAmB;IAM9B,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC;CAGvC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-subscriber.service.js","sourceRoot":"","sources":["../../src/jobs/whatsapp-subscriber.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAE5C,gGAAqF;AAErF,sFAA4D;AAC5D,oFAAiF;AACjF,uEAAmE;AACnE,mFAA8E;AAIvE,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,gDAAuB;IAChE,YACqB,eAAqC,EAC7C,gBAAkC,EAClC,qBAA4C;QAErD,KAAK,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;QAJ9B,oBAAe,GAAf,eAAe,CAAsB;QAC7C,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,0BAAqB,GAArB,qBAAqB,CAAuB;IAGzD,CAAC;IAED,OAAO;QACH,OAAO;YACH,GAAG,gCAAoB;SAC1B,CAAA;IACL,CAAC;IAED,SAAS,CAAC,OAA0B;QAChC,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;CACJ,CAAA;AAlBY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;qCAG6B,2CAAoB;QAC3B,qCAAgB;QACX,gDAAqB;GAJhD,uBAAuB,CAkBnC","sourcesContent":["import { Injectable } from '@nestjs/common';\n\nimport { RabbitMqSubscriber } from 'src/services/queues/rabbitmq-subscriber.service';\nimport { QueueMessage } from 'src/interfaces/mq';\nimport whatsappQueueOptions from './whatsapp-queue-options';\nimport { Msg91WhatsappService } from '../services/whatsapp/Msg91WhatsappService';\nimport { MqMessageService } from 'src/services/mq-message.service';\nimport { MqMessageQueueService } from 'src/services/mq-message-queue.service';\nimport { QueuesModuleOptions } from \"../interfaces\";\n\n@Injectable()\nexport class WhatsappQueueSubscriber extends RabbitMqSubscriber<any> {\n constructor(\n private readonly whatsappService: Msg91WhatsappService,\n readonly mqMessageService: MqMessageService,\n readonly mqMessageQueueService: MqMessageQueueService,\n ) {\n super(mqMessageService, mqMessageQueueService);\n }\n\n options(): QueuesModuleOptions {\n return {\n ...whatsappQueueOptions\n }\n }\n\n subscribe(message: QueueMessage<any>) {\n this.whatsappService.sendSMSSynchronously(message);\n }\n}\n"]}