@nsshunt/stsfhirpg 1.2.39 → 1.2.41
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.cjs
CHANGED
|
@@ -6180,6 +6180,19 @@ var PGFhirAccessLayer = class extends tiny_emitter.TinyEmitter {
|
|
|
6180
6180
|
#dbSTSCombo;
|
|
6181
6181
|
#transactions = {};
|
|
6182
6182
|
#maxTransactionTime = 6e4;
|
|
6183
|
+
_tables = [
|
|
6184
|
+
"stsresfhir",
|
|
6185
|
+
"stsresfhirver",
|
|
6186
|
+
"stsresfhirlink",
|
|
6187
|
+
"stsresfhirstring",
|
|
6188
|
+
"stsresfhirtoken",
|
|
6189
|
+
"stsresfhirquantity",
|
|
6190
|
+
"stsresfhirnumber",
|
|
6191
|
+
"stsresfhiruri",
|
|
6192
|
+
"stsresfhirdate",
|
|
6193
|
+
"stsresfhircoords",
|
|
6194
|
+
"stsresfhircombo"
|
|
6195
|
+
];
|
|
6183
6196
|
constructor(options) {
|
|
6184
6197
|
super();
|
|
6185
6198
|
this.#options = options;
|
|
@@ -6952,6 +6965,114 @@ var PGFhirAccessLayer = class extends tiny_emitter.TinyEmitter {
|
|
|
6952
6965
|
client.release();
|
|
6953
6966
|
}
|
|
6954
6967
|
};
|
|
6968
|
+
VacuumGlobal = async () => {
|
|
6969
|
+
if (!this.#poolManager) {
|
|
6970
|
+
const errorMessage = `PGFhirAccessLayer:VacuumGlobal(): poolManager not set`;
|
|
6971
|
+
this.#options.logger.error(errorMessage);
|
|
6972
|
+
throw new Error(errorMessage);
|
|
6973
|
+
}
|
|
6974
|
+
let client;
|
|
6975
|
+
try {
|
|
6976
|
+
client = await this.#poolManager.connectReadWrite();
|
|
6977
|
+
} catch (error) {
|
|
6978
|
+
const message = `PGFhirAccessLayer:VacuumGlobal(): Connection Error: [${error}]`;
|
|
6979
|
+
this.#options.logger.error(message);
|
|
6980
|
+
throw new Error(message);
|
|
6981
|
+
}
|
|
6982
|
+
try {
|
|
6983
|
+
await client.query("VACUUM ANALYZE");
|
|
6984
|
+
} catch (error) {
|
|
6985
|
+
const message = `PGFhirAccessLayer:VacuumGlobal(): Query Error: [${error}]`;
|
|
6986
|
+
this.#options.logger.error(message);
|
|
6987
|
+
throw new Error(message);
|
|
6988
|
+
} finally {
|
|
6989
|
+
client.release();
|
|
6990
|
+
}
|
|
6991
|
+
};
|
|
6992
|
+
Vacuum = async () => {
|
|
6993
|
+
if (!this.#poolManager) {
|
|
6994
|
+
const errorMessage = `PGFhirAccessLayer:Vacuum(): poolManager not set`;
|
|
6995
|
+
this.#options.logger.error(errorMessage);
|
|
6996
|
+
throw new Error(errorMessage);
|
|
6997
|
+
}
|
|
6998
|
+
let client;
|
|
6999
|
+
try {
|
|
7000
|
+
client = await this.#poolManager.connectReadWrite();
|
|
7001
|
+
} catch (error) {
|
|
7002
|
+
const message = `PGFhirAccessLayer:Vacuum(): Connection Error: [${error}]`;
|
|
7003
|
+
this.#options.logger.error(message);
|
|
7004
|
+
throw new Error(message);
|
|
7005
|
+
}
|
|
7006
|
+
try {
|
|
7007
|
+
for (const table of this._tables) await client.query(`VACUUM ANALYZE ${table}`);
|
|
7008
|
+
} catch (error) {
|
|
7009
|
+
const message = `PGFhirAccessLayer:Vacuum(): Query Error: [${error}]`;
|
|
7010
|
+
this.#options.logger.error(message);
|
|
7011
|
+
throw new Error(message);
|
|
7012
|
+
} finally {
|
|
7013
|
+
client.release();
|
|
7014
|
+
}
|
|
7015
|
+
};
|
|
7016
|
+
DisableAutoVacuum = async () => {
|
|
7017
|
+
if (!this.#poolManager) {
|
|
7018
|
+
const errorMessage = `PGFhirAccessLayer:DisableAutoVacuum(): 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:DisableAutoVacuum(): 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
|
+
SET (
|
|
7034
|
+
autovacuum_enabled = false,
|
|
7035
|
+
autovacuum_analyze_enabled = false
|
|
7036
|
+
)
|
|
7037
|
+
`);
|
|
7038
|
+
} catch (error) {
|
|
7039
|
+
const message = `PGFhirAccessLayer:DisableAutoVacuum(): Query Error: [${error}]`;
|
|
7040
|
+
this.#options.logger.error(message);
|
|
7041
|
+
throw new Error(message);
|
|
7042
|
+
} finally {
|
|
7043
|
+
client.release();
|
|
7044
|
+
}
|
|
7045
|
+
};
|
|
7046
|
+
EnableAutoVacuum = async () => {
|
|
7047
|
+
if (!this.#poolManager) {
|
|
7048
|
+
const errorMessage = `PGFhirAccessLayer:EnableAutoVacuum(): poolManager not set`;
|
|
7049
|
+
this.#options.logger.error(errorMessage);
|
|
7050
|
+
throw new Error(errorMessage);
|
|
7051
|
+
}
|
|
7052
|
+
let client;
|
|
7053
|
+
try {
|
|
7054
|
+
client = await this.#poolManager.connectReadWrite();
|
|
7055
|
+
} catch (error) {
|
|
7056
|
+
const message = `PGFhirAccessLayer:EnableAutoVacuum(): Connection Error: [${error}]`;
|
|
7057
|
+
this.#options.logger.error(message);
|
|
7058
|
+
throw new Error(message);
|
|
7059
|
+
}
|
|
7060
|
+
try {
|
|
7061
|
+
for (const table of this._tables) await client.query(`
|
|
7062
|
+
ALTER TABLE ${table}
|
|
7063
|
+
RESET (
|
|
7064
|
+
autovacuum_enabled,
|
|
7065
|
+
autovacuum_analyze_enabled
|
|
7066
|
+
)
|
|
7067
|
+
`);
|
|
7068
|
+
} catch (error) {
|
|
7069
|
+
const message = `PGFhirAccessLayer:EnableAutoVacuum(): Query Error: [${error}]`;
|
|
7070
|
+
this.#options.logger.error(message);
|
|
7071
|
+
throw new Error(message);
|
|
7072
|
+
} finally {
|
|
7073
|
+
client.release();
|
|
7074
|
+
}
|
|
7075
|
+
};
|
|
6955
7076
|
};
|
|
6956
7077
|
//#endregion
|
|
6957
7078
|
exports.DBSearchIndex = DBSearchIndex;
|