Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
edc54f4fc1 | |||
7e721eb48e | |||
965dad9b15 | |||
4a75c109e3 | |||
7d0925ad33 | |||
63700c3754 | |||
274bffb318 | |||
1ed33efec1 | |||
8300532de4 | |||
606d46acf8 |
30
changelog.md
30
changelog.md
@ -1,5 +1,35 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2024-10-04 - 1.1.0 - feat(SzPlatformClient)
|
||||||
|
Add debug mode functionality to SzPlatformClient and SzEmailConnector
|
||||||
|
|
||||||
|
- Introduced a debug mode in SzPlatformClient to handle authorization in test scenarios.
|
||||||
|
- Updated SzEmailConnector to log emails and early return in debug mode for testing purposes.
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
Fix build script configuration and plugins import path
|
||||||
|
|
||||||
|
- Corrected the build script in package.json to include tsfolders parameter
|
||||||
|
- Fixed the import path for plugins in classes.infohtml.ts
|
||||||
|
|
||||||
|
## 2024-10-02 - 1.0.9 - fix(infohtml)
|
||||||
|
Refactor infohtml module and fix import paths
|
||||||
|
|
||||||
|
- Refactored ts_infohtml module.
|
||||||
|
- Fixed incorrect import paths in ts_infohtml module.
|
||||||
|
- Ensured that the InfoHtml class and related templates are properly imported and used.
|
||||||
|
|
||||||
|
## 2024-10-02 - 1.0.8 - fix(core)
|
||||||
|
Maintain dependencies, update metadata
|
||||||
|
|
||||||
|
- No changes detected
|
||||||
|
|
||||||
## 2024-10-02 - 1.0.7 - fix(core)
|
## 2024-10-02 - 1.0.7 - fix(core)
|
||||||
Update dependencies and add logging for email and SMS functions
|
Update dependencies and add logging for email and SMS functions
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@serve.zone/platformclient",
|
"name": "@serve.zone/platformclient",
|
||||||
"version": "1.0.7",
|
"version": "1.1.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"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",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -10,7 +10,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web --allowimplicitany)",
|
"build": "(tsbuild tsfolders --web --allowimplicitany)",
|
||||||
"localPublish": "gitzone commit && pnpm run build && pnpm publish && pnpm publish --access public --registry=\"https://registry.npmjs.org\""
|
"localPublish": "gitzone commit && pnpm run build && pnpm publish && pnpm publish --access public --registry=\"https://registry.npmjs.org\""
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/platformclient',
|
name: '@serve.zone/platformclient',
|
||||||
version: '1.0.7',
|
version: '1.1.0',
|
||||||
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'
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import { SzSmsConnector } from './email/classes.smsconnector.js';
|
|||||||
import * as plugins from './plugins.js';
|
import * as plugins from './plugins.js';
|
||||||
|
|
||||||
export class SzPlatformClient {
|
export class SzPlatformClient {
|
||||||
|
public debugMode = false;
|
||||||
private authorizationString: string;
|
private authorizationString: string;
|
||||||
public typedrouter = new plugins.typedrequest.TypedRouter();
|
public typedrouter = new plugins.typedrequest.TypedRouter();
|
||||||
public typedsocket: plugins.typedsocket.TypedSocket;
|
public typedsocket: plugins.typedsocket.TypedSocket;
|
||||||
@ -19,6 +20,10 @@ export class SzPlatformClient {
|
|||||||
if (authorizationStringArg) this.authorizationString = authorizationStringArg;
|
if (authorizationStringArg) this.authorizationString = authorizationStringArg;
|
||||||
if (!this.authorizationString) this.authorizationString = process.env.SERVEZONE_PLATFROM_AUTHORIZATION;
|
if (!this.authorizationString) this.authorizationString = process.env.SERVEZONE_PLATFROM_AUTHORIZATION;
|
||||||
if (!this.authorizationString) throw new Error('authorizationString is required');
|
if (!this.authorizationString) throw new Error('authorizationString is required');
|
||||||
|
if (authorizationStringArg === 'test') {
|
||||||
|
this.debugMode = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.typedsocket = await plugins.typedsocket.TypedSocket.createClient(this.typedrouter, await this.getConnectionAddress());
|
this.typedsocket = await plugins.typedsocket.TypedSocket.createClient(this.typedrouter, await this.getConnectionAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,13 +13,7 @@ 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 =
|
if (this.platformClientRef.debugMode) {
|
||||||
this.platformClientRef.typedsocket.createTypedRequest<plugins.servezoneInterfaces.platformservice.mta.IRequest_SendEmail>(
|
|
||||||
'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}
|
logger.log('info', `sent email with subject ${optionsArg.title} to ${optionsArg.to}
|
||||||
body:
|
body:
|
||||||
${optionsArg.body.split('\n').map(line => ` ${line}`).join('\n')}
|
${optionsArg.body.split('\n').map(line => ` ${line}`).join('\n')}
|
||||||
@ -27,6 +21,16 @@ export class SzEmailConnector {
|
|||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.platformClientRef.debugMode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const typedRequest =
|
||||||
|
this.platformClientRef.typedsocket.createTypedRequest<plugins.servezoneInterfaces.platformservice.mta.IRequest_SendEmail>(
|
||||||
|
'sendEmail'
|
||||||
|
);
|
||||||
|
const response = await typedRequest.fire(optionsArg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendNotification(optionsArg: { toArg: string; subject: string; text: string }) {}
|
public async sendNotification(optionsArg: { toArg: string; subject: string; text: string }) {}
|
||||||
|
@ -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:
|
||||||
@ -23,6 +18,10 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from '../plugins.js';
|
import * as plugins from './plugins.js';
|
||||||
|
|
||||||
import { simpleInfo } from './template.js';
|
import { simpleInfo } from './template.js';
|
||||||
|
|
5
ts_infohtml/plugins.ts
Normal file
5
ts_infohtml/plugins.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import * as smartntml from '@push.rocks/smartntml';
|
||||||
|
|
||||||
|
export {
|
||||||
|
smartntml,
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from '../plugins.js';
|
import * as plugins from './plugins.js';
|
||||||
import { type IHtmlInfoOptions } from './classes.infohtml.js';
|
import { type IHtmlInfoOptions } from './classes.infohtml.js';
|
||||||
|
|
||||||
export const simpleInfo = async (
|
export const simpleInfo = async (
|
Reference in New Issue
Block a user