fix(core): Update dependencies and add logging for email and SMS functions

This commit is contained in:
Philipp Kunz 2024-10-02 08:01:31 +02:00
parent e19a5b6195
commit a71d5f1bde
10 changed files with 461 additions and 505 deletions

View File

@ -1,5 +1,13 @@
# Changelog
## 2024-10-02 - 1.0.7 - fix(core)
Update dependencies and add logging for email and SMS functions
- Updated devDependencies and dependencies in package.json
- Added logger import and logging statements in classes.emailconnector.ts and classes.smsconnector.ts
- Fixed formatting issues in test/test.ts
- Cleaned up and removed unused imports in index.ts and plugins.ts
## 2024-07-26 - 1.0.6 - fix(core)
Update @types/node dependency version

View File

@ -18,17 +18,17 @@
"@git.zone/tsbundle": "^2.0.5",
"@git.zone/tsrun": "^1.2.49",
"@git.zone/tstest": "^1.0.90",
"@push.rocks/tapbundle": "^5.0.23",
"@types/node": "^20.14.12"
"@push.rocks/tapbundle": "^5.3.0",
"@types/node": "^22.7.4"
},
"dependencies": {
"@api.global/typedrequest": "^3.0.30",
"@api.global/typedserver": "^3.0.50",
"@api.global/typedrequest": "^3.0.32",
"@api.global/typedserver": "^3.0.51",
"@api.global/typedsocket": "^3.0.1",
"@push.rocks/qenv": "^6.0.5",
"@push.rocks/smartlog": "^3.0.7",
"@push.rocks/smartntml": "^2.0.4",
"@serve.zone/interfaces": "^1.0.74"
"@serve.zone/interfaces": "^1.0.81"
},
"repository": {
"type": "git",

905
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
import * as platformclient from '../ts/index.js'
import * as platformclient from '../ts/index.js';
tap.test('first test', async () => {
console.log(platformclient)
})
console.log(platformclient);
});
tap.start()
tap.start();

View File

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

View File

@ -1,6 +1,8 @@
import type { SzPlatformClient } from '../classes.platformclient.js';
import * as plugins from '../plugins.js';
import { logger } from '../logger.js';
export class SzEmailConnector {
public platformClientRef: SzPlatformClient;
@ -16,6 +18,15 @@ export class SzEmailConnector {
'sendEmail'
);
const response = await typedRequest.fire(optionsArg);
if (process.env.SERVEZONE_PLATFORMCLIENT_DEBUG) {
logger.log('info', `sent email with subject ${optionsArg.title} to ${optionsArg.to}
body:
${optionsArg.body.split('\n').map(line => ` ${line}`).join('\n')}
`);
}
}
public async sendNotification(optionsArg: { toArg: string; subject: string; text: string }) {}

View File

@ -1,4 +1,5 @@
import type { SzPlatformClient } from '../classes.platformclient.js';
import { logger } from '../logger.js';
import * as plugins from '../plugins.js';
export class SzSmsConnector {
@ -13,6 +14,16 @@ export class SzSmsConnector {
'sendSms'
);
const response = await typedrequest.fire(messageArg);
if (process.env.SERVEZONE_PLATFORMCLIENT_DEBUG) {
logger.log('info', `sent sms to ${messageArg.toNumber}}
body:
${messageArg.messageText.split('\n').map(line => ` ${line}`).join('\n')}
`);
}
return response.status;
}

View File

@ -1,6 +1 @@
export * from './classes.platformclient.js';
// Things for building a server
import { servertools, utilityservers } from '@api.global/typedserver';

View File

@ -6,4 +6,6 @@ export const logger = new plugins.smartlog.Smartlog({
runtime: 'node',
zone: 'serve.zone',
}
});
});
logger.enableConsole();

View File

@ -8,12 +8,10 @@ export {
// @push.rocks scope
import * as qenv from '@push.rocks/qenv';
import * as smartlog from '@push.rocks/smartlog';
import * as smartntml from '@push.rocks/smartntml';
export {
qenv,
smartlog,
smartntml,
}