UNPKG

som-exp-sdk

Version:

Evaluate the User Expression

42 lines (41 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SDKParams = void 0; class SDKParams { constructor(sdkBody) { this.host = ""; this.stage = ""; this.port = -1; this.baseUrl = ""; this.isHealthy = () => { return (!!this.host && !!this.port); }; this.getStage = () => { return this.stage; }; this.getHost = () => { return this.host; }; this.getPort = () => { return this.port; }; this.getBasePath = () => { return this.baseUrl; }; try { if (sdkBody) { const sdkData = JSON.parse(sdkBody); if (sdkData) { this.host = sdkData.host ? sdkData.host : ""; this.stage = sdkData.stage ? sdkData.stage : ""; this.port = sdkData.port ? sdkData.port : ""; this.baseUrl = sdkData.baseUrl ? sdkData.baseUrl : ""; } } } catch (e) { console.log(`Error while parsing the request. Error is ${e}`); } } } exports.SDKParams = SDKParams;