@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.
- package/dist/config/common.config.d.ts +2 -0
- package/dist/config/common.config.d.ts.map +1 -1
- package/dist/config/common.config.js +1 -0
- package/dist/config/common.config.js.map +1 -1
- package/dist/decorators/whatsapp-provider.decorator.d.ts +3 -0
- package/dist/decorators/whatsapp-provider.decorator.d.ts.map +1 -0
- package/dist/decorators/whatsapp-provider.decorator.js +11 -0
- package/dist/decorators/whatsapp-provider.decorator.js.map +1 -0
- package/dist/dtos/create-list-of-values.dto.d.ts +2 -0
- package/dist/dtos/create-list-of-values.dto.d.ts.map +1 -1
- package/dist/dtos/create-list-of-values.dto.js +12 -1
- package/dist/dtos/create-list-of-values.dto.js.map +1 -1
- package/dist/dtos/update-list-of-values.dto.d.ts +2 -0
- package/dist/dtos/update-list-of-values.dto.d.ts.map +1 -1
- package/dist/dtos/update-list-of-values.dto.js +12 -1
- package/dist/dtos/update-list-of-values.dto.js.map +1 -1
- package/dist/entities/list-of-values.entity.d.ts +2 -0
- package/dist/entities/list-of-values.entity.d.ts.map +1 -1
- package/dist/entities/list-of-values.entity.js +7 -1
- package/dist/entities/list-of-values.entity.js.map +1 -1
- package/dist/factories/whatsapp.factory.d.ts +14 -0
- package/dist/factories/whatsapp.factory.d.ts.map +1 -0
- package/dist/factories/whatsapp.factory.js +53 -0
- package/dist/factories/whatsapp.factory.js.map +1 -0
- package/dist/helpers/solid-registry.d.ts +3 -0
- package/dist/helpers/solid-registry.d.ts.map +1 -1
- package/dist/helpers/solid-registry.js +7 -0
- package/dist/helpers/solid-registry.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +3 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/jobs/database/{whatsapp-publisher-database.service.d.ts → msg91-whatsapp-publisher-database.service.d.ts} +2 -2
- package/dist/jobs/database/msg91-whatsapp-publisher-database.service.d.ts.map +1 -0
- package/dist/jobs/database/{whatsapp-publisher-database.service.js → msg91-whatsapp-publisher-database.service.js} +8 -8
- package/dist/jobs/database/msg91-whatsapp-publisher-database.service.js.map +1 -0
- package/dist/jobs/database/{whatsapp-queue-options-database.d.ts → msg91-whatsapp-queue-options-database.d.ts} +1 -1
- package/dist/jobs/database/msg91-whatsapp-queue-options-database.d.ts.map +1 -0
- package/dist/jobs/database/{whatsapp-queue-options-database.js → msg91-whatsapp-queue-options-database.js} +2 -2
- package/dist/jobs/database/msg91-whatsapp-queue-options-database.js.map +1 -0
- package/dist/jobs/database/{whatsapp-subscriber-database.service.d.ts → msg91-whatsapp-subscriber-database.service.d.ts} +2 -2
- package/dist/jobs/database/msg91-whatsapp-subscriber-database.service.d.ts.map +1 -0
- package/dist/jobs/database/{whatsapp-subscriber-database.service.js → msg91-whatsapp-subscriber-database.service.js} +9 -9
- package/dist/jobs/database/msg91-whatsapp-subscriber-database.service.js.map +1 -0
- package/dist/jobs/database/three60-whatsapp-publisher-database.service.d.ts +11 -0
- package/dist/jobs/database/three60-whatsapp-publisher-database.service.d.ts.map +1 -0
- package/dist/jobs/database/three60-whatsapp-publisher-database.service.js +39 -0
- package/dist/jobs/database/three60-whatsapp-publisher-database.service.js.map +1 -0
- package/dist/jobs/database/three60-whatsapp-queue-options-database.d.ts +8 -0
- package/dist/jobs/database/three60-whatsapp-queue-options-database.d.ts.map +1 -0
- package/dist/jobs/database/three60-whatsapp-queue-options-database.js +10 -0
- package/dist/jobs/database/three60-whatsapp-queue-options-database.js.map +1 -0
- package/dist/jobs/database/three60-whatsapp-subscriber-database.service.d.ts +17 -0
- package/dist/jobs/database/three60-whatsapp-subscriber-database.service.d.ts.map +1 -0
- package/dist/jobs/database/three60-whatsapp-subscriber-database.service.js +48 -0
- package/dist/jobs/database/three60-whatsapp-subscriber-database.service.js.map +1 -0
- package/dist/jobs/{whatsapp-publisher.service.d.ts → msg91-whatsapp-publisher.service.d.ts} +2 -2
- package/dist/jobs/msg91-whatsapp-publisher.service.d.ts.map +1 -0
- package/dist/jobs/{whatsapp-publisher.service.js → msg91-whatsapp-publisher.service.js} +8 -8
- package/dist/jobs/msg91-whatsapp-publisher.service.js.map +1 -0
- package/dist/jobs/{whatsapp-queue-options.d.ts → msg91-whatsapp-queue-options.d.ts} +1 -1
- package/dist/jobs/msg91-whatsapp-queue-options.d.ts.map +1 -0
- package/dist/jobs/msg91-whatsapp-queue-options.js +10 -0
- package/dist/jobs/msg91-whatsapp-queue-options.js.map +1 -0
- package/dist/jobs/{whatsapp-subscriber.service.d.ts → msg91-whatsapp-subscriber.service.d.ts} +2 -2
- package/dist/jobs/msg91-whatsapp-subscriber.service.d.ts.map +1 -0
- package/dist/jobs/{whatsapp-subscriber.service.js → msg91-whatsapp-subscriber.service.js} +9 -9
- package/dist/jobs/msg91-whatsapp-subscriber.service.js.map +1 -0
- package/dist/jobs/three60-whatsapp-publisher.service.d.ts +11 -0
- package/dist/jobs/three60-whatsapp-publisher.service.d.ts.map +1 -0
- package/dist/jobs/three60-whatsapp-publisher.service.js +39 -0
- package/dist/jobs/three60-whatsapp-publisher.service.js.map +1 -0
- package/dist/jobs/three60-whatsapp-queue-options.d.ts +8 -0
- package/dist/jobs/three60-whatsapp-queue-options.d.ts.map +1 -0
- package/dist/jobs/{whatsapp-queue-options.js → three60-whatsapp-queue-options.js} +3 -3
- package/dist/jobs/three60-whatsapp-queue-options.js.map +1 -0
- package/dist/jobs/three60-whatsapp-subscriber.service.d.ts +15 -0
- package/dist/jobs/three60-whatsapp-subscriber.service.d.ts.map +1 -0
- package/dist/jobs/three60-whatsapp-subscriber.service.js +45 -0
- package/dist/jobs/three60-whatsapp-subscriber.service.js.map +1 -0
- package/dist/mappers/list-of-values-mapper.d.ts +5 -0
- package/dist/mappers/list-of-values-mapper.d.ts.map +1 -0
- package/dist/mappers/list-of-values-mapper.js +28 -0
- package/dist/mappers/list-of-values-mapper.js.map +1 -0
- package/dist/seeders/module-metadata-seeder.service.js +1 -1
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +27 -137
- package/dist/services/chatter-message.service.d.ts.map +1 -1
- package/dist/services/chatter-message.service.js +6 -0
- package/dist/services/chatter-message.service.js.map +1 -1
- package/dist/services/list-of-values-metadata.service.d.ts +34 -0
- package/dist/services/list-of-values-metadata.service.d.ts.map +1 -0
- package/dist/services/list-of-values-metadata.service.js +213 -0
- package/dist/services/list-of-values-metadata.service.js.map +1 -0
- package/dist/services/solid-introspect.service.d.ts +1 -0
- package/dist/services/solid-introspect.service.d.ts.map +1 -1
- package/dist/services/solid-introspect.service.js +14 -0
- package/dist/services/solid-introspect.service.js.map +1 -1
- package/dist/services/whatsapp/Msg91WhatsappService.d.ts +8 -6
- package/dist/services/whatsapp/Msg91WhatsappService.d.ts.map +1 -1
- package/dist/services/whatsapp/Msg91WhatsappService.js +24 -7
- package/dist/services/whatsapp/Msg91WhatsappService.js.map +1 -1
- package/dist/services/whatsapp/Three60WhatsappService.d.ts +18 -0
- package/dist/services/whatsapp/Three60WhatsappService.d.ts.map +1 -0
- package/dist/services/whatsapp/Three60WhatsappService.js +61 -0
- package/dist/services/whatsapp/Three60WhatsappService.js.map +1 -0
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +26 -8
- package/dist/solid-core.module.js.map +1 -1
- package/dist/subscribers/list-of-values-metadata.subscriber.d.ts +18 -0
- package/dist/subscribers/list-of-values-metadata.subscriber.d.ts.map +1 -0
- package/dist/subscribers/list-of-values-metadata.subscriber.js +101 -0
- package/dist/subscribers/list-of-values-metadata.subscriber.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/config/common.config.ts +1 -0
- package/src/decorators/whatsapp-provider.decorator.ts +7 -0
- package/src/dtos/create-list-of-values.dto.ts +7 -0
- package/src/dtos/update-list-of-values.dto.ts +8 -1
- package/src/entities/list-of-values.entity.ts +5 -1
- package/src/factories/whatsapp.factory.ts +41 -0
- package/src/helpers/solid-registry.ts +9 -0
- package/src/index.ts +3 -3
- package/src/interfaces.ts +12 -2
- package/src/jobs/database/{whatsapp-publisher-database.service.ts → msg91-whatsapp-publisher-database.service.ts} +2 -2
- package/src/jobs/database/{whatsapp-queue-options-database.ts → msg91-whatsapp-queue-options-database.ts} +1 -1
- package/src/jobs/database/{whatsapp-subscriber-database.service.ts → msg91-whatsapp-subscriber-database.service.ts} +3 -4
- package/src/jobs/database/three60-whatsapp-publisher-database.service.ts +23 -0
- package/src/jobs/database/three60-whatsapp-queue-options-database.ts +9 -0
- package/src/jobs/database/three60-whatsapp-subscriber-database.service.ts +32 -0
- package/src/jobs/{whatsapp-publisher.service.ts → msg91-whatsapp-publisher.service.ts} +2 -2
- package/src/jobs/msg91-whatsapp-queue-options.ts +12 -0
- package/src/jobs/{whatsapp-subscriber.service.ts → msg91-whatsapp-subscriber.service.ts} +3 -3
- package/src/jobs/three60-whatsapp-publisher.service.ts +23 -0
- package/src/jobs/{whatsapp-queue-options.ts → three60-whatsapp-queue-options.ts} +2 -2
- package/src/jobs/three60-whatsapp-subscriber.service.ts +30 -0
- package/src/mappers/list-of-values-mapper.ts +17 -0
- package/src/seeders/module-metadata-seeder.service.ts +1 -1
- package/src/seeders/seed-data/solid-core-metadata.json +27 -137
- package/src/services/chatter-message.service.ts +6 -0
- package/src/services/list-of-values-metadata.service.ts +219 -0
- package/src/services/solid-introspect.service.ts +22 -0
- package/src/services/whatsapp/Msg91WhatsappService.ts +34 -10
- package/src/services/whatsapp/Three60WhatsappService.ts +52 -0
- package/src/solid-core.module.ts +26 -8
- package/src/subscribers/list-of-values-metadata.subscriber.ts +115 -0
- package/dist/jobs/database/whatsapp-publisher-database.service.d.ts.map +0 -1
- package/dist/jobs/database/whatsapp-publisher-database.service.js.map +0 -1
- package/dist/jobs/database/whatsapp-queue-options-database.d.ts.map +0 -1
- package/dist/jobs/database/whatsapp-queue-options-database.js.map +0 -1
- package/dist/jobs/database/whatsapp-subscriber-database.service.d.ts.map +0 -1
- package/dist/jobs/database/whatsapp-subscriber-database.service.js.map +0 -1
- package/dist/jobs/whatsapp-publisher.service.d.ts.map +0 -1
- package/dist/jobs/whatsapp-publisher.service.js.map +0 -1
- package/dist/jobs/whatsapp-queue-options.d.ts.map +0 -1
- package/dist/jobs/whatsapp-queue-options.js.map +0 -1
- package/dist/jobs/whatsapp-subscriber.service.d.ts.map +0 -1
- package/dist/jobs/whatsapp-subscriber.service.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidstarters/solid-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.157",
|
|
4
4
|
"description": "This module is a NestJS module containing all the required core providers required by a Solid application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -3,6 +3,7 @@ import { registerAs } from '@nestjs/config';
|
|
|
3
3
|
export default registerAs('common', () => {
|
|
4
4
|
return {
|
|
5
5
|
emailProvider: process.env.COMMON_EMAIL_PROVIDER ?? "SMTPEMailService",
|
|
6
|
+
whatsappProvider: process.env.COMMON_WHATSAPP_PROVIDER,
|
|
6
7
|
emailTemplateSeederFiles: process.env.COMMON_EMAIL_TEMPLATE_SEEDER_FILES,
|
|
7
8
|
smsProvider: process.env.COMMON_SMS_PROVIDER,
|
|
8
9
|
smsTemplateSeederFiles: process.env.COMMON_SMS_TEMPLATE_SEEDER_FILES,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsInt,IsOptional, IsString, IsNotEmpty, IsBoolean } from 'class-validator';
|
|
1
|
+
import { IsInt, IsOptional, IsString, IsNotEmpty, IsBoolean } from 'class-validator';
|
|
2
2
|
import { ApiProperty } from '@nestjs/swagger';
|
|
3
3
|
|
|
4
4
|
export class UpdateListOfValuesDto {
|
|
@@ -33,4 +33,11 @@ export class UpdateListOfValuesDto {
|
|
|
33
33
|
@IsInt()
|
|
34
34
|
@ApiProperty()
|
|
35
35
|
sequence: number;
|
|
36
|
+
@IsOptional()
|
|
37
|
+
@IsInt()
|
|
38
|
+
@ApiProperty()
|
|
39
|
+
moduleId: number;
|
|
40
|
+
@IsString()
|
|
41
|
+
@IsOptional()
|
|
42
|
+
moduleUserKey: string;
|
|
36
43
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommonEntity } from 'src/entities/common.entity'
|
|
2
|
-
import {Entity, Column} from 'typeorm'
|
|
2
|
+
import { Entity, Column, ManyToOne, JoinColumn } from 'typeorm'
|
|
3
|
+
import { ModuleMetadata } from 'src/entities/module-metadata.entity'
|
|
3
4
|
|
|
4
5
|
@Entity("ss_list_of_values")
|
|
5
6
|
export class ListOfValues extends CommonEntity {
|
|
@@ -15,4 +16,7 @@ export class ListOfValues extends CommonEntity {
|
|
|
15
16
|
default: boolean = false;
|
|
16
17
|
@Column({ type: "int", nullable: true })
|
|
17
18
|
sequence: number;
|
|
19
|
+
@ManyToOne(() => ModuleMetadata, { onDelete: "CASCADE", nullable: true })
|
|
20
|
+
@JoinColumn()
|
|
21
|
+
module: ModuleMetadata;
|
|
18
22
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Inject, Injectable, Logger } from "@nestjs/common";
|
|
2
|
+
import { ConfigType } from "@nestjs/config";
|
|
3
|
+
import { ModuleRef } from "@nestjs/core";
|
|
4
|
+
import commonConfig from "src/config/common.config";
|
|
5
|
+
import { SolidRegistry } from "src/helpers/solid-registry";
|
|
6
|
+
import { IWhatsAppTransport } from "src/interfaces";
|
|
7
|
+
|
|
8
|
+
function norm(s?: string) {
|
|
9
|
+
return s?.trim().toLowerCase();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// This factory will be use to return a mail service instance, using the configured environment variables
|
|
13
|
+
@Injectable()
|
|
14
|
+
export class WhatsAppFactory {
|
|
15
|
+
private readonly logger = new Logger(this.constructor.name);
|
|
16
|
+
constructor(
|
|
17
|
+
private readonly moduleRef: ModuleRef, // Use the module ref to dynamically resolve the mail service
|
|
18
|
+
private readonly solidRegistry: SolidRegistry,
|
|
19
|
+
@Inject(commonConfig.KEY)
|
|
20
|
+
private readonly commonConfiguration: ConfigType<typeof commonConfig>,
|
|
21
|
+
) { }
|
|
22
|
+
|
|
23
|
+
getWhatsappService(name: string = null): IWhatsAppTransport {
|
|
24
|
+
// This is the default provider
|
|
25
|
+
const whatsappServiceName = this.commonConfiguration.whatsappProvider || name;
|
|
26
|
+
if (!whatsappServiceName) {
|
|
27
|
+
throw new Error("Unable to resolve whatsapp provider")
|
|
28
|
+
}
|
|
29
|
+
const whatsappProviders = this.solidRegistry.getWhatsappProviders();
|
|
30
|
+
// Return the instance which matches the whatsappServiceName
|
|
31
|
+
if (!whatsappProviders.length) {
|
|
32
|
+
// throw new Error("No mail providers are registered.");
|
|
33
|
+
this.logger.error("No whatsapp providers are registered.");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const whatsappServiceProvider = whatsappProviders.find(provider => provider.name === whatsappServiceName);
|
|
37
|
+
|
|
38
|
+
return whatsappServiceProvider.instance as IWhatsAppTransport;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
@@ -66,6 +66,11 @@ export class SolidRegistry {
|
|
|
66
66
|
private dashboardVariableSelectionProviders: Set<InstanceWrapper> = new Set();
|
|
67
67
|
private dashboardQuestionDataProviders: Set<InstanceWrapper> = new Set();
|
|
68
68
|
private mailProviders: Set<InstanceWrapper> = new Set();
|
|
69
|
+
private whatsappProviders: Set<InstanceWrapper> = new Set();
|
|
70
|
+
|
|
71
|
+
registerWhatsappProvider(whatsappProvider: InstanceWrapper): void {
|
|
72
|
+
this.whatsappProviders.add(whatsappProvider);
|
|
73
|
+
}
|
|
69
74
|
|
|
70
75
|
registerMailProvider(mailProvider: InstanceWrapper): void {
|
|
71
76
|
this.mailProviders.add(mailProvider);
|
|
@@ -115,6 +120,10 @@ export class SolidRegistry {
|
|
|
115
120
|
return Array.from(this.mailProviders);
|
|
116
121
|
}
|
|
117
122
|
|
|
123
|
+
getWhatsappProviders(): Array<InstanceWrapper> {
|
|
124
|
+
return Array.from(this.whatsappProviders);
|
|
125
|
+
}
|
|
126
|
+
|
|
118
127
|
getSeeders(): Array<InstanceWrapper> {
|
|
119
128
|
return Array.from(this.seeders);
|
|
120
129
|
}
|
package/src/index.ts
CHANGED
|
@@ -193,9 +193,9 @@ export * from './jobs/otp-subscriber.service'
|
|
|
193
193
|
export * from './jobs/sms-publisher.service'
|
|
194
194
|
export * from './jobs/sms-queue-options'
|
|
195
195
|
export * from './jobs/sms-subscriber.service'
|
|
196
|
-
export * from './jobs/whatsapp-publisher.service'
|
|
197
|
-
export * from './jobs/whatsapp-queue-options'
|
|
198
|
-
export * from './jobs/whatsapp-subscriber.service'
|
|
196
|
+
export * from './jobs/msg91-whatsapp-publisher.service'
|
|
197
|
+
export * from './jobs/msg91-whatsapp-queue-options'
|
|
198
|
+
export * from './jobs/msg91-whatsapp-subscriber.service'
|
|
199
199
|
|
|
200
200
|
export * from './listeners/user-registration.listener'
|
|
201
201
|
|
package/src/interfaces.ts
CHANGED
|
@@ -134,7 +134,7 @@ export interface IEntityComputedFieldProvider {
|
|
|
134
134
|
name(): string;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
export interface IEntityPreComputeFieldProvider<TTriggerEntity, TContext, TValue=void> extends IEntityComputedFieldProvider {
|
|
137
|
+
export interface IEntityPreComputeFieldProvider<TTriggerEntity, TContext, TValue = void> extends IEntityComputedFieldProvider {
|
|
138
138
|
preComputeValue(triggerEntity: TTriggerEntity, computedFieldMetadata: ComputedFieldMetadata<TContext>): Promise<TValue>;
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -159,7 +159,7 @@ export class EventDetails<T> {
|
|
|
159
159
|
) { }
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
export interface IMail<TResponse=unknown> {
|
|
162
|
+
export interface IMail<TResponse = unknown> {
|
|
163
163
|
sendEmail(
|
|
164
164
|
to: string,
|
|
165
165
|
subject: string,
|
|
@@ -200,6 +200,16 @@ export interface ISMS {
|
|
|
200
200
|
): Promise<any>;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
export interface IWhatsAppTransport {
|
|
204
|
+
sendWhatsAppMessage(
|
|
205
|
+
to: string,
|
|
206
|
+
templateId: string,
|
|
207
|
+
parameters: any,
|
|
208
|
+
parentEntity?: any,
|
|
209
|
+
parentEntityId?: any
|
|
210
|
+
): Promise<any>;
|
|
211
|
+
}
|
|
212
|
+
|
|
203
213
|
export interface MailAttachmentWrapper {
|
|
204
214
|
relativePath?: string;
|
|
205
215
|
attachment?: MailAttachment;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
2
|
|
|
3
|
-
import whatsappQueueOptions from './whatsapp-queue-options-database';
|
|
3
|
+
import whatsappQueueOptions from './msg91-whatsapp-queue-options-database';
|
|
4
4
|
import { MqMessageService } from 'src/services/mq-message.service';
|
|
5
5
|
import { MqMessageQueueService } from 'src/services/mq-message-queue.service';
|
|
6
6
|
import { QueuesModuleOptions } from 'src/interfaces';
|
|
7
7
|
import { DatabasePublisher } from 'src/services/queues/database-publisher.service';
|
|
8
8
|
|
|
9
9
|
@Injectable()
|
|
10
|
-
export class
|
|
10
|
+
export class Msg91WhatsappQueuePublisherDatabase extends DatabasePublisher<any> {
|
|
11
11
|
constructor(
|
|
12
12
|
protected readonly mqMessageService: MqMessageService,
|
|
13
13
|
protected readonly mqMessageQueueService: MqMessageQueueService,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
2
|
|
|
3
|
-
import { RabbitMqSubscriber } from 'src/services/queues/rabbitmq-subscriber.service';
|
|
4
3
|
import { QueueMessage } from 'src/interfaces/mq';
|
|
5
|
-
import whatsappQueueOptions from './whatsapp-queue-options-database';
|
|
4
|
+
import whatsappQueueOptions from './msg91-whatsapp-queue-options-database';
|
|
6
5
|
import { MqMessageService } from 'src/services/mq-message.service';
|
|
7
6
|
import { MqMessageQueueService } from 'src/services/mq-message-queue.service';
|
|
8
7
|
import { Msg91WhatsappService } from 'src/services/whatsapp/Msg91WhatsappService';
|
|
@@ -11,7 +10,7 @@ import { DatabaseSubscriber } from 'src/services/queues/database-subscriber.serv
|
|
|
11
10
|
import { PollerService } from 'src/services/poller.service';
|
|
12
11
|
|
|
13
12
|
@Injectable()
|
|
14
|
-
export class
|
|
13
|
+
export class Msg91WhatsappQueueSubscriberDatabase extends DatabaseSubscriber<any> {
|
|
15
14
|
constructor(
|
|
16
15
|
private readonly whatsappService: Msg91WhatsappService,
|
|
17
16
|
readonly mqMessageService: MqMessageService,
|
|
@@ -28,6 +27,6 @@ export class WhatsappQueueSubscriberDatabase extends DatabaseSubscriber<any> {
|
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
subscribe(message: QueueMessage<any>) {
|
|
31
|
-
this.whatsappService.
|
|
30
|
+
this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
32
31
|
}
|
|
33
32
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
import whatsappQueueOptions from './msg91-whatsapp-queue-options-database';
|
|
4
|
+
import { MqMessageService } from 'src/services/mq-message.service';
|
|
5
|
+
import { MqMessageQueueService } from 'src/services/mq-message-queue.service';
|
|
6
|
+
import { QueuesModuleOptions } from 'src/interfaces';
|
|
7
|
+
import { DatabasePublisher } from 'src/services/queues/database-publisher.service';
|
|
8
|
+
|
|
9
|
+
@Injectable()
|
|
10
|
+
export class Three60WhatsappQueuePublisherDatabase extends DatabasePublisher<any> {
|
|
11
|
+
constructor(
|
|
12
|
+
protected readonly mqMessageService: MqMessageService,
|
|
13
|
+
protected readonly mqMessageQueueService: MqMessageQueueService,
|
|
14
|
+
) {
|
|
15
|
+
super(mqMessageService, mqMessageQueueService);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
options(): QueuesModuleOptions {
|
|
19
|
+
return {
|
|
20
|
+
...whatsappQueueOptions
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
import { QueueMessage } from 'src/interfaces/mq';
|
|
4
|
+
import whatsappQueueOptions from './msg91-whatsapp-queue-options-database';
|
|
5
|
+
import { MqMessageService } from 'src/services/mq-message.service';
|
|
6
|
+
import { MqMessageQueueService } from 'src/services/mq-message-queue.service';
|
|
7
|
+
import { QueuesModuleOptions } from 'src/interfaces';
|
|
8
|
+
import { DatabaseSubscriber } from 'src/services/queues/database-subscriber.service';
|
|
9
|
+
import { PollerService } from 'src/services/poller.service';
|
|
10
|
+
import { Three60WhatsappService } from 'src/services/whatsapp/Three60WhatsappService';
|
|
11
|
+
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class Three60WhatsappQueueSubscriberDatabase extends DatabaseSubscriber<any> {
|
|
14
|
+
constructor(
|
|
15
|
+
private readonly whatsappService: Three60WhatsappService,
|
|
16
|
+
readonly mqMessageService: MqMessageService,
|
|
17
|
+
readonly mqMessageQueueService: MqMessageQueueService,
|
|
18
|
+
readonly poller: PollerService,
|
|
19
|
+
) {
|
|
20
|
+
super(mqMessageService, mqMessageQueueService, poller);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
options(): QueuesModuleOptions {
|
|
24
|
+
return {
|
|
25
|
+
...whatsappQueueOptions
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
subscribe(message: QueueMessage<any>) {
|
|
30
|
+
this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
2
|
|
|
3
3
|
import { RabbitMqPublisher } from 'src/services/queues/rabbitmq-publisher.service';
|
|
4
|
-
import whatsappQueueOptions from './whatsapp-queue-options';
|
|
4
|
+
import whatsappQueueOptions from './msg91-whatsapp-queue-options';
|
|
5
5
|
import { MqMessageService } from 'src/services/mq-message.service';
|
|
6
6
|
import { MqMessageQueueService } from 'src/services/mq-message-queue.service';
|
|
7
7
|
import { QueuesModuleOptions } from "../interfaces";
|
|
8
8
|
|
|
9
9
|
@Injectable()
|
|
10
|
-
export class
|
|
10
|
+
export class Msg91WhatsappQueuePublisher extends RabbitMqPublisher<any> {
|
|
11
11
|
constructor(
|
|
12
12
|
protected readonly mqMessageService: MqMessageService,
|
|
13
13
|
protected readonly mqMessageQueueService: MqMessageQueueService,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BrokerType } from "../interfaces";
|
|
2
|
+
|
|
3
|
+
const MSG91_WHATSAPP_QUEUE_NAME = 'mag_91_whatsapp_queue';
|
|
4
|
+
export default {
|
|
5
|
+
name: 'whatsappInstance',
|
|
6
|
+
type: BrokerType.RabbitMQ,
|
|
7
|
+
queueName: MSG91_WHATSAPP_QUEUE_NAME,
|
|
8
|
+
// receive: async (message: QueueMessage<any>) => { // Default receive handler
|
|
9
|
+
// console.log(`Received message: ${JSON.stringify(message)} from queue ${SMS_QUEUE_NAME}`);
|
|
10
|
+
// return 'Received';
|
|
11
|
+
// },
|
|
12
|
+
};
|
|
@@ -2,14 +2,14 @@ import { Injectable } from '@nestjs/common';
|
|
|
2
2
|
|
|
3
3
|
import { RabbitMqSubscriber } from 'src/services/queues/rabbitmq-subscriber.service';
|
|
4
4
|
import { QueueMessage } from 'src/interfaces/mq';
|
|
5
|
-
import whatsappQueueOptions from './whatsapp-queue-options';
|
|
5
|
+
import whatsappQueueOptions from './msg91-whatsapp-queue-options';
|
|
6
6
|
import { Msg91WhatsappService } from '../services/whatsapp/Msg91WhatsappService';
|
|
7
7
|
import { MqMessageService } from 'src/services/mq-message.service';
|
|
8
8
|
import { MqMessageQueueService } from 'src/services/mq-message-queue.service';
|
|
9
9
|
import { QueuesModuleOptions } from "../interfaces";
|
|
10
10
|
|
|
11
11
|
@Injectable()
|
|
12
|
-
export class
|
|
12
|
+
export class Msg91WhatsappQueueSubscriber extends RabbitMqSubscriber<any> {
|
|
13
13
|
constructor(
|
|
14
14
|
private readonly whatsappService: Msg91WhatsappService,
|
|
15
15
|
readonly mqMessageService: MqMessageService,
|
|
@@ -25,6 +25,6 @@ export class WhatsappQueueSubscriber extends RabbitMqSubscriber<any> {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
subscribe(message: QueueMessage<any>) {
|
|
28
|
-
this.whatsappService.
|
|
28
|
+
this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
import { RabbitMqPublisher } from 'src/services/queues/rabbitmq-publisher.service';
|
|
4
|
+
import whatsappQueueOptions from './msg91-whatsapp-queue-options';
|
|
5
|
+
import { MqMessageService } from 'src/services/mq-message.service';
|
|
6
|
+
import { MqMessageQueueService } from 'src/services/mq-message-queue.service';
|
|
7
|
+
import { QueuesModuleOptions } from "../interfaces";
|
|
8
|
+
|
|
9
|
+
@Injectable()
|
|
10
|
+
export class Three60WhatsappQueuePublisher extends RabbitMqPublisher<any> {
|
|
11
|
+
constructor(
|
|
12
|
+
protected readonly mqMessageService: MqMessageService,
|
|
13
|
+
protected readonly mqMessageQueueService: MqMessageQueueService,
|
|
14
|
+
) {
|
|
15
|
+
super(mqMessageService, mqMessageQueueService);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
options(): QueuesModuleOptions {
|
|
19
|
+
return {
|
|
20
|
+
...whatsappQueueOptions
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BrokerType } from "../interfaces";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const _WHATSAPP_QUEUE_NAME = 'three60_whatsapp_queue';
|
|
4
4
|
export default {
|
|
5
5
|
name: 'whatsappInstance',
|
|
6
6
|
type: BrokerType.RabbitMQ,
|
|
7
|
-
queueName:
|
|
7
|
+
queueName: _WHATSAPP_QUEUE_NAME,
|
|
8
8
|
// receive: async (message: QueueMessage<any>) => { // Default receive handler
|
|
9
9
|
// console.log(`Received message: ${JSON.stringify(message)} from queue ${SMS_QUEUE_NAME}`);
|
|
10
10
|
// return 'Received';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
import { RabbitMqSubscriber } from 'src/services/queues/rabbitmq-subscriber.service';
|
|
4
|
+
import { QueueMessage } from 'src/interfaces/mq';
|
|
5
|
+
import whatsappQueueOptions from './msg91-whatsapp-queue-options';
|
|
6
|
+
import { MqMessageService } from 'src/services/mq-message.service';
|
|
7
|
+
import { MqMessageQueueService } from 'src/services/mq-message-queue.service';
|
|
8
|
+
import { QueuesModuleOptions } from "../interfaces";
|
|
9
|
+
import { Three60WhatsappService } from 'src/services/whatsapp/Three60WhatsappService';
|
|
10
|
+
|
|
11
|
+
@Injectable()
|
|
12
|
+
export class Three60WhatsappQueueSubscriber extends RabbitMqSubscriber<any> {
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly whatsappService: Three60WhatsappService,
|
|
15
|
+
readonly mqMessageService: MqMessageService,
|
|
16
|
+
readonly mqMessageQueueService: MqMessageQueueService,
|
|
17
|
+
) {
|
|
18
|
+
super(mqMessageService, mqMessageQueueService);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
options(): QueuesModuleOptions {
|
|
22
|
+
return {
|
|
23
|
+
...whatsappQueueOptions
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
subscribe(message: QueueMessage<any>) {
|
|
28
|
+
this.whatsappService.sendWhatsAppMessageSynchronously(message);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Injectable } from "@nestjs/common";
|
|
2
|
+
import { ListOfValues } from "src/entities/list-of-values.entity";
|
|
3
|
+
|
|
4
|
+
@Injectable()
|
|
5
|
+
export class ListOfValuesMapper {
|
|
6
|
+
toDto(listOfValue: ListOfValues): any {
|
|
7
|
+
return {
|
|
8
|
+
type: listOfValue.type,
|
|
9
|
+
value: listOfValue.value,
|
|
10
|
+
display: listOfValue.display,
|
|
11
|
+
description: listOfValue.description,
|
|
12
|
+
default: listOfValue.default,
|
|
13
|
+
sequence: listOfValue.sequence,
|
|
14
|
+
module: listOfValue.module ? listOfValue.module.id : null
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -584,7 +584,7 @@ export class ModuleMetadataSeederService {
|
|
|
584
584
|
return;
|
|
585
585
|
}
|
|
586
586
|
for (let j = 0; j < listOfValuesDto.length; j++) {
|
|
587
|
-
await this.listOfValuesService.upsert(listOfValuesDto);
|
|
587
|
+
await this.listOfValuesService.upsert(listOfValuesDto[j]);
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
590
|
|
|
@@ -3642,6 +3642,23 @@
|
|
|
3642
3642
|
"private": false,
|
|
3643
3643
|
"encrypt": false,
|
|
3644
3644
|
"isSystem": false
|
|
3645
|
+
},
|
|
3646
|
+
{
|
|
3647
|
+
"name": "module",
|
|
3648
|
+
"displayName": "Module",
|
|
3649
|
+
"type": "relation",
|
|
3650
|
+
"ormType": "integer",
|
|
3651
|
+
"required": false,
|
|
3652
|
+
"unique": false,
|
|
3653
|
+
"index": false,
|
|
3654
|
+
"private": false,
|
|
3655
|
+
"encrypt": false,
|
|
3656
|
+
"relationType": "many-to-one",
|
|
3657
|
+
"relationCreateInverse": false,
|
|
3658
|
+
"relationCoModelSingularName": "moduleMetadata",
|
|
3659
|
+
"relationModelModuleName": "solid-core",
|
|
3660
|
+
"relationCascade": "cascade",
|
|
3661
|
+
"isSystem": true
|
|
3645
3662
|
}
|
|
3646
3663
|
]
|
|
3647
3664
|
},
|
|
@@ -6459,73 +6476,6 @@
|
|
|
6459
6476
|
]
|
|
6460
6477
|
}
|
|
6461
6478
|
},
|
|
6462
|
-
{
|
|
6463
|
-
"name": "listOfValues-list-view",
|
|
6464
|
-
"displayName": "List of Values list view",
|
|
6465
|
-
"type": "list",
|
|
6466
|
-
"context": "{}",
|
|
6467
|
-
"moduleUserKey": "solid-core",
|
|
6468
|
-
"modelUserKey": "listOfValues",
|
|
6469
|
-
"layout": {
|
|
6470
|
-
"type": "list",
|
|
6471
|
-
"attrs": {
|
|
6472
|
-
"pagination": true,
|
|
6473
|
-
"pageSizeOptions": [
|
|
6474
|
-
10,
|
|
6475
|
-
25,
|
|
6476
|
-
50
|
|
6477
|
-
],
|
|
6478
|
-
"enableGlobalSearch": true,
|
|
6479
|
-
"create": true,
|
|
6480
|
-
"edit": true,
|
|
6481
|
-
"delete": true
|
|
6482
|
-
},
|
|
6483
|
-
"children": [
|
|
6484
|
-
{
|
|
6485
|
-
"type": "field",
|
|
6486
|
-
"attrs": {
|
|
6487
|
-
"name": "type",
|
|
6488
|
-
"isSearchable": true
|
|
6489
|
-
}
|
|
6490
|
-
},
|
|
6491
|
-
{
|
|
6492
|
-
"type": "field",
|
|
6493
|
-
"attrs": {
|
|
6494
|
-
"name": "value",
|
|
6495
|
-
"isSearchable": true
|
|
6496
|
-
}
|
|
6497
|
-
},
|
|
6498
|
-
{
|
|
6499
|
-
"type": "field",
|
|
6500
|
-
"attrs": {
|
|
6501
|
-
"name": "display",
|
|
6502
|
-
"isSearchable": true
|
|
6503
|
-
}
|
|
6504
|
-
},
|
|
6505
|
-
{
|
|
6506
|
-
"type": "field",
|
|
6507
|
-
"attrs": {
|
|
6508
|
-
"name": "description",
|
|
6509
|
-
"isSearchable": true
|
|
6510
|
-
}
|
|
6511
|
-
},
|
|
6512
|
-
{
|
|
6513
|
-
"type": "field",
|
|
6514
|
-
"attrs": {
|
|
6515
|
-
"name": "default",
|
|
6516
|
-
"isSearchable": true
|
|
6517
|
-
}
|
|
6518
|
-
},
|
|
6519
|
-
{
|
|
6520
|
-
"type": "field",
|
|
6521
|
-
"attrs": {
|
|
6522
|
-
"name": "sequence",
|
|
6523
|
-
"isSearchable": true
|
|
6524
|
-
}
|
|
6525
|
-
}
|
|
6526
|
-
]
|
|
6527
|
-
}
|
|
6528
|
-
},
|
|
6529
6479
|
{
|
|
6530
6480
|
"name": "listOfValues-form-view",
|
|
6531
6481
|
"displayName": "List of Values form view",
|
|
@@ -6590,6 +6540,12 @@
|
|
|
6590
6540
|
"attrs": {
|
|
6591
6541
|
"name": "sequence"
|
|
6592
6542
|
}
|
|
6543
|
+
},
|
|
6544
|
+
{
|
|
6545
|
+
"type": "field",
|
|
6546
|
+
"attrs": {
|
|
6547
|
+
"name": "module"
|
|
6548
|
+
}
|
|
6593
6549
|
}
|
|
6594
6550
|
]
|
|
6595
6551
|
}
|
|
@@ -6899,78 +6855,12 @@
|
|
|
6899
6855
|
"name": "sequence",
|
|
6900
6856
|
"isSearchable": true
|
|
6901
6857
|
}
|
|
6902
|
-
}
|
|
6903
|
-
]
|
|
6904
|
-
}
|
|
6905
|
-
},
|
|
6906
|
-
{
|
|
6907
|
-
"name": "listOfValues-form-view",
|
|
6908
|
-
"displayName": "List of Values form view",
|
|
6909
|
-
"type": "form",
|
|
6910
|
-
"context": "{}",
|
|
6911
|
-
"moduleUserKey": "solid-core",
|
|
6912
|
-
"modelUserKey": "listOfValues",
|
|
6913
|
-
"layout": {
|
|
6914
|
-
"type": "form",
|
|
6915
|
-
"attrs": {
|
|
6916
|
-
"name": "form-1",
|
|
6917
|
-
"label": "Solid List of Values Model",
|
|
6918
|
-
"className": "grid"
|
|
6919
|
-
},
|
|
6920
|
-
"children": [
|
|
6858
|
+
},
|
|
6921
6859
|
{
|
|
6922
|
-
"type": "
|
|
6860
|
+
"type": "field",
|
|
6923
6861
|
"attrs": {
|
|
6924
|
-
"name": "
|
|
6925
|
-
}
|
|
6926
|
-
"children": [
|
|
6927
|
-
{
|
|
6928
|
-
"type": "group",
|
|
6929
|
-
"attrs": {
|
|
6930
|
-
"name": "group-1",
|
|
6931
|
-
"label": "",
|
|
6932
|
-
"className": "col-6"
|
|
6933
|
-
},
|
|
6934
|
-
"children": [
|
|
6935
|
-
{
|
|
6936
|
-
"type": "field",
|
|
6937
|
-
"attrs": {
|
|
6938
|
-
"name": "type"
|
|
6939
|
-
}
|
|
6940
|
-
},
|
|
6941
|
-
{
|
|
6942
|
-
"type": "field",
|
|
6943
|
-
"attrs": {
|
|
6944
|
-
"name": "value"
|
|
6945
|
-
}
|
|
6946
|
-
},
|
|
6947
|
-
{
|
|
6948
|
-
"type": "field",
|
|
6949
|
-
"attrs": {
|
|
6950
|
-
"name": "display"
|
|
6951
|
-
}
|
|
6952
|
-
},
|
|
6953
|
-
{
|
|
6954
|
-
"type": "field",
|
|
6955
|
-
"attrs": {
|
|
6956
|
-
"name": "description"
|
|
6957
|
-
}
|
|
6958
|
-
},
|
|
6959
|
-
{
|
|
6960
|
-
"type": "field",
|
|
6961
|
-
"attrs": {
|
|
6962
|
-
"name": "default"
|
|
6963
|
-
}
|
|
6964
|
-
},
|
|
6965
|
-
{
|
|
6966
|
-
"type": "field",
|
|
6967
|
-
"attrs": {
|
|
6968
|
-
"name": "sequence"
|
|
6969
|
-
}
|
|
6970
|
-
}
|
|
6971
|
-
]
|
|
6972
|
-
}
|
|
6973
|
-
]
|
|
6862
|
+
"name": "module"
|
|
6863
|
+
}
|
|
6974
6864
|
}
|
|
6975
6865
|
]
|
|
6976
6866
|
}
|