@nsshunt/stsfhirclient 1.0.55 → 1.0.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
8
8
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
9
  var __privateAdd = (obj, member, value2) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value2);
10
10
  var __privateSet = (obj, member, value2, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value2) : member.set(obj, value2), value2);
11
- var _socketUtils, _id, _options2, _debug, _error, _info, _SetupWSSClient, _OnSocketConnected, _options3, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _stsfhirapiroot, _fhirSocketClient, _LogDebugMessage, _LogErrorMessage, _HandleError, _InvokeResourceAPI, _TestMode, ___InvokeResourceAPI, _BuildQueryString;
11
+ var _socketUtils, _id, _options2, _clientName, _debug, _error, _info, _SetupWSSClient, _OnSocketConnected, _options3, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _stsfhirapiroot, _fhirSocketClient, _LogDebugMessage, _LogErrorMessage, _HandleError, _InvokeResourceAPI, _TestMode, ___InvokeResourceAPI, _BuildQueryString;
12
12
  import axios from "axios";
13
13
  import { defaultLogger, Sleep, STSAxiosConfig } from "@nsshunt/stsutils";
14
14
  const byteToHex = [];
@@ -5024,10 +5024,12 @@ class FhirSocketClient {
5024
5024
  __privateAdd(this, _socketUtils);
5025
5025
  __privateAdd(this, _id, v4());
5026
5026
  __privateAdd(this, _options2);
5027
+ __privateAdd(this, _clientName);
5027
5028
  __privateAdd(this, _debug, (message) => defaultLogger.debug(message));
5028
5029
  __privateAdd(this, _error, (error) => defaultLogger.error(error));
5029
5030
  __privateAdd(this, _info, (message) => defaultLogger.info(message));
5030
5031
  __privateAdd(this, _SetupWSSClient, async (clientName, joinRooms) => {
5032
+ console.log(chalk.yellow(`FhirSocketClient:#SetupWSSClient(): ID: [${__privateGet(this, _id)}] clientName: [${clientName}] Starting ...`));
5031
5033
  const cstr = `${__privateGet(this, _options2).fhirServerEndpoint}/nsstsfhir/`;
5032
5034
  console.log(chalk.yellow(`FhirSocketClient:#SetupWSSClient(): Socket connection string: [${cstr}]`));
5033
5035
  __privateGet(this, _socketUtils).SetupClientSideSocket(
@@ -5036,19 +5038,20 @@ class FhirSocketClient {
5036
5038
  cstr,
5037
5039
  // `https://stscore.stsmda.org:3005/nsstsfhir/` this.#options.ststccendpoint, stsfhir as the namespace
5038
5040
  __privateGet(this, _options2).socketIoCustomPath,
5039
- // '/mynsstsfhir/socket.io/',
5041
+ // '/stsfhirsocket/socket.io/',
5040
5042
  // Connected Callback
5041
5043
  (socket2) => __privateGet(this, _OnSocketConnected).call(this, socket2, clientName, joinRooms),
5042
5044
  // Events Registration
5043
5045
  (socket2) => {
5044
5046
  },
5045
5047
  // Error Callback
5046
- (error) => __privateGet(this, _error).call(this, `${clientName}: SetupClientSideSocket call back: [${error}]`)
5048
+ (error) => __privateGet(this, _error).call(this, `FhirSocketClient:#SetupWSSClient(): Error clientName: [${clientName}]: SetupClientSideSocket call back: Error: [${error}]`)
5047
5049
  );
5050
+ console.log(chalk.yellow(`FhirSocketClient:#SetupWSSClient(): ID: [${__privateGet(this, _id)}] clientName: [${clientName}] Started`));
5048
5051
  });
5049
5052
  // Handle connection logic separately
5050
5053
  __privateAdd(this, _OnSocketConnected, (socket, clientName, joinRooms) => {
5051
- __privateGet(this, _debug).call(this, chalk.green(`${__privateGet(this, _id)} ${clientName}: --> connected`));
5054
+ __privateGet(this, _debug).call(this, chalk.green(`FhirSocketClient:#OnSocketConnected(): ID: [${__privateGet(this, _id)}] clientName: [${clientName}]: --> connected`));
5052
5055
  if (joinRooms.length > 0) {
5053
5056
  socket.emit("__STSjoinRoom", joinRooms);
5054
5057
  }
@@ -5082,6 +5085,7 @@ class FhirSocketClient {
5082
5085
  return new Promise((resolve, reject) => {
5083
5086
  this.socket.timeout(__privateGet(this, _options2).timeout).emit("createFhirResource", resource, request, (err, res) => {
5084
5087
  if (err) {
5088
+ __privateGet(this, _error).call(this, `FhirSocketClient:CreateResource(): ID: [${__privateGet(this, _id)}] clientName: [${__privateGet(this, _clientName)}] Error: [${err}]`);
5085
5089
  reject(err);
5086
5090
  } else {
5087
5091
  resolve(res);
@@ -5105,6 +5109,7 @@ class FhirSocketClient {
5105
5109
  return new Promise((resolve, reject) => {
5106
5110
  this.socket.timeout(__privateGet(this, _options2).timeout).emit("createFhirResources", resource, request, (err, res) => {
5107
5111
  if (err) {
5112
+ __privateGet(this, _error).call(this, `FhirSocketClient:CreateResources(): ID: [${__privateGet(this, _id)}] clientName: [${__privateGet(this, _clientName)}] Error: [${err}]`);
5108
5113
  reject(err);
5109
5114
  } else {
5110
5115
  resolve(res);
@@ -5130,6 +5135,7 @@ class FhirSocketClient {
5130
5135
  return new Promise((resolve, reject) => {
5131
5136
  this.socket.timeout(__privateGet(this, _options2).timeout).emit("getFhirResource", resource, request, (err, res) => {
5132
5137
  if (err) {
5138
+ __privateGet(this, _error).call(this, `FhirSocketClient:GetResource(): ID: [${__privateGet(this, _id)}] clientName: [${__privateGet(this, _clientName)}] Error: [${err}]`);
5133
5139
  reject(err);
5134
5140
  } else {
5135
5141
  resolve(res);
@@ -5153,6 +5159,7 @@ class FhirSocketClient {
5153
5159
  return new Promise((resolve, reject) => {
5154
5160
  this.socket.timeout(__privateGet(this, _options2).timeout).emit("getFhirResources", resource, request, (err, res) => {
5155
5161
  if (err) {
5162
+ __privateGet(this, _error).call(this, `FhirSocketClient:GetResources(): ID: [${__privateGet(this, _id)}] clientName: [${__privateGet(this, _clientName)}] Error: [${err}]`);
5156
5163
  reject(err);
5157
5164
  } else {
5158
5165
  resolve(res);
@@ -5178,6 +5185,7 @@ class FhirSocketClient {
5178
5185
  return new Promise((resolve, reject) => {
5179
5186
  this.socket.timeout(__privateGet(this, _options2).timeout).emit("updateFhirResource", resource, request, (err, res) => {
5180
5187
  if (err) {
5188
+ __privateGet(this, _error).call(this, `FhirSocketClient:UpdateResource(): ID: [${__privateGet(this, _id)}] clientName: [${__privateGet(this, _clientName)}] Error: [${err}]`);
5181
5189
  reject(err);
5182
5190
  } else {
5183
5191
  resolve(res);
@@ -5201,6 +5209,7 @@ class FhirSocketClient {
5201
5209
  return new Promise((resolve, reject) => {
5202
5210
  this.socket.timeout(__privateGet(this, _options2).timeout).emit("updateFhirResources", resource, request, (err, res) => {
5203
5211
  if (err) {
5212
+ __privateGet(this, _error).call(this, `FhirSocketClient:UpdateResources(): ID: [${__privateGet(this, _id)}] clientName: [${__privateGet(this, _clientName)}] Error: [${err}]`);
5204
5213
  reject(err);
5205
5214
  } else {
5206
5215
  resolve(res);
@@ -5226,6 +5235,7 @@ class FhirSocketClient {
5226
5235
  return new Promise((resolve, reject) => {
5227
5236
  this.socket.timeout(__privateGet(this, _options2).timeout).emit("patchFhirResource", resource, request, (err, res) => {
5228
5237
  if (err) {
5238
+ __privateGet(this, _error).call(this, `FhirSocketClient:PatchResource(): ID: [${__privateGet(this, _id)}] clientName: [${__privateGet(this, _clientName)}] Error: [${err}]`);
5229
5239
  reject(err);
5230
5240
  } else {
5231
5241
  resolve(res);
@@ -5249,6 +5259,7 @@ class FhirSocketClient {
5249
5259
  return new Promise((resolve, reject) => {
5250
5260
  this.socket.timeout(__privateGet(this, _options2).timeout).emit("patchFhirResources", resource, request, (err, res) => {
5251
5261
  if (err) {
5262
+ __privateGet(this, _error).call(this, `FhirSocketClient:PatchResources(): ID: [${__privateGet(this, _id)}] clientName: [${__privateGet(this, _clientName)}] Error: [${err}]`);
5252
5263
  reject(err);
5253
5264
  } else {
5254
5265
  resolve(res);
@@ -5274,6 +5285,7 @@ class FhirSocketClient {
5274
5285
  return new Promise((resolve, reject) => {
5275
5286
  this.socket.timeout(__privateGet(this, _options2).timeout).emit("deleteFhirResource", resource, request, (err, res) => {
5276
5287
  if (err) {
5288
+ __privateGet(this, _error).call(this, `FhirSocketClient:DeleteResource(): ID: [${__privateGet(this, _id)}] clientName: [${__privateGet(this, _clientName)}] Error: [${err}]`);
5277
5289
  reject(err);
5278
5290
  } else {
5279
5291
  resolve(res);
@@ -5297,6 +5309,7 @@ class FhirSocketClient {
5297
5309
  return new Promise((resolve, reject) => {
5298
5310
  this.socket.timeout(__privateGet(this, _options2).timeout).emit("deleteFhirResources", resource, delRequest, (err, res) => {
5299
5311
  if (err) {
5312
+ __privateGet(this, _error).call(this, `FhirSocketClient:DeleteResources(): ID: [${__privateGet(this, _id)}] clientName: [${__privateGet(this, _clientName)}] Error: [${err}]`);
5300
5313
  reject(err);
5301
5314
  } else {
5302
5315
  resolve(res);
@@ -5309,6 +5322,7 @@ class FhirSocketClient {
5309
5322
  __privateSet(this, _options2, options);
5310
5323
  __privateSet(this, _socketUtils, new SocketIoClientHelper(__privateGet(this, _options2).socketIoClientHelperOptions));
5311
5324
  const clientName = v4();
5325
+ __privateSet(this, _clientName, clientName);
5312
5326
  __privateGet(this, _SetupWSSClient).call(this, clientName, []);
5313
5327
  }
5314
5328
  get socket() {
@@ -5318,6 +5332,7 @@ class FhirSocketClient {
5318
5332
  _socketUtils = new WeakMap();
5319
5333
  _id = new WeakMap();
5320
5334
  _options2 = new WeakMap();
5335
+ _clientName = new WeakMap();
5321
5336
  _debug = new WeakMap();
5322
5337
  _error = new WeakMap();
5323
5338
  _info = new WeakMap();