@nsshunt/stsfhirpg 1.2.40 → 1.2.42

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.
package/dist/index.mjs CHANGED
@@ -6153,6 +6153,19 @@ var PGFhirAccessLayer = class extends TinyEmitter {
6153
6153
  #dbSTSCombo;
6154
6154
  #transactions = {};
6155
6155
  #maxTransactionTime = 6e4;
6156
+ _tables = [
6157
+ "stsresfhir",
6158
+ "stsresfhirver",
6159
+ "stsresfhirlink",
6160
+ "stsresfhirstring",
6161
+ "stsresfhirtoken",
6162
+ "stsresfhirquantity",
6163
+ "stsresfhirnumber",
6164
+ "stsresfhiruri",
6165
+ "stsresfhirdate",
6166
+ "stsresfhircoords",
6167
+ "stsresfhircombo"
6168
+ ];
6156
6169
  constructor(options) {
6157
6170
  super();
6158
6171
  this.#options = options;
@@ -6925,6 +6938,30 @@ var PGFhirAccessLayer = class extends TinyEmitter {
6925
6938
  client.release();
6926
6939
  }
6927
6940
  };
6941
+ VacuumGlobal = async () => {
6942
+ if (!this.#poolManager) {
6943
+ const errorMessage = `PGFhirAccessLayer:VacuumGlobal(): poolManager not set`;
6944
+ this.#options.logger.error(errorMessage);
6945
+ throw new Error(errorMessage);
6946
+ }
6947
+ let client;
6948
+ try {
6949
+ client = await this.#poolManager.connectReadWrite();
6950
+ } catch (error) {
6951
+ const message = `PGFhirAccessLayer:VacuumGlobal(): Connection Error: [${error}]`;
6952
+ this.#options.logger.error(message);
6953
+ throw new Error(message);
6954
+ }
6955
+ try {
6956
+ await client.query("VACUUM ANALYZE");
6957
+ } catch (error) {
6958
+ const message = `PGFhirAccessLayer:VacuumGlobal(): Query Error: [${error}]`;
6959
+ this.#options.logger.error(message);
6960
+ throw new Error(message);
6961
+ } finally {
6962
+ client.release();
6963
+ }
6964
+ };
6928
6965
  Vacuum = async () => {
6929
6966
  if (!this.#poolManager) {
6930
6967
  const errorMessage = `PGFhirAccessLayer:Vacuum(): poolManager not set`;
@@ -6940,7 +6977,7 @@ var PGFhirAccessLayer = class extends TinyEmitter {
6940
6977
  throw new Error(message);
6941
6978
  }
6942
6979
  try {
6943
- await client.query("VACUUM ANALYZE");
6980
+ for (const table of this._tables) await client.query(`VACUUM ANALYZE ${table}`);
6944
6981
  } catch (error) {
6945
6982
  const message = `PGFhirAccessLayer:Vacuum(): Query Error: [${error}]`;
6946
6983
  this.#options.logger.error(message);
@@ -6949,6 +6986,60 @@ var PGFhirAccessLayer = class extends TinyEmitter {
6949
6986
  client.release();
6950
6987
  }
6951
6988
  };
6989
+ DisableAutoVacuum = async () => {
6990
+ if (!this.#poolManager) {
6991
+ const errorMessage = `PGFhirAccessLayer:DisableAutoVacuum(): poolManager not set`;
6992
+ this.#options.logger.error(errorMessage);
6993
+ throw new Error(errorMessage);
6994
+ }
6995
+ let client;
6996
+ try {
6997
+ client = await this.#poolManager.connectReadWrite();
6998
+ } catch (error) {
6999
+ const message = `PGFhirAccessLayer:DisableAutoVacuum(): Connection Error: [${error}]`;
7000
+ this.#options.logger.error(message);
7001
+ throw new Error(message);
7002
+ }
7003
+ try {
7004
+ for (const table of this._tables) await client.query(`
7005
+ ALTER TABLE ${table}
7006
+ SET (autovacuum_enabled = false)
7007
+ `);
7008
+ } catch (error) {
7009
+ const message = `PGFhirAccessLayer:DisableAutoVacuum(): Query Error: [${error}]`;
7010
+ this.#options.logger.error(message);
7011
+ throw new Error(message);
7012
+ } finally {
7013
+ client.release();
7014
+ }
7015
+ };
7016
+ EnableAutoVacuum = async () => {
7017
+ if (!this.#poolManager) {
7018
+ const errorMessage = `PGFhirAccessLayer:EnableAutoVacuum(): poolManager not set`;
7019
+ this.#options.logger.error(errorMessage);
7020
+ throw new Error(errorMessage);
7021
+ }
7022
+ let client;
7023
+ try {
7024
+ client = await this.#poolManager.connectReadWrite();
7025
+ } catch (error) {
7026
+ const message = `PGFhirAccessLayer:EnableAutoVacuum(): Connection Error: [${error}]`;
7027
+ this.#options.logger.error(message);
7028
+ throw new Error(message);
7029
+ }
7030
+ try {
7031
+ for (const table of this._tables) await client.query(`
7032
+ ALTER TABLE ${table}
7033
+ RESET (autovacuum_enabled)
7034
+ `);
7035
+ } catch (error) {
7036
+ const message = `PGFhirAccessLayer:EnableAutoVacuum(): Query Error: [${error}]`;
7037
+ this.#options.logger.error(message);
7038
+ throw new Error(message);
7039
+ } finally {
7040
+ client.release();
7041
+ }
7042
+ };
6952
7043
  };
6953
7044
  //#endregion
6954
7045
  export { DBSearchIndex, FHIRDateUtils, PGFhirAccessLayer, ResourceHelper, hashReferenceParam, hashStringParam, hashTokenParam, hashUriParam, initHash, normalizeStringParam, xxhash64Signed };