fix(email,sms): Reorder debug logging to avoid confusion in email and sms connectors

This commit is contained in:
Philipp Kunz 2024-10-02 08:18:59 +02:00
parent 7d0925ad33
commit 4a75c109e3
4 changed files with 17 additions and 13 deletions

View File

@ -1,5 +1,11 @@
# Changelog # Changelog
## 2024-10-02 - 1.0.11 - fix(email,sms)
Reorder debug logging to avoid confusion in email and sms connectors
- Reordered the logging after request creation in `sendEmail` method of `SzEmailConnector`
- Reordered the logging after request creation in `sendSms` method of `SzSmsConnector`
## 2024-10-02 - 1.0.10 - fix(build) ## 2024-10-02 - 1.0.10 - fix(build)
Fix build script configuration and plugins import path Fix build script configuration and plugins import path

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@serve.zone/platformclient', name: '@serve.zone/platformclient',
version: '1.0.10', version: '1.0.11',
description: 'a module that makes it really easy to use the serve.zone platform inside your app' description: 'a module that makes it really easy to use the serve.zone platform inside your app'
} }

View File

@ -13,12 +13,6 @@ export class SzEmailConnector {
public async sendEmail( public async sendEmail(
optionsArg: plugins.servezoneInterfaces.platformservice.mta.IRequest_SendEmail['request'] optionsArg: plugins.servezoneInterfaces.platformservice.mta.IRequest_SendEmail['request']
) { ) {
const typedRequest =
this.platformClientRef.typedsocket.createTypedRequest<plugins.servezoneInterfaces.platformservice.mta.IRequest_SendEmail>(
'sendEmail'
);
const response = await typedRequest.fire(optionsArg);
if (process.env.SERVEZONE_PLATFORMCLIENT_DEBUG) { if (process.env.SERVEZONE_PLATFORMCLIENT_DEBUG) {
logger.log('info', `sent email with subject ${optionsArg.title} to ${optionsArg.to} logger.log('info', `sent email with subject ${optionsArg.title} to ${optionsArg.to}
body: body:
@ -26,6 +20,11 @@ export class SzEmailConnector {
`); `);
} }
const typedRequest =
this.platformClientRef.typedsocket.createTypedRequest<plugins.servezoneInterfaces.platformservice.mta.IRequest_SendEmail>(
'sendEmail'
);
const response = await typedRequest.fire(optionsArg);
} }

View File

@ -10,11 +10,6 @@ export class SzSmsConnector {
} }
public async sendSms(messageArg: plugins.servezoneInterfaces.platformservice.sms.IRequest_SendSms['request']) { public async sendSms(messageArg: plugins.servezoneInterfaces.platformservice.sms.IRequest_SendSms['request']) {
const typedrequest = this.platformClientRef.typedsocket.createTypedRequest<plugins.servezoneInterfaces.platformservice.sms.IRequest_SendSms>(
'sendSms'
);
const response = await typedrequest.fire(messageArg);
if (process.env.SERVEZONE_PLATFORMCLIENT_DEBUG) { if (process.env.SERVEZONE_PLATFORMCLIENT_DEBUG) {
logger.log('info', `sent sms to ${messageArg.toNumber}} logger.log('info', `sent sms to ${messageArg.toNumber}}
body: body:
@ -22,7 +17,11 @@ export class SzSmsConnector {
`); `);
} }
const typedrequest = this.platformClientRef.typedsocket.createTypedRequest<plugins.servezoneInterfaces.platformservice.sms.IRequest_SendSms>(
'sendSms'
);
const response = await typedrequest.fire(messageArg);
return response.status; return response.status;
} }