diff --git a/package-lock.json b/package-lock.json index dedd040..ae57358 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@ofs-users/plugin", - "version": "1.5.0", + "version": "1.5.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@ofs-users/plugin", - "version": "1.5.0", + "version": "1.5.2", "license": "UPL-1.0", "dependencies": { "@ofs-users/proxy": "^1.9.0" diff --git a/package.json b/package.json index c82a8c9..2a50cdf 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ ], "name": "@ofs-users/plugin", "type": "module", - "version": "1.5.0", + "version": "1.5.2", "description": "Oracle Field Service plugin base code", "main": "dist/ofs-plugin.es.js", "module": "dist/ofs-plugin.es.js", diff --git a/src/main.ts b/src/main.ts index ac0ca14..4b2f343 100644 --- a/src/main.ts +++ b/src/main.ts @@ -100,17 +100,19 @@ export abstract class OFSPlugin { * @returns */ private async _getWebMessage(message: MessageEvent): Promise { - console.log(`${this._tag}: Message received:`, message.data); - console.log(`${this._tag}: Coming from ${message.origin}`); // Validate that it is a valid OFS message var parsed_message = OFSMessage.parse(message.data); + console.log(`${this._tag}: Message received - method: ${parsed_message.method}`); + console.log(`${this._tag}: Coming from ${message.origin}`); switch (parsed_message.method) { case "init": + console.debug(`${this._tag}: Processing init message`); this._storeInitData(parsed_message as OFSInitMessage); this._init(parsed_message); break; case "open": + console.debug(`${this._tag}: Processing open message`); globalThis.waitForProxy = false; this._createProxy(parsed_message); var iteration: number = 0; @@ -131,17 +133,21 @@ export abstract class OFSPlugin { this.open(parsed_message as OFSOpenMessage); break; case "updateResult": + console.debug(`${this._tag}: Processing updateResult message`); this.updateResult(parsed_message); break; case "callProcedureResult": + console.debug(`${this._tag}: Processing callProcedureResult - callId: ${(parsed_message as OFSCallProcedureResultMessage).callId}`); this._callProcedureResult( parsed_message as OFSCallProcedureResultMessage ); break; case "wakeup": + console.debug(`${this._tag}: Processing wakeup message`); this.wakeup(parsed_message); break; case "error": + console.debug(`${this._tag}: Processing error message`); this.error(parsed_message); break; case "no method": @@ -197,11 +203,7 @@ export abstract class OFSPlugin { }, }; console.debug( - `${ - this.tag - }. I will request the Token forthe application ${applicationKey} with this message ${JSON.stringify( - callProcedureData - )}` + `${this.tag}. Requesting token for application ${applicationKey}` ); this.callProcedure(callProcedureData); globalThis.waitForProxy = true; @@ -389,11 +391,7 @@ export abstract class OFSPlugin { token: parsed_message.resultData.token, }; console.debug( - `${ - this.tag - }. I will create the proxy with this data ${JSON.stringify( - OFSCredentials - )}` + `${this.tag}. Creating proxy with provided credentials` ); this._proxy = new OFS(OFSCredentials); globalThis.waitForProxy = false; @@ -401,11 +399,7 @@ export abstract class OFSPlugin { } } else { console.error( - `${ - this.tag - }. Problems processing the Token Response ${JSON.stringify( - parsed_message - )}` + `${this.tag}. Problems processing the Token Response - missing resultData` ); } } else {