@nsshunt/stsfhirclient 1.0.47 → 1.0.49

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.
@@ -5026,6 +5026,7 @@ class FhirSocketClient {
5026
5026
  __privateAdd(this, _info, (message) => defaultLogger.info(message));
5027
5027
  __privateAdd(this, _SetupWSSClient, async (clientName, joinRooms) => {
5028
5028
  const cstr = `${__privateGet(this, _options2).fhirServerEndpoint}/nsstsfhir/`;
5029
+ console.log(chalk.yellow(`FhirSocketClient:#SetupWSSClient(): Socket connection string: [${cstr}]`));
5029
5030
  __privateGet(this, _socketUtils).SetupClientSideSocket(
5030
5031
  __privateGet(this, _options2).socketClientName,
5031
5032
  // 'ststestrunner',
@@ -5047,7 +5048,23 @@ class FhirSocketClient {
5047
5048
  socket.emit("__STSjoinRoom", joinRooms);
5048
5049
  }
5049
5050
  });
5051
+ __publicField(this, "WaitForSocketConnected", async () => {
5052
+ if (this.socket.connected === true) {
5053
+ return;
5054
+ }
5055
+ let connected = false;
5056
+ while (!connected) {
5057
+ console.log(chalk.gray(`WaitForSocketConnected(): Waiting for socket connection ...`));
5058
+ const socketRetVal = this.socket;
5059
+ if (socketRetVal.connected === true) {
5060
+ connected = true;
5061
+ break;
5062
+ }
5063
+ await Sleep(100);
5064
+ }
5065
+ });
5050
5066
  __publicField(this, "CreateResource", async (resource, domainResource) => {
5067
+ await this.WaitForSocketConnected();
5051
5068
  const promCreate = () => {
5052
5069
  const request = {
5053
5070
  headers: {
@@ -5070,6 +5087,7 @@ class FhirSocketClient {
5070
5087
  return promCreate();
5071
5088
  });
5072
5089
  __publicField(this, "CreateResources", async (resource, domainResources) => {
5090
+ await this.WaitForSocketConnected();
5073
5091
  const promCreate = () => {
5074
5092
  const request = {
5075
5093
  headers: {
@@ -5092,6 +5110,7 @@ class FhirSocketClient {
5092
5110
  return (await promCreate()).value;
5093
5111
  });
5094
5112
  __publicField(this, "GetResource", async (resource, resourceId) => {
5113
+ await this.WaitForSocketConnected();
5095
5114
  const promGet = () => {
5096
5115
  const request = {
5097
5116
  headers: {
@@ -5116,6 +5135,7 @@ class FhirSocketClient {
5116
5135
  return promGet();
5117
5136
  });
5118
5137
  __publicField(this, "GetResources", async (resource, searchParams) => {
5138
+ await this.WaitForSocketConnected();
5119
5139
  const promGet = () => {
5120
5140
  const request = {
5121
5141
  headers: {
@@ -5138,6 +5158,7 @@ class FhirSocketClient {
5138
5158
  return (await promGet()).value;
5139
5159
  });
5140
5160
  __publicField(this, "UpdateResource", async (resource, domainResource) => {
5161
+ await this.WaitForSocketConnected();
5141
5162
  const promCreate = () => {
5142
5163
  const request = {
5143
5164
  headers: {
@@ -5162,6 +5183,7 @@ class FhirSocketClient {
5162
5183
  return (await promCreate()).value;
5163
5184
  });
5164
5185
  __publicField(this, "UpdateResources", async (resource, domainResources) => {
5186
+ await this.WaitForSocketConnected();
5165
5187
  const promCreate = () => {
5166
5188
  const request = {
5167
5189
  headers: {
@@ -5184,6 +5206,7 @@ class FhirSocketClient {
5184
5206
  return (await promCreate()).value;
5185
5207
  });
5186
5208
  __publicField(this, "PatchResource", async (resource, domainResource) => {
5209
+ await this.WaitForSocketConnected();
5187
5210
  const promCreate = () => {
5188
5211
  const request = {
5189
5212
  headers: {
@@ -5208,6 +5231,7 @@ class FhirSocketClient {
5208
5231
  return (await promCreate()).value;
5209
5232
  });
5210
5233
  __publicField(this, "PatchResources", async (resource, domainResources) => {
5234
+ await this.WaitForSocketConnected();
5211
5235
  const promCreate = () => {
5212
5236
  const request = {
5213
5237
  headers: {
@@ -5230,6 +5254,7 @@ class FhirSocketClient {
5230
5254
  return (await promCreate()).value;
5231
5255
  });
5232
5256
  __publicField(this, "DeleteResource", async (resource, resourceId) => {
5257
+ await this.WaitForSocketConnected();
5233
5258
  const promCreate = () => {
5234
5259
  const request = {
5235
5260
  headers: {
@@ -5254,6 +5279,7 @@ class FhirSocketClient {
5254
5279
  return (await promCreate()).value;
5255
5280
  });
5256
5281
  __publicField(this, "DeleteResources", async (resource, domainResource) => {
5282
+ await this.WaitForSocketConnected();
5257
5283
  const prom = () => {
5258
5284
  const delRequest = {
5259
5285
  headers: {