@nsshunt/stsfhirclient 1.0.48 → 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.
@@ -5048,7 +5048,23 @@ class FhirSocketClient {
5048
5048
  socket.emit("__STSjoinRoom", joinRooms);
5049
5049
  }
5050
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
+ });
5051
5066
  __publicField(this, "CreateResource", async (resource, domainResource) => {
5067
+ await this.WaitForSocketConnected();
5052
5068
  const promCreate = () => {
5053
5069
  const request = {
5054
5070
  headers: {
@@ -5071,6 +5087,7 @@ class FhirSocketClient {
5071
5087
  return promCreate();
5072
5088
  });
5073
5089
  __publicField(this, "CreateResources", async (resource, domainResources) => {
5090
+ await this.WaitForSocketConnected();
5074
5091
  const promCreate = () => {
5075
5092
  const request = {
5076
5093
  headers: {
@@ -5093,6 +5110,7 @@ class FhirSocketClient {
5093
5110
  return (await promCreate()).value;
5094
5111
  });
5095
5112
  __publicField(this, "GetResource", async (resource, resourceId) => {
5113
+ await this.WaitForSocketConnected();
5096
5114
  const promGet = () => {
5097
5115
  const request = {
5098
5116
  headers: {
@@ -5117,6 +5135,7 @@ class FhirSocketClient {
5117
5135
  return promGet();
5118
5136
  });
5119
5137
  __publicField(this, "GetResources", async (resource, searchParams) => {
5138
+ await this.WaitForSocketConnected();
5120
5139
  const promGet = () => {
5121
5140
  const request = {
5122
5141
  headers: {
@@ -5139,6 +5158,7 @@ class FhirSocketClient {
5139
5158
  return (await promGet()).value;
5140
5159
  });
5141
5160
  __publicField(this, "UpdateResource", async (resource, domainResource) => {
5161
+ await this.WaitForSocketConnected();
5142
5162
  const promCreate = () => {
5143
5163
  const request = {
5144
5164
  headers: {
@@ -5163,6 +5183,7 @@ class FhirSocketClient {
5163
5183
  return (await promCreate()).value;
5164
5184
  });
5165
5185
  __publicField(this, "UpdateResources", async (resource, domainResources) => {
5186
+ await this.WaitForSocketConnected();
5166
5187
  const promCreate = () => {
5167
5188
  const request = {
5168
5189
  headers: {
@@ -5185,6 +5206,7 @@ class FhirSocketClient {
5185
5206
  return (await promCreate()).value;
5186
5207
  });
5187
5208
  __publicField(this, "PatchResource", async (resource, domainResource) => {
5209
+ await this.WaitForSocketConnected();
5188
5210
  const promCreate = () => {
5189
5211
  const request = {
5190
5212
  headers: {
@@ -5209,6 +5231,7 @@ class FhirSocketClient {
5209
5231
  return (await promCreate()).value;
5210
5232
  });
5211
5233
  __publicField(this, "PatchResources", async (resource, domainResources) => {
5234
+ await this.WaitForSocketConnected();
5212
5235
  const promCreate = () => {
5213
5236
  const request = {
5214
5237
  headers: {
@@ -5231,6 +5254,7 @@ class FhirSocketClient {
5231
5254
  return (await promCreate()).value;
5232
5255
  });
5233
5256
  __publicField(this, "DeleteResource", async (resource, resourceId) => {
5257
+ await this.WaitForSocketConnected();
5234
5258
  const promCreate = () => {
5235
5259
  const request = {
5236
5260
  headers: {
@@ -5255,6 +5279,7 @@ class FhirSocketClient {
5255
5279
  return (await promCreate()).value;
5256
5280
  });
5257
5281
  __publicField(this, "DeleteResources", async (resource, domainResource) => {
5282
+ await this.WaitForSocketConnected();
5258
5283
  const prom = () => {
5259
5284
  const delRequest = {
5260
5285
  headers: {