//------------------------------------------------------------------ // Proxy Script Generated by Delphi Microservices Container 4.3.20 // Do not modify this code! // Generated at: 2025-04-26 18.15.14 //------------------------------------------------------------------ export class SupervisorServerRPCProxy { __baseUrl = ""; constructor(baseUrl) { this.__baseUrl = baseUrl; } get baseUrl() { return this.__baseUrl; } __getJsonRpcRequest(jsonrpcRequestMethod, params) { let json = this.__getJsonRpcNotification(jsonrpcRequestMethod, params); json["id"] = Math.trunc(Math.random() * 100000); return json; } __getJsonRpcNotification(jsonrpcRequestMethod, params) { return { "jsonrpc": "2.0", "method": jsonrpcRequestMethod, "params": params }; } __internalFetch(type, baseUrl, jsonrpcMethod, params) { let jsonbody = null; if (type === 'notification') { jsonbody = this.__getJsonRpcNotification(jsonrpcMethod, params); } else if (type === 'request') { jsonbody = this.__getJsonRpcRequest(jsonrpcMethod, params); } return fetch(baseUrl, { "method": "POST", "body": JSON.stringify(jsonbody), "headers": { "content-type": "application/json", "accept": "application/json" } }).then(data => { switch (data.status) { case 200: { return data.json(); } case 204: { //no content return null; } default: { return data.json(); } } }); } __jsonRpcResponsePromise(type, baseUrl, method, params) { switch (type) { case "request": { return new Promise((resolve, reject) => { this.__internalFetch('request', this.baseUrl, method, params).then(jsonresp => { if ("result" in jsonresp) { resolve(jsonresp.result) } else if ("error" in jsonresp) { reject(jsonresp.error) } else { throw new Error("Invalid JSON-RPC response"); } }); }) break; } case "notification": { return new Promise((resolve, reject) => { this.__internalFetch('notification', this.baseUrl, method, params).then(jsonresp => { if (jsonresp !== null && "error" in jsonresp) { reject(jsonresp.error); } else { resolve(); } }); }) break; } default: { throw new Error("JSON-RPC message must be 'request' or 'notification' [Actual: '" + type + '"]'); } } } // Following methods are automatically generated // Invokes [function KeepAlive(const Customer: string; const Email: string; const ExpireDate: string; const LicenseLevel: string; const LicenseHash: string; const MachineFingerPrint: string; const Data: TJsonObject): TJsonObject] // Makes DMSContainer shining keepAlive(customer, email, expireDate, licenseLevel, licenseHash, machineFingerPrint, data) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'KeepAlive',{ "customer": customer, "email": email, "expireDate": expireDate, "licenseLevel": licenseLevel, "licenseHash": licenseHash, "machineFingerPrint": machineFingerPrint, "data": data }); } } //end