@nsshunt/stsfhirclient 1.0.48 → 1.0.50

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.
@@ -5048,7 +5048,24 @@ class FhirSocketClient {
5048
5048
  socket.emit("__STSjoinRoom", joinRooms);
5049
5049
  }
5050
5050
  });
5051
+ __publicField(this, "WaitForSocketConnected", async () => {
5052
+ console.log(chalk.gray(`WaitForSocketConnected(): Waiting for socket connection [Start]`));
5053
+ if (this.socket && this.socket.connected === true) {
5054
+ return;
5055
+ }
5056
+ let connected = false;
5057
+ while (!connected) {
5058
+ console.log(chalk.gray(`WaitForSocketConnected(): Waiting for socket connection ...`));
5059
+ const socketRetVal = this.socket;
5060
+ if (socketRetVal && socketRetVal.connected === true) {
5061
+ connected = true;
5062
+ break;
5063
+ }
5064
+ await Sleep(100);
5065
+ }
5066
+ });
5051
5067
  __publicField(this, "CreateResource", async (resource, domainResource) => {
5068
+ await this.WaitForSocketConnected();
5052
5069
  const promCreate = () => {
5053
5070
  const request = {
5054
5071
  headers: {
@@ -5071,6 +5088,7 @@ class FhirSocketClient {
5071
5088
  return promCreate();
5072
5089
  });
5073
5090
  __publicField(this, "CreateResources", async (resource, domainResources) => {
5091
+ await this.WaitForSocketConnected();
5074
5092
  const promCreate = () => {
5075
5093
  const request = {
5076
5094
  headers: {
@@ -5093,6 +5111,7 @@ class FhirSocketClient {
5093
5111
  return (await promCreate()).value;
5094
5112
  });
5095
5113
  __publicField(this, "GetResource", async (resource, resourceId) => {
5114
+ await this.WaitForSocketConnected();
5096
5115
  const promGet = () => {
5097
5116
  const request = {
5098
5117
  headers: {
@@ -5117,6 +5136,7 @@ class FhirSocketClient {
5117
5136
  return promGet();
5118
5137
  });
5119
5138
  __publicField(this, "GetResources", async (resource, searchParams) => {
5139
+ await this.WaitForSocketConnected();
5120
5140
  const promGet = () => {
5121
5141
  const request = {
5122
5142
  headers: {
@@ -5139,6 +5159,7 @@ class FhirSocketClient {
5139
5159
  return (await promGet()).value;
5140
5160
  });
5141
5161
  __publicField(this, "UpdateResource", async (resource, domainResource) => {
5162
+ await this.WaitForSocketConnected();
5142
5163
  const promCreate = () => {
5143
5164
  const request = {
5144
5165
  headers: {
@@ -5163,6 +5184,7 @@ class FhirSocketClient {
5163
5184
  return (await promCreate()).value;
5164
5185
  });
5165
5186
  __publicField(this, "UpdateResources", async (resource, domainResources) => {
5187
+ await this.WaitForSocketConnected();
5166
5188
  const promCreate = () => {
5167
5189
  const request = {
5168
5190
  headers: {
@@ -5185,6 +5207,7 @@ class FhirSocketClient {
5185
5207
  return (await promCreate()).value;
5186
5208
  });
5187
5209
  __publicField(this, "PatchResource", async (resource, domainResource) => {
5210
+ await this.WaitForSocketConnected();
5188
5211
  const promCreate = () => {
5189
5212
  const request = {
5190
5213
  headers: {
@@ -5209,6 +5232,7 @@ class FhirSocketClient {
5209
5232
  return (await promCreate()).value;
5210
5233
  });
5211
5234
  __publicField(this, "PatchResources", async (resource, domainResources) => {
5235
+ await this.WaitForSocketConnected();
5212
5236
  const promCreate = () => {
5213
5237
  const request = {
5214
5238
  headers: {
@@ -5231,6 +5255,7 @@ class FhirSocketClient {
5231
5255
  return (await promCreate()).value;
5232
5256
  });
5233
5257
  __publicField(this, "DeleteResource", async (resource, resourceId) => {
5258
+ await this.WaitForSocketConnected();
5234
5259
  const promCreate = () => {
5235
5260
  const request = {
5236
5261
  headers: {
@@ -5255,6 +5280,7 @@ class FhirSocketClient {
5255
5280
  return (await promCreate()).value;
5256
5281
  });
5257
5282
  __publicField(this, "DeleteResources", async (resource, domainResource) => {
5283
+ await this.WaitForSocketConnected();
5258
5284
  const prom = () => {
5259
5285
  const delRequest = {
5260
5286
  headers: {