diff --git a/changelog.md b/changelog.md index 6ae1bad..05313ea 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2024-10-05 - 1.1.2 - fix(core) +Fix authorization handling and format code. + +- Resolved the incorrect condition check for 'authorizationStringArg' within the 'init' function. +- Corrected the condition to activate 'debugMode' within the 'init' function. +- Improved code formatting for better readability. + ## 2024-10-05 - 1.1.1 - fix(platformclient) Refactor debug mode checks in SzPlatformClient connectors diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 415e0fb..4e5ec59 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/platformclient', - version: '1.1.1', + version: '1.1.2', description: 'a module that makes it really easy to use the serve.zone platform inside your app' } diff --git a/ts/classes.platformclient.ts b/ts/classes.platformclient.ts index 1385417..90c06f6 100644 --- a/ts/classes.platformclient.ts +++ b/ts/classes.platformclient.ts @@ -21,18 +21,25 @@ export class SzPlatformClient { } public async init(authorizationStringArg?: string) { - if (authorizationStringArg) this.authorizationString = authorizationStringArg; - if (!this.authorizationString) this.authorizationString = process.env.SERVEZONE_PLATFROM_AUTHORIZATION; + if (authorizationStringArg) { + this.authorizationString = authorizationStringArg; + } + if (!this.authorizationString) + this.authorizationString = process.env.SERVEZONE_PLATFROM_AUTHORIZATION; if (!this.authorizationString) throw new Error('authorizationString is required'); - if (authorizationStringArg === 'test') { + if (this.authorizationString === 'test') { this.debugMode = true; + console.log('debug mode activated.'); 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() + ); } private async getConnectionAddress() { const connectionAddress = await this.qenvInstance.getEnvVarOnDemand('SERVEZONE_API_DOMAIN'); return connectionAddress; } -} \ No newline at end of file +} diff --git a/ts/email/classes.smsconnector.ts b/ts/email/classes.smsconnector.ts index 45262e2..acac572 100644 --- a/ts/email/classes.smsconnector.ts +++ b/ts/email/classes.smsconnector.ts @@ -33,6 +33,12 @@ export class SzSmsConnector { public async sendSmsVerifcation( recipientArg: plugins.servezoneInterfaces.platformservice.sms.IRequest_SendVerificationCode['request'] ) { + if (this.platformClientRef.debugMode) { + console.log('sendSmsVerifcation', recipientArg, '123456'); + return '123456'; + } + + const typedrequest = this.platformClientRef.typedsocket.createTypedRequest( 'sendVerificationCode'