@nsshunt/stsfhirpg 1.2.29 → 1.2.30
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 +841 -439
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +841 -439
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/types/fhir-database/dbsearchindexreference.d.ts.map +1 -1
- package/types/fhir-database/pg/pgfhiraccesslayer.d.ts.map +1 -1
- package/types/fhir-database/pg/pgfhircombo.d.ts +3 -1
- package/types/fhir-database/pg/pgfhircombo.d.ts.map +1 -1
- package/types/fhir-database/pg/pgfhirdate.d.ts +3 -1
- package/types/fhir-database/pg/pgfhirdate.d.ts.map +1 -1
- package/types/fhir-database/pg/pgfhirdbparamtypebase.d.ts +11 -0
- package/types/fhir-database/pg/pgfhirdbparamtypebase.d.ts.map +1 -0
- package/types/fhir-database/pg/pgfhirnumber.d.ts +3 -1
- package/types/fhir-database/pg/pgfhirnumber.d.ts.map +1 -1
- package/types/fhir-database/pg/pgfhirquantity.d.ts +3 -1
- package/types/fhir-database/pg/pgfhirquantity.d.ts.map +1 -1
- package/types/fhir-database/pg/pgfhirresource.d.ts.map +1 -1
- package/types/fhir-database/pg/pgfhirresourcelink.d.ts +3 -1
- package/types/fhir-database/pg/pgfhirresourcelink.d.ts.map +1 -1
- package/types/fhir-database/pg/pgfhirstring.d.ts +3 -1
- package/types/fhir-database/pg/pgfhirstring.d.ts.map +1 -1
- package/types/fhir-database/pg/pgfhirtoken.d.ts +3 -1
- package/types/fhir-database/pg/pgfhirtoken.d.ts.map +1 -1
- package/types/fhir-database/pg/pgfhiruri.d.ts +3 -1
- package/types/fhir-database/pg/pgfhiruri.d.ts.map +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4980,8 +4980,21 @@ var DBSTSResourceVersion = class extends DBSTSFhirDBBase {
|
|
|
4980
4980
|
}
|
|
4981
4981
|
};
|
|
4982
4982
|
//#endregion
|
|
4983
|
+
//#region src/fhir-database/pg/pgfhirdbparamtypebase.ts
|
|
4984
|
+
var DBSTSFhirDBParamTypeBase = class {
|
|
4985
|
+
_options;
|
|
4986
|
+
constructor(options) {
|
|
4987
|
+
this._options = options;
|
|
4988
|
+
}
|
|
4989
|
+
replacer = (_, v) => typeof v === "bigint" ? { __bigint__: v.toString() } : v;
|
|
4990
|
+
reviver = (_, v) => v && v.__bigint__ !== void 0 ? BigInt(v.__bigint__) : v;
|
|
4991
|
+
};
|
|
4992
|
+
//#endregion
|
|
4983
4993
|
//#region src/fhir-database/pg/pgfhirresourcelink.ts
|
|
4984
|
-
var DBSTSResourceLink = class {
|
|
4994
|
+
var DBSTSResourceLink = class extends DBSTSFhirDBParamTypeBase {
|
|
4995
|
+
constructor(options) {
|
|
4996
|
+
super(options);
|
|
4997
|
+
}
|
|
4985
4998
|
async InsertResourceLink(client, data) {
|
|
4986
4999
|
try {
|
|
4987
5000
|
await client.query(`
|
|
@@ -5029,323 +5042,502 @@ var DBSTSResourceLink = class {
|
|
|
5029
5042
|
data.COMPOSITE_HASH_EXACT ? BigInt(data.COMPOSITE_HASH_EXACT) : null
|
|
5030
5043
|
]);
|
|
5031
5044
|
} catch (error) {
|
|
5032
|
-
|
|
5033
|
-
|
|
5045
|
+
const message = `DBSTSResourceLink:InsertResourceLink(): Query Error: [${error}]`;
|
|
5046
|
+
this._options.logger.error(message);
|
|
5047
|
+
throw new Error(message);
|
|
5034
5048
|
}
|
|
5035
5049
|
}
|
|
5036
5050
|
async ReadResourceLinkByResourceIdRecord(client, RES_ID, RES_TYPE) {
|
|
5037
5051
|
try {
|
|
5038
5052
|
return (await client.query(`SELECT * FROM stsresfhirlink WHERE RES_ID = $1 AND RES_TYPE = $2`, [RES_ID, RES_TYPE])).rows;
|
|
5039
5053
|
} catch (error) {
|
|
5040
|
-
|
|
5041
|
-
|
|
5054
|
+
const message = `DBSTSResourceLink:ReadResourceLinkByResourceIdRecord(): Query Error: [${error}]`;
|
|
5055
|
+
this._options.logger.error(message);
|
|
5056
|
+
throw new Error(message);
|
|
5042
5057
|
}
|
|
5043
5058
|
}
|
|
5044
5059
|
async ReadResourceLinkByPIDRecord(client, PID) {
|
|
5045
5060
|
try {
|
|
5046
5061
|
return (await client.query(`SELECT * FROM stsresfhirlink WHERE PID = $1 LIMIT 1`, [PID])).rows[0];
|
|
5047
5062
|
} catch (error) {
|
|
5048
|
-
|
|
5049
|
-
|
|
5063
|
+
const message = `DBSTSResourceLink:ReadResourceLinkByPIDRecord(): Query Error: [${error}]`;
|
|
5064
|
+
this._options.logger.error(message);
|
|
5065
|
+
throw new Error(message);
|
|
5050
5066
|
}
|
|
5051
5067
|
}
|
|
5052
5068
|
async ReadAllResourceLinkRecords(client) {
|
|
5053
5069
|
try {
|
|
5054
5070
|
return (await client.query(`SELECT * FROM stsresfhirlink`)).rows;
|
|
5055
5071
|
} catch (error) {
|
|
5056
|
-
|
|
5057
|
-
|
|
5072
|
+
const message = `DBSTSResourceLink:ReadAllResourceLinkRecords(): Query Error: [${error}]`;
|
|
5073
|
+
this._options.logger.error(message);
|
|
5074
|
+
throw new Error(message);
|
|
5058
5075
|
}
|
|
5059
5076
|
}
|
|
5060
5077
|
async DeleteResourceLinkRecord(client, data) {
|
|
5061
5078
|
try {
|
|
5062
5079
|
await client.query(`DELETE FROM stsresfhirlink WHERE RES_ID = $1 AND RES_TYPE = $2`, [data.RES_ID, data.RES_TYPE]);
|
|
5063
5080
|
} catch (error) {
|
|
5064
|
-
|
|
5065
|
-
|
|
5081
|
+
const message = `DBSTSResourceLink:DeleteResourceLinkRecord(): Query Error: [${error}]`;
|
|
5082
|
+
this._options.logger.error(message);
|
|
5083
|
+
throw new Error(message);
|
|
5066
5084
|
}
|
|
5067
5085
|
}
|
|
5068
5086
|
};
|
|
5069
5087
|
//#endregion
|
|
5070
5088
|
//#region src/fhir-database/pg/pgfhirstring.ts
|
|
5071
|
-
var DBSTSString = class {
|
|
5089
|
+
var DBSTSString = class extends DBSTSFhirDBParamTypeBase {
|
|
5090
|
+
constructor(options) {
|
|
5091
|
+
super(options);
|
|
5092
|
+
}
|
|
5072
5093
|
async InsertRecord(client, data) {
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5094
|
+
try {
|
|
5095
|
+
await client.query(`
|
|
5096
|
+
INSERT INTO stsresfhirstring (
|
|
5097
|
+
PID,
|
|
5098
|
+
PARTITION_ID,
|
|
5099
|
+
PARTITION_DATE,
|
|
5100
|
+
SP_NAME,
|
|
5101
|
+
SP_PARAM_TYPE,
|
|
5102
|
+
RES_ID,
|
|
5103
|
+
RES_TYPE,
|
|
5104
|
+
SP_MISSING,
|
|
5105
|
+
SP_STR,
|
|
5106
|
+
HASH_IDENTITY,
|
|
5107
|
+
HASH_EXACT,
|
|
5108
|
+
SP_VALUE_NORMALIZED,
|
|
5109
|
+
SP_VALUE_EXACT,
|
|
5110
|
+
UPDATED,
|
|
5111
|
+
PATH_FOR_COMP,
|
|
5112
|
+
COMPOSITE,
|
|
5113
|
+
COMPOSITE_HASH_EXACT
|
|
5114
|
+
) VALUES (
|
|
5115
|
+
$1, $2, $3,
|
|
5116
|
+
$4, $5, $6, $7,
|
|
5117
|
+
$8, $9, $10,
|
|
5118
|
+
$11, $12, $13, $14,
|
|
5119
|
+
$15, $16, $17
|
|
5120
|
+
)
|
|
5121
|
+
`, [
|
|
5122
|
+
data.PID,
|
|
5123
|
+
data.PARTITION_ID,
|
|
5124
|
+
data.PARTITION_DATE,
|
|
5125
|
+
data.SP_NAME ?? null,
|
|
5126
|
+
data.SP_PARAM_TYPE,
|
|
5127
|
+
data.RES_ID,
|
|
5128
|
+
data.RES_TYPE ?? null,
|
|
5129
|
+
data.SP_MISSING,
|
|
5130
|
+
data.SP_STR,
|
|
5131
|
+
data.HASH_IDENTITY,
|
|
5132
|
+
data.HASH_EXACT,
|
|
5133
|
+
data.SP_VALUE_NORMALIZED,
|
|
5134
|
+
data.SP_VALUE_EXACT,
|
|
5135
|
+
data.UPDATED,
|
|
5136
|
+
data.PATH_FOR_COMP,
|
|
5137
|
+
data.COMPOSITE,
|
|
5138
|
+
data.COMPOSITE_HASH_EXACT ? BigInt(data.COMPOSITE_HASH_EXACT) : null
|
|
5139
|
+
]);
|
|
5140
|
+
} catch (error) {
|
|
5141
|
+
const message = `DBSTSString:InsertRecord(): Error: [${error}]`;
|
|
5142
|
+
this._options.logger.error(message);
|
|
5143
|
+
throw new Error(message);
|
|
5144
|
+
}
|
|
5118
5145
|
}
|
|
5119
5146
|
async ReadByPIDRecord(client, PID) {
|
|
5120
|
-
|
|
5147
|
+
try {
|
|
5148
|
+
return (await client.query(`SELECT * FROM stsresfhirstring WHERE PID = $1 LIMIT 1`, [PID])).rows[0];
|
|
5149
|
+
} catch (error) {
|
|
5150
|
+
const message = `DBSTSString:ReadByPIDRecord(): Error: [${error}]`;
|
|
5151
|
+
this._options.logger.error(message);
|
|
5152
|
+
throw new Error(message);
|
|
5153
|
+
}
|
|
5121
5154
|
}
|
|
5122
5155
|
async ReadAllRecords(client) {
|
|
5123
|
-
|
|
5156
|
+
try {
|
|
5157
|
+
return (await client.query(`SELECT * FROM stsresfhirstring`)).rows;
|
|
5158
|
+
} catch (error) {
|
|
5159
|
+
const message = `DBSTSString:ReadAllRecords(): Error: [${error}]`;
|
|
5160
|
+
this._options.logger.error(message);
|
|
5161
|
+
throw new Error(message);
|
|
5162
|
+
}
|
|
5124
5163
|
}
|
|
5125
5164
|
#FilterResults(data, results) {
|
|
5126
|
-
|
|
5165
|
+
try {
|
|
5166
|
+
return results.filter((r) => r.SP_NAME === data.SP_NAME && r.RES_TYPE === data.RES_TYPE);
|
|
5167
|
+
} catch (error) {
|
|
5168
|
+
const message = `DBSTSString:#FilterResults(): Error: [${error}]`;
|
|
5169
|
+
this._options.logger.error(message);
|
|
5170
|
+
throw new Error(message);
|
|
5171
|
+
}
|
|
5127
5172
|
}
|
|
5128
5173
|
async ReadByValueNormalized(client, searchString, parameterName, resourceName) {
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5174
|
+
try {
|
|
5175
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5176
|
+
const norm = normalizeStringParam(searchString);
|
|
5177
|
+
const res = await client.query(`SELECT * FROM stsresfhirstring WHERE HASH_IDENTITY = $1 AND SP_VALUE_NORMALIZED LIKE $2`, [hash, norm]);
|
|
5178
|
+
return this.#FilterResults({
|
|
5179
|
+
SP_NAME: parameterName,
|
|
5180
|
+
RES_TYPE: resourceName
|
|
5181
|
+
}, res.rows);
|
|
5182
|
+
} catch (error) {
|
|
5183
|
+
const message = `DBSTSString:ReadByValueNormalized(): Error: [${error}]`;
|
|
5184
|
+
this._options.logger.error(message);
|
|
5185
|
+
throw new Error(message);
|
|
5186
|
+
}
|
|
5136
5187
|
}
|
|
5137
5188
|
async ReadByValueExact(client, data) {
|
|
5138
|
-
|
|
5139
|
-
|
|
5189
|
+
try {
|
|
5190
|
+
const res = await client.query(`SELECT * FROM stsresfhirstring WHERE HASH_EXACT = $1`, [BigInt(data.HASH_EXACT)]);
|
|
5191
|
+
return this.#FilterResults(data, res.rows);
|
|
5192
|
+
} catch (error) {
|
|
5193
|
+
const message = `DBSTSString:ReadByValueExact(): Error: [${error}]`;
|
|
5194
|
+
this._options.logger.error(message);
|
|
5195
|
+
throw new Error(message);
|
|
5196
|
+
}
|
|
5140
5197
|
}
|
|
5141
5198
|
async ReadByResID(client, RES_ID, RES_TYPE) {
|
|
5142
|
-
|
|
5199
|
+
try {
|
|
5200
|
+
return (await client.query(`SELECT * FROM stsresfhirstring WHERE RES_ID = $1 AND RES_TYPE = $2`, [RES_ID, RES_TYPE])).rows;
|
|
5201
|
+
} catch (error) {
|
|
5202
|
+
const message = `DBSTSString:ReadByResID(): Error: [${error}]`;
|
|
5203
|
+
this._options.logger.error(message);
|
|
5204
|
+
throw new Error(message);
|
|
5205
|
+
}
|
|
5143
5206
|
}
|
|
5144
5207
|
async DeleteRecord(client, data) {
|
|
5145
|
-
|
|
5208
|
+
try {
|
|
5209
|
+
await client.query(`DELETE FROM stsresfhirstring WHERE RES_ID = $1 AND RES_TYPE = $2`, [data.RES_ID, data.RES_TYPE]);
|
|
5210
|
+
} catch (error) {
|
|
5211
|
+
const message = `DBSTSString:DeleteRecord(): Error: [${error}]`;
|
|
5212
|
+
this._options.logger.error(message);
|
|
5213
|
+
throw new Error(message);
|
|
5214
|
+
}
|
|
5146
5215
|
}
|
|
5147
5216
|
};
|
|
5148
5217
|
//#endregion
|
|
5149
5218
|
//#region src/fhir-database/pg/pgfhirtoken.ts
|
|
5150
|
-
var DBSTSToken = class {
|
|
5219
|
+
var DBSTSToken = class extends DBSTSFhirDBParamTypeBase {
|
|
5220
|
+
constructor(options) {
|
|
5221
|
+
super(options);
|
|
5222
|
+
}
|
|
5151
5223
|
async InsertRecord(client, data) {
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5224
|
+
try {
|
|
5225
|
+
const text = `
|
|
5226
|
+
INSERT INTO stsresfhirtoken (
|
|
5227
|
+
PID,
|
|
5228
|
+
PARTITION_ID,
|
|
5229
|
+
PARTITION_DATE,
|
|
5230
|
+
SP_NAME,
|
|
5231
|
+
SP_PARAM_TYPE,
|
|
5232
|
+
SP_STR,
|
|
5233
|
+
RES_ID,
|
|
5234
|
+
RES_TYPE,
|
|
5235
|
+
UPDATED,
|
|
5236
|
+
SP_MISSING,
|
|
5237
|
+
HASH_IDENTITY,
|
|
5238
|
+
SP_SYSTEM,
|
|
5239
|
+
SP_TOKEN_TYPE,
|
|
5240
|
+
SP_VALUE,
|
|
5241
|
+
HASH_VALUE,
|
|
5242
|
+
HASH_SYS,
|
|
5243
|
+
HASH_SYS_AND_VALUE,
|
|
5244
|
+
PATH_FOR_COMP,
|
|
5245
|
+
COMPOSITE,
|
|
5246
|
+
COMPOSITE_HASH_EXACT
|
|
5247
|
+
) VALUES (
|
|
5248
|
+
$1, $2, $3, $4, $5, $6,
|
|
5249
|
+
$7, $8, $9, $10, $11, $12,
|
|
5250
|
+
$13, $14, $15, $16, $17,
|
|
5251
|
+
$18, $19, $20
|
|
5252
|
+
)`;
|
|
5253
|
+
const values = [
|
|
5254
|
+
data.PID,
|
|
5255
|
+
data.PARTITION_ID ?? 0,
|
|
5256
|
+
data.PARTITION_DATE ?? 0,
|
|
5257
|
+
data.SP_NAME,
|
|
5258
|
+
data.SP_PARAM_TYPE,
|
|
5259
|
+
data.SP_STR,
|
|
5260
|
+
data.RES_ID,
|
|
5261
|
+
data.RES_TYPE,
|
|
5262
|
+
BigInt(data.UPDATED),
|
|
5263
|
+
data.SP_MISSING,
|
|
5264
|
+
BigInt(data.HASH_IDENTITY),
|
|
5265
|
+
data.SP_SYSTEM,
|
|
5266
|
+
data.SP_TOKEN_TYPE,
|
|
5267
|
+
data.SP_VALUE,
|
|
5268
|
+
data.HASH_VALUE,
|
|
5269
|
+
data.HASH_SYS,
|
|
5270
|
+
data.HASH_SYS_AND_VALUE,
|
|
5271
|
+
data.PATH_FOR_COMP,
|
|
5272
|
+
data.COMPOSITE,
|
|
5273
|
+
data.COMPOSITE_HASH_EXACT ? BigInt(data.COMPOSITE_HASH_EXACT) : null
|
|
5274
|
+
];
|
|
5275
|
+
await client.query(text, values);
|
|
5276
|
+
} catch (error) {
|
|
5277
|
+
const message = `DBSTSToken:InsertRecord(): Error: [${error}]`;
|
|
5278
|
+
this._options.logger.error(message);
|
|
5279
|
+
throw new Error(message);
|
|
5280
|
+
}
|
|
5203
5281
|
}
|
|
5204
5282
|
async DeleteRecord(client, data) {
|
|
5205
|
-
|
|
5283
|
+
try {
|
|
5284
|
+
await client.query(`DELETE FROM stsresfhirtoken WHERE RES_ID = $1 AND RES_TYPE = $2`, [data.RES_ID, data.RES_TYPE]);
|
|
5285
|
+
} catch (error) {
|
|
5286
|
+
const message = `DBSTSToken:DeleteRecord(): Error: [${error}]`;
|
|
5287
|
+
this._options.logger.error(message);
|
|
5288
|
+
throw new Error(message);
|
|
5289
|
+
}
|
|
5206
5290
|
}
|
|
5207
5291
|
async ReadByPIDRecord(client, PID) {
|
|
5208
|
-
|
|
5292
|
+
try {
|
|
5293
|
+
return (await client.query(`SELECT * FROM stsresfhirtoken WHERE PID = $1`, [PID])).rows[0];
|
|
5294
|
+
} catch (error) {
|
|
5295
|
+
const message = `DBSTSToken:ReadByPIDRecord(): Error: [${error}]`;
|
|
5296
|
+
this._options.logger.error(message);
|
|
5297
|
+
throw new Error(message);
|
|
5298
|
+
}
|
|
5209
5299
|
}
|
|
5210
5300
|
async ReadAllRecords(client) {
|
|
5211
|
-
|
|
5301
|
+
try {
|
|
5302
|
+
return (await client.query(`SELECT * FROM stsresfhirtoken`)).rows;
|
|
5303
|
+
} catch (error) {
|
|
5304
|
+
const message = `DBSTSToken:ReadAllRecords(): Error: [${error}]`;
|
|
5305
|
+
this._options.logger.error(message);
|
|
5306
|
+
throw new Error(message);
|
|
5307
|
+
}
|
|
5212
5308
|
}
|
|
5213
5309
|
async ReadByIdentity(client, parameterName, resourceName) {
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5310
|
+
try {
|
|
5311
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5312
|
+
const res = await client.query(`SELECT * FROM stsresfhirtoken WHERE HASH_IDENTITY = $1`, [hash]);
|
|
5313
|
+
return this.#filterResults({
|
|
5314
|
+
SP_NAME: parameterName,
|
|
5315
|
+
RES_TYPE: resourceName
|
|
5316
|
+
}, res.rows);
|
|
5317
|
+
} catch (error) {
|
|
5318
|
+
const message = `DBSTSToken:ReadByIdentity(): Error: [${error}]`;
|
|
5319
|
+
this._options.logger.error(message);
|
|
5320
|
+
throw new Error(message);
|
|
5321
|
+
}
|
|
5220
5322
|
}
|
|
5221
5323
|
async ReadByValue(client, searchValue, parameterName, resourceName) {
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5324
|
+
try {
|
|
5325
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}|${searchValue}`, true);
|
|
5326
|
+
const res = await client.query(`SELECT * FROM stsresfhirtoken WHERE HASH_VALUE = $1`, [hash]);
|
|
5327
|
+
return this.#filterResults({
|
|
5328
|
+
SP_NAME: parameterName,
|
|
5329
|
+
RES_TYPE: resourceName
|
|
5330
|
+
}, res.rows);
|
|
5331
|
+
} catch (error) {
|
|
5332
|
+
const message = `DBSTSToken:ReadByValue(): Error: [${error}]`;
|
|
5333
|
+
this._options.logger.error(message);
|
|
5334
|
+
throw new Error(message);
|
|
5335
|
+
}
|
|
5228
5336
|
}
|
|
5229
5337
|
async ReadBySystem(client, searchSystem, parameterName, resourceName) {
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5338
|
+
try {
|
|
5339
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}|${searchSystem}`, true);
|
|
5340
|
+
const res = await client.query(`SELECT * FROM stsresfhirtoken WHERE HASH_SYS = $1`, [hash]);
|
|
5341
|
+
return this.#filterResults({
|
|
5342
|
+
SP_NAME: parameterName,
|
|
5343
|
+
RES_TYPE: resourceName
|
|
5344
|
+
}, res.rows);
|
|
5345
|
+
} catch (error) {
|
|
5346
|
+
const message = `DBSTSToken:ReadBySystem(): Error: [${error}]`;
|
|
5347
|
+
this._options.logger.error(message);
|
|
5348
|
+
throw new Error(message);
|
|
5349
|
+
}
|
|
5236
5350
|
}
|
|
5237
5351
|
async ReadBySystemAndValue(client, searchSystem, searchValue, parameterName, resourceName) {
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5352
|
+
try {
|
|
5353
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}|${searchSystem}|${searchValue}`, true);
|
|
5354
|
+
const res = await client.query(`SELECT * FROM stsresfhirtoken WHERE HASH_SYS_AND_VALUE = $1`, [hash]);
|
|
5355
|
+
return this.#filterResults({
|
|
5356
|
+
SP_NAME: parameterName,
|
|
5357
|
+
RES_TYPE: resourceName
|
|
5358
|
+
}, res.rows);
|
|
5359
|
+
} catch (error) {
|
|
5360
|
+
const message = `DBSTSToken:ReadBySystemAndValue(): Error: [${error}]`;
|
|
5361
|
+
this._options.logger.error(message);
|
|
5362
|
+
throw new Error(message);
|
|
5363
|
+
}
|
|
5244
5364
|
}
|
|
5245
5365
|
async ReadByResID(client, RES_ID, RES_TYPE) {
|
|
5246
|
-
|
|
5366
|
+
try {
|
|
5367
|
+
return (await client.query(`SELECT * FROM stsresfhirtoken WHERE RES_ID = $1 AND RES_TYPE = $2`, [RES_ID, RES_TYPE])).rows;
|
|
5368
|
+
} catch (error) {
|
|
5369
|
+
const message = `DBSTSToken:ReadByResID(): Error: [${error}]`;
|
|
5370
|
+
this._options.logger.error(message);
|
|
5371
|
+
throw new Error(message);
|
|
5372
|
+
}
|
|
5247
5373
|
}
|
|
5248
5374
|
#filterResults(data, results) {
|
|
5249
|
-
|
|
5375
|
+
try {
|
|
5376
|
+
return results.filter((r) => r.SP_NAME === data.SP_NAME && r.RES_TYPE === data.RES_TYPE);
|
|
5377
|
+
} catch (error) {
|
|
5378
|
+
const message = `DBSTSToken:#filterResults(): Error: [${error}]`;
|
|
5379
|
+
this._options.logger.error(message);
|
|
5380
|
+
throw new Error(message);
|
|
5381
|
+
}
|
|
5250
5382
|
}
|
|
5251
5383
|
};
|
|
5252
5384
|
//#endregion
|
|
5253
5385
|
//#region src/fhir-database/pg/pgfhirquantity.ts
|
|
5254
|
-
var DBSTSQuantity = class {
|
|
5386
|
+
var DBSTSQuantity = class extends DBSTSFhirDBParamTypeBase {
|
|
5387
|
+
constructor(options) {
|
|
5388
|
+
super(options);
|
|
5389
|
+
}
|
|
5255
5390
|
async InsertRecord(client, data) {
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5391
|
+
try {
|
|
5392
|
+
const text = `
|
|
5393
|
+
INSERT INTO stsresfhirquantity (
|
|
5394
|
+
PID,
|
|
5395
|
+
PARTITION_ID,
|
|
5396
|
+
PARTITION_DATE,
|
|
5397
|
+
SP_NAME,
|
|
5398
|
+
SP_PARAM_TYPE,
|
|
5399
|
+
SP_STR,
|
|
5400
|
+
RES_ID,
|
|
5401
|
+
RES_TYPE,
|
|
5402
|
+
UPDATED,
|
|
5403
|
+
SP_MISSING,
|
|
5404
|
+
HASH_IDENTITY,
|
|
5405
|
+
SP_SYSTEM,
|
|
5406
|
+
SP_VALUE,
|
|
5407
|
+
SP_UNITS,
|
|
5408
|
+
HASH_IDENTITY_AND_UNITS,
|
|
5409
|
+
HASH_IDENTITY_SYS_UNITS,
|
|
5410
|
+
PATH_FOR_COMP,
|
|
5411
|
+
COMPOSITE,
|
|
5412
|
+
COMPOSITE_HASH_EXACT
|
|
5413
|
+
) VALUES (
|
|
5414
|
+
$1, $2, $3, $4, $5, $6,
|
|
5415
|
+
$7, $8, $9, $10, $11, $12,
|
|
5416
|
+
$13, $14, $15, $16,
|
|
5417
|
+
$17, $18, $19
|
|
5418
|
+
)`;
|
|
5419
|
+
const values = [
|
|
5420
|
+
data.PID,
|
|
5421
|
+
data.PARTITION_ID,
|
|
5422
|
+
data.PARTITION_DATE,
|
|
5423
|
+
data.SP_NAME,
|
|
5424
|
+
data.SP_PARAM_TYPE,
|
|
5425
|
+
data.SP_STR,
|
|
5426
|
+
data.RES_ID,
|
|
5427
|
+
data.RES_TYPE,
|
|
5428
|
+
BigInt(data.UPDATED),
|
|
5429
|
+
data.SP_MISSING,
|
|
5430
|
+
BigInt(data.HASH_IDENTITY),
|
|
5431
|
+
data.SP_SYSTEM,
|
|
5432
|
+
data.SP_VALUE,
|
|
5433
|
+
data.SP_UNITS,
|
|
5434
|
+
data.HASH_IDENTITY_AND_UNITS,
|
|
5435
|
+
data.HASH_IDENTITY_SYS_UNITS,
|
|
5436
|
+
data.PATH_FOR_COMP,
|
|
5437
|
+
data.COMPOSITE,
|
|
5438
|
+
data.COMPOSITE_HASH_EXACT ? BigInt(data.COMPOSITE_HASH_EXACT) : null
|
|
5439
|
+
];
|
|
5440
|
+
await client.query(text, values);
|
|
5441
|
+
} catch (error) {
|
|
5442
|
+
const message = `DBSTSQuantity:InsertRecord(): Error: [${error}]`;
|
|
5443
|
+
this._options.logger.error(message);
|
|
5444
|
+
throw new Error(message);
|
|
5445
|
+
}
|
|
5305
5446
|
}
|
|
5306
5447
|
async DeleteRecord(client, data) {
|
|
5307
|
-
|
|
5448
|
+
try {
|
|
5449
|
+
await client.query(`DELETE FROM stsresfhirquantity WHERE RES_ID = $1 AND RES_TYPE = $2`, [data.RES_ID, data.RES_TYPE]);
|
|
5450
|
+
} catch (error) {
|
|
5451
|
+
const message = `DBSTSQuantity:DeleteRecord(): Error: [${error}]`;
|
|
5452
|
+
this._options.logger.error(message);
|
|
5453
|
+
throw new Error(message);
|
|
5454
|
+
}
|
|
5308
5455
|
}
|
|
5309
5456
|
async ReadByPIDRecord(client, PID) {
|
|
5310
|
-
|
|
5457
|
+
try {
|
|
5458
|
+
return (await client.query(`SELECT * FROM stsresfhirquantity WHERE PID = $1`, [PID])).rows[0];
|
|
5459
|
+
} catch (error) {
|
|
5460
|
+
const message = `DBSTSQuantity:ReadByPIDRecord(): Error: [${error}]`;
|
|
5461
|
+
this._options.logger.error(message);
|
|
5462
|
+
throw new Error(message);
|
|
5463
|
+
}
|
|
5311
5464
|
}
|
|
5312
5465
|
async ReadAllRecords(client) {
|
|
5313
|
-
|
|
5466
|
+
try {
|
|
5467
|
+
return (await client.query(`SELECT * FROM stsresfhirquantity`)).rows;
|
|
5468
|
+
} catch (error) {
|
|
5469
|
+
const message = `DBSTSQuantity:ReadAllRecords(): Error: [${error}]`;
|
|
5470
|
+
this._options.logger.error(message);
|
|
5471
|
+
throw new Error(message);
|
|
5472
|
+
}
|
|
5314
5473
|
}
|
|
5315
5474
|
async ReadByIdentity(client, parameterName, resourceName) {
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5475
|
+
try {
|
|
5476
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5477
|
+
const res = await client.query(`SELECT * FROM stsresfhirquantity WHERE HASH_IDENTITY = $1`, [hash]);
|
|
5478
|
+
return this.#filterResults({
|
|
5479
|
+
SP_NAME: parameterName,
|
|
5480
|
+
RES_TYPE: resourceName
|
|
5481
|
+
}, res.rows);
|
|
5482
|
+
} catch (error) {
|
|
5483
|
+
const message = `DBSTSQuantity:ReadByIdentity(): Error: [${error}]`;
|
|
5484
|
+
this._options.logger.error(message);
|
|
5485
|
+
throw new Error(message);
|
|
5486
|
+
}
|
|
5322
5487
|
}
|
|
5323
5488
|
async ReadByUnits(client, units, searchValue, parameterName, resourceName) {
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5489
|
+
try {
|
|
5490
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}|${units}`, true);
|
|
5491
|
+
const res = await client.query(`SELECT * FROM stsresfhirquantity WHERE HASH_IDENTITY_AND_UNITS = $1 AND SP_VALUE = $2`, [hash, searchValue]);
|
|
5492
|
+
return this.#filterResults({
|
|
5493
|
+
SP_NAME: parameterName,
|
|
5494
|
+
RES_TYPE: resourceName
|
|
5495
|
+
}, res.rows);
|
|
5496
|
+
} catch (error) {
|
|
5497
|
+
const message = `DBSTSQuantity:ReadByUnits(): Error: [${error}]`;
|
|
5498
|
+
this._options.logger.error(message);
|
|
5499
|
+
throw new Error(message);
|
|
5500
|
+
}
|
|
5330
5501
|
}
|
|
5331
5502
|
async ReadBySystemAndUnits(client, searchSystem, units, searchValue, parameterName, resourceName) {
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5503
|
+
try {
|
|
5504
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}|${searchSystem}|${units}`, true);
|
|
5505
|
+
const res = await client.query(`SELECT * FROM stsresfhirquantity WHERE HASH_IDENTITY_SYS_UNITS = $1 AND SP_VALUE = $2`, [hash, searchValue]);
|
|
5506
|
+
return this.#filterResults({
|
|
5507
|
+
SP_NAME: parameterName,
|
|
5508
|
+
RES_TYPE: resourceName
|
|
5509
|
+
}, res.rows);
|
|
5510
|
+
} catch (error) {
|
|
5511
|
+
const message = `DBSTSQuantity:ReadBySystemAndUnits(): Error: [${error}]`;
|
|
5512
|
+
this._options.logger.error(message);
|
|
5513
|
+
throw new Error(message);
|
|
5514
|
+
}
|
|
5338
5515
|
}
|
|
5339
5516
|
async ReadByResID(client, RES_ID, RES_TYPE) {
|
|
5340
|
-
|
|
5517
|
+
try {
|
|
5518
|
+
return (await client.query(`SELECT * FROM stsresfhirquantity WHERE RES_ID = $1 AND RES_TYPE = $2`, [RES_ID, RES_TYPE])).rows;
|
|
5519
|
+
} catch (error) {
|
|
5520
|
+
const message = `DBSTSQuantity:ReadByResID(): Error: [${error}]`;
|
|
5521
|
+
this._options.logger.error(message);
|
|
5522
|
+
throw new Error(message);
|
|
5523
|
+
}
|
|
5341
5524
|
}
|
|
5342
5525
|
#filterResults(data, results) {
|
|
5343
|
-
|
|
5526
|
+
try {
|
|
5527
|
+
return results.filter((r) => r.SP_NAME === data.SP_NAME && r.RES_TYPE === data.RES_TYPE);
|
|
5528
|
+
} catch (error) {
|
|
5529
|
+
const message = `DBSTSQuantity:#filterResults(): Error: [${error}]`;
|
|
5530
|
+
this._options.logger.error(message);
|
|
5531
|
+
throw new Error(message);
|
|
5532
|
+
}
|
|
5344
5533
|
}
|
|
5345
5534
|
};
|
|
5346
5535
|
//#endregion
|
|
5347
5536
|
//#region src/fhir-database/pg/pgfhirnumber.ts
|
|
5348
|
-
var DBSTSNumber = class {
|
|
5537
|
+
var DBSTSNumber = class extends DBSTSFhirDBParamTypeBase {
|
|
5538
|
+
constructor(options) {
|
|
5539
|
+
super(options);
|
|
5540
|
+
}
|
|
5349
5541
|
async InsertRecord(client, data) {
|
|
5350
5542
|
try {
|
|
5351
5543
|
const text = `
|
|
@@ -5389,262 +5581,439 @@ var DBSTSNumber = class {
|
|
|
5389
5581
|
];
|
|
5390
5582
|
await client.query(text, values);
|
|
5391
5583
|
} catch (error) {
|
|
5392
|
-
|
|
5584
|
+
const message = `DBSTSNumber:InsertRecord(): Error: [${error}]`;
|
|
5585
|
+
this._options.logger.error(message);
|
|
5586
|
+
throw new Error(message);
|
|
5393
5587
|
}
|
|
5394
5588
|
}
|
|
5395
5589
|
async DeleteRecord(client, data) {
|
|
5396
|
-
|
|
5590
|
+
try {
|
|
5591
|
+
await client.query(`DELETE FROM stsresfhirnumber WHERE RES_ID = $1 AND RES_TYPE = $2`, [data.RES_ID, data.RES_TYPE]);
|
|
5592
|
+
} catch (error) {
|
|
5593
|
+
const message = `DBSTSNumber:DeleteRecord(): Error: [${error}]`;
|
|
5594
|
+
this._options.logger.error(message);
|
|
5595
|
+
throw new Error(message);
|
|
5596
|
+
}
|
|
5397
5597
|
}
|
|
5398
5598
|
async ReadByPIDRecord(client, PID) {
|
|
5399
|
-
|
|
5599
|
+
try {
|
|
5600
|
+
return (await client.query(`SELECT * FROM stsresfhirnumber WHERE PID = $1`, [PID])).rows[0];
|
|
5601
|
+
} catch (error) {
|
|
5602
|
+
const message = `DBSTSNumber:ReadByPIDRecord(): Error: [${error}]`;
|
|
5603
|
+
this._options.logger.error(message);
|
|
5604
|
+
throw new Error(message);
|
|
5605
|
+
}
|
|
5400
5606
|
}
|
|
5401
5607
|
async ReadAllRecords(client) {
|
|
5402
|
-
|
|
5608
|
+
try {
|
|
5609
|
+
return (await client.query(`SELECT * FROM stsresfhirnumber`)).rows;
|
|
5610
|
+
} catch (error) {
|
|
5611
|
+
const message = `DBSTSNumber:ReadAllRecords(): Error: [${error}]`;
|
|
5612
|
+
this._options.logger.error(message);
|
|
5613
|
+
throw new Error(message);
|
|
5614
|
+
}
|
|
5403
5615
|
}
|
|
5404
5616
|
async ReadByIdentity(client, parameterName, resourceName) {
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5617
|
+
try {
|
|
5618
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5619
|
+
const res = await client.query(`SELECT * FROM stsresfhirnumber WHERE HASH_IDENTITY = $1`, [hash]);
|
|
5620
|
+
return this.#filterResults({
|
|
5621
|
+
SP_NAME: parameterName,
|
|
5622
|
+
RES_TYPE: resourceName
|
|
5623
|
+
}, res.rows);
|
|
5624
|
+
} catch (error) {
|
|
5625
|
+
const message = `DBSTSNumber:ReadByIdentity(): Error: [${error}]`;
|
|
5626
|
+
this._options.logger.error(message);
|
|
5627
|
+
throw new Error(message);
|
|
5628
|
+
}
|
|
5411
5629
|
}
|
|
5412
5630
|
async ReadByValue(client, searchValue, parameterName, resourceName) {
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5631
|
+
try {
|
|
5632
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5633
|
+
const res = await client.query(`SELECT * FROM stsresfhirnumber WHERE HASH_IDENTITY = $1 AND SP_VALUE = $2`, [hash, searchValue]);
|
|
5634
|
+
return this.#filterResults({
|
|
5635
|
+
SP_NAME: parameterName,
|
|
5636
|
+
RES_TYPE: resourceName
|
|
5637
|
+
}, res.rows);
|
|
5638
|
+
} catch (error) {
|
|
5639
|
+
const message = `DBSTSNumber:ReadByValue(): Error: [${error}]`;
|
|
5640
|
+
this._options.logger.error(message);
|
|
5641
|
+
throw new Error(message);
|
|
5642
|
+
}
|
|
5419
5643
|
}
|
|
5420
5644
|
async ReadByResID(client, RES_ID, RES_TYPE) {
|
|
5421
|
-
|
|
5645
|
+
try {
|
|
5646
|
+
return (await client.query(`SELECT * FROM stsresfhirnumber WHERE RES_ID = $1 AND RES_TYPE = $2`, [RES_ID, RES_TYPE])).rows;
|
|
5647
|
+
} catch (error) {
|
|
5648
|
+
const message = `DBSTSNumber:ReadByResID(): Error: [${error}]`;
|
|
5649
|
+
this._options.logger.error(message);
|
|
5650
|
+
throw new Error(message);
|
|
5651
|
+
}
|
|
5422
5652
|
}
|
|
5423
5653
|
#filterResults(data, results) {
|
|
5424
|
-
|
|
5654
|
+
try {
|
|
5655
|
+
return results.filter((r) => r.SP_NAME === data.SP_NAME && r.RES_TYPE === data.RES_TYPE);
|
|
5656
|
+
} catch (error) {
|
|
5657
|
+
const message = `DBSTSNumber:#filterResults(): Error: [${error}]`;
|
|
5658
|
+
this._options.logger.error(message);
|
|
5659
|
+
throw new Error(message);
|
|
5660
|
+
}
|
|
5425
5661
|
}
|
|
5426
5662
|
};
|
|
5427
5663
|
//#endregion
|
|
5428
5664
|
//#region src/fhir-database/pg/pgfhirdate.ts
|
|
5429
|
-
var DBSTSDate = class {
|
|
5665
|
+
var DBSTSDate = class extends DBSTSFhirDBParamTypeBase {
|
|
5666
|
+
constructor(options) {
|
|
5667
|
+
super(options);
|
|
5668
|
+
}
|
|
5430
5669
|
async InsertRecord(client, data) {
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5670
|
+
try {
|
|
5671
|
+
const text = `
|
|
5672
|
+
INSERT INTO stsresfhirdate (
|
|
5673
|
+
PID,
|
|
5674
|
+
PARTITION_ID,
|
|
5675
|
+
PARTITION_DATE,
|
|
5676
|
+
SP_NAME,
|
|
5677
|
+
SP_PARAM_TYPE,
|
|
5678
|
+
SP_STR,
|
|
5679
|
+
RES_ID,
|
|
5680
|
+
RES_TYPE,
|
|
5681
|
+
UPDATED,
|
|
5682
|
+
SP_MISSING,
|
|
5683
|
+
HASH_IDENTITY,
|
|
5684
|
+
SP_VALUE_LOW,
|
|
5685
|
+
SP_VALUE_HIGH,
|
|
5686
|
+
SP_VALUE_LOW_DATE_ORDINAL,
|
|
5687
|
+
SP_VALUE_HIGH_DATE_ORDINAL,
|
|
5688
|
+
PATH_FOR_COMP,
|
|
5689
|
+
COMPOSITE,
|
|
5690
|
+
COMPOSITE_HASH_EXACT
|
|
5691
|
+
) VALUES (
|
|
5692
|
+
$1, $2, $3, $4, $5, $6,
|
|
5693
|
+
$7, $8, $9, $10, $11, $12,
|
|
5694
|
+
$13, $14, $15,
|
|
5695
|
+
$16, $17, $18
|
|
5696
|
+
)`;
|
|
5697
|
+
const values = [
|
|
5698
|
+
data.PID,
|
|
5699
|
+
data.PARTITION_ID ?? 0,
|
|
5700
|
+
data.PARTITION_DATE ?? 0,
|
|
5701
|
+
data.SP_NAME,
|
|
5702
|
+
data.SP_PARAM_TYPE,
|
|
5703
|
+
data.SP_STR,
|
|
5704
|
+
data.RES_ID,
|
|
5705
|
+
data.RES_TYPE,
|
|
5706
|
+
BigInt(data.UPDATED),
|
|
5707
|
+
data.SP_MISSING,
|
|
5708
|
+
BigInt(data.HASH_IDENTITY),
|
|
5709
|
+
data.SP_VALUE_LOW ? data.SP_VALUE_LOW.toJSDate() : null,
|
|
5710
|
+
data.SP_VALUE_HIGH ? data.SP_VALUE_HIGH.toJSDate() : null,
|
|
5711
|
+
data.SP_VALUE_LOW_DATE_ORDINAL,
|
|
5712
|
+
data.SP_VALUE_HIGH_DATE_ORDINAL,
|
|
5713
|
+
data.PATH_FOR_COMP,
|
|
5714
|
+
data.COMPOSITE,
|
|
5715
|
+
data.COMPOSITE_HASH_EXACT ? BigInt(data.COMPOSITE_HASH_EXACT) : null
|
|
5716
|
+
];
|
|
5717
|
+
await client.query(text, values);
|
|
5718
|
+
} catch (error) {
|
|
5719
|
+
const message = `DBSTSDate:InsertRecord(): Error: [${error}]`;
|
|
5720
|
+
this._options.logger.error(message);
|
|
5721
|
+
throw new Error(message);
|
|
5722
|
+
}
|
|
5478
5723
|
}
|
|
5479
5724
|
async DeleteRecord(client, data) {
|
|
5480
|
-
|
|
5725
|
+
try {
|
|
5726
|
+
await client.query(`DELETE FROM stsresfhirdate WHERE RES_ID = $1 AND RES_TYPE = $2`, [data.RES_ID, data.RES_TYPE]);
|
|
5727
|
+
} catch (error) {
|
|
5728
|
+
const message = `DBSTSDate:DeleteRecord(): Error: [${error}]`;
|
|
5729
|
+
this._options.logger.error(message);
|
|
5730
|
+
throw new Error(message);
|
|
5731
|
+
}
|
|
5481
5732
|
}
|
|
5482
5733
|
async ReadByPIDRecord(client, PID) {
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
if (res.rows
|
|
5486
|
-
|
|
5734
|
+
try {
|
|
5735
|
+
const res = await client.query(`SELECT * FROM stsresfhirdate WHERE PID = $1`, [PID]);
|
|
5736
|
+
if (res.rows && res.rows.length === 1) {
|
|
5737
|
+
if (res.rows[0].sp_value_high !== null) res.rows[0].sp_value_high = DateTime.fromJSDate(res.rows[0].sp_value_high);
|
|
5738
|
+
if (res.rows[0].sp_value_low !== null) res.rows[0].sp_value_low = DateTime.fromJSDate(res.rows[0].sp_value_low);
|
|
5739
|
+
}
|
|
5740
|
+
return res.rows[0];
|
|
5741
|
+
} catch (error) {
|
|
5742
|
+
const message = `DBSTSDate:ReadByPIDRecord(): Error: [${error}]`;
|
|
5743
|
+
this._options.logger.error(message);
|
|
5744
|
+
throw new Error(message);
|
|
5487
5745
|
}
|
|
5488
|
-
return res.rows[0];
|
|
5489
5746
|
}
|
|
5490
5747
|
async ReadAllRecords(client) {
|
|
5491
|
-
|
|
5748
|
+
try {
|
|
5749
|
+
return (await client.query(`SELECT * FROM stsresfhirdate`)).rows;
|
|
5750
|
+
} catch (error) {
|
|
5751
|
+
const message = `DBSTSDate:ReadAllRecords(): Error: [${error}]`;
|
|
5752
|
+
this._options.logger.error(message);
|
|
5753
|
+
throw new Error(message);
|
|
5754
|
+
}
|
|
5492
5755
|
}
|
|
5493
5756
|
async ReadByIdentity(client, parameterName, resourceName) {
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5757
|
+
try {
|
|
5758
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5759
|
+
const res = await client.query(`SELECT * FROM stsresfhirdate WHERE HASH_IDENTITY = $1`, [hash]);
|
|
5760
|
+
return this.#filterResults({
|
|
5761
|
+
SP_NAME: parameterName,
|
|
5762
|
+
RES_TYPE: resourceName
|
|
5763
|
+
}, res.rows);
|
|
5764
|
+
} catch (error) {
|
|
5765
|
+
const message = `DBSTSDate:ReadByIdentity(): Error: [${error}]`;
|
|
5766
|
+
this._options.logger.error(message);
|
|
5767
|
+
throw new Error(message);
|
|
5768
|
+
}
|
|
5500
5769
|
}
|
|
5501
5770
|
async ReadByDateTime(client, SP_VALUE_LOW, SP_VALUE_HIGH, parameterName, resourceName) {
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5771
|
+
try {
|
|
5772
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5773
|
+
const res = await client.query(`SELECT * FROM stsresfhirdate WHERE HASH_IDENTITY = $1 AND SP_VALUE_LOW >= $2 AND SP_VALUE_HIGH <= $3`, [
|
|
5774
|
+
hash,
|
|
5775
|
+
SP_VALUE_LOW,
|
|
5776
|
+
SP_VALUE_HIGH
|
|
5777
|
+
]);
|
|
5778
|
+
return this.#filterResults({
|
|
5779
|
+
SP_NAME: parameterName,
|
|
5780
|
+
RES_TYPE: resourceName
|
|
5781
|
+
}, res.rows);
|
|
5782
|
+
} catch (error) {
|
|
5783
|
+
const message = `DBSTSDate:ReadByDateTime(): Error: [${error}]`;
|
|
5784
|
+
this._options.logger.error(message);
|
|
5785
|
+
throw new Error(message);
|
|
5786
|
+
}
|
|
5512
5787
|
}
|
|
5513
5788
|
async ReadByDateTimeLow(client, SP_VALUE_LOW, parameterName, resourceName) {
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5789
|
+
try {
|
|
5790
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5791
|
+
const res = await client.query(`SELECT * FROM stsresfhirdate WHERE HASH_IDENTITY = $1 AND SP_VALUE_LOW >= $2`, [hash, SP_VALUE_LOW]);
|
|
5792
|
+
return this.#filterResults({
|
|
5793
|
+
SP_NAME: parameterName,
|
|
5794
|
+
RES_TYPE: resourceName
|
|
5795
|
+
}, res.rows);
|
|
5796
|
+
} catch (error) {
|
|
5797
|
+
const message = `DBSTSDate:ReadByDateTimeLow(): Error: [${error}]`;
|
|
5798
|
+
this._options.logger.error(message);
|
|
5799
|
+
throw new Error(message);
|
|
5800
|
+
}
|
|
5520
5801
|
}
|
|
5521
5802
|
async ReadByDateTimeHigh(client, SP_VALUE_HIGH, parameterName, resourceName) {
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5803
|
+
try {
|
|
5804
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5805
|
+
const res = await client.query(`SELECT * FROM stsresfhirdate WHERE HASH_IDENTITY = $1 AND SP_VALUE_HIGH <= $2`, [hash, SP_VALUE_HIGH]);
|
|
5806
|
+
return this.#filterResults({
|
|
5807
|
+
SP_NAME: parameterName,
|
|
5808
|
+
RES_TYPE: resourceName
|
|
5809
|
+
}, res.rows);
|
|
5810
|
+
} catch (error) {
|
|
5811
|
+
const message = `DBSTSDate:ReadByDateTimeHigh(): Error: [${error}]`;
|
|
5812
|
+
this._options.logger.error(message);
|
|
5813
|
+
throw new Error(message);
|
|
5814
|
+
}
|
|
5528
5815
|
}
|
|
5529
5816
|
async ReadByDateOrdinal(client, SP_VALUE_LOW_DATE_ORDINAL, SP_VALUE_HIGH_DATE_ORDINAL, parameterName, resourceName) {
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5817
|
+
try {
|
|
5818
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5819
|
+
const res = await client.query(`SELECT * FROM stsresfhirdate WHERE HASH_IDENTITY = $1 AND SP_VALUE_LOW_DATE_ORDINAL >= $2 AND SP_VALUE_HIGH_DATE_ORDINAL <= $3`, [
|
|
5820
|
+
hash,
|
|
5821
|
+
SP_VALUE_LOW_DATE_ORDINAL,
|
|
5822
|
+
SP_VALUE_HIGH_DATE_ORDINAL
|
|
5823
|
+
]);
|
|
5824
|
+
return this.#filterResults({
|
|
5825
|
+
SP_NAME: parameterName,
|
|
5826
|
+
RES_TYPE: resourceName
|
|
5827
|
+
}, res.rows);
|
|
5828
|
+
} catch (error) {
|
|
5829
|
+
const message = `DBSTSDate:ReadByDateOrdinal(): Error: [${error}]`;
|
|
5830
|
+
this._options.logger.error(message);
|
|
5831
|
+
throw new Error(message);
|
|
5832
|
+
}
|
|
5540
5833
|
}
|
|
5541
5834
|
async ReadByDateOrdinalLow(client, SP_VALUE_LOW_DATE_ORDINAL, parameterName, resourceName) {
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5835
|
+
try {
|
|
5836
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5837
|
+
const res = await client.query(`SELECT * FROM stsresfhirdate WHERE HASH_IDENTITY = $1 AND SP_VALUE_LOW_DATE_ORDINAL >= $2`, [hash, SP_VALUE_LOW_DATE_ORDINAL]);
|
|
5838
|
+
return this.#filterResults({
|
|
5839
|
+
SP_NAME: parameterName,
|
|
5840
|
+
RES_TYPE: resourceName
|
|
5841
|
+
}, res.rows);
|
|
5842
|
+
} catch (error) {
|
|
5843
|
+
const message = `DBSTSDate:ReadByDateOrdinalLow(): Error: [${error}]`;
|
|
5844
|
+
this._options.logger.error(message);
|
|
5845
|
+
throw new Error(message);
|
|
5846
|
+
}
|
|
5548
5847
|
}
|
|
5549
5848
|
async ReadByDateOrdinalHigh(client, SP_VALUE_HIGH_DATE_ORDINAL, parameterName, resourceName) {
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5849
|
+
try {
|
|
5850
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5851
|
+
const res = await client.query(`SELECT * FROM stsresfhirdate WHERE HASH_IDENTITY = $1 AND SP_VALUE_HIGH_DATE_ORDINAL <= $2`, [hash, SP_VALUE_HIGH_DATE_ORDINAL]);
|
|
5852
|
+
return this.#filterResults({
|
|
5853
|
+
SP_NAME: parameterName,
|
|
5854
|
+
RES_TYPE: resourceName
|
|
5855
|
+
}, res.rows);
|
|
5856
|
+
} catch (error) {
|
|
5857
|
+
const message = `DBSTSDate:ReadByDateOrdinalHigh(): Error: [${error}]`;
|
|
5858
|
+
this._options.logger.error(message);
|
|
5859
|
+
throw new Error(message);
|
|
5860
|
+
}
|
|
5556
5861
|
}
|
|
5557
5862
|
async ReadByResID(client, RES_ID, RES_TYPE) {
|
|
5558
|
-
|
|
5863
|
+
try {
|
|
5864
|
+
return (await client.query(`SELECT * FROM stsresfhirdate WHERE RES_ID = $1 AND RES_TYPE = $2`, [RES_ID, RES_TYPE])).rows;
|
|
5865
|
+
} catch (error) {
|
|
5866
|
+
const message = `DBSTSDate:ReadByResID(): Error: [${error}]`;
|
|
5867
|
+
this._options.logger.error(message);
|
|
5868
|
+
throw new Error(message);
|
|
5869
|
+
}
|
|
5559
5870
|
}
|
|
5560
5871
|
#filterResults(data, results) {
|
|
5561
|
-
|
|
5872
|
+
try {
|
|
5873
|
+
return results.filter((r) => r.SP_NAME === data.SP_NAME && r.RES_TYPE === data.RES_TYPE);
|
|
5874
|
+
} catch (error) {
|
|
5875
|
+
const message = `DBSTSDate:#filterResults(): Error: [${error}]`;
|
|
5876
|
+
this._options.logger.error(message);
|
|
5877
|
+
throw new Error(message);
|
|
5878
|
+
}
|
|
5562
5879
|
}
|
|
5563
5880
|
};
|
|
5564
5881
|
//#endregion
|
|
5565
5882
|
//#region src/fhir-database/pg/pgfhiruri.ts
|
|
5566
|
-
var DBSTSUri = class {
|
|
5883
|
+
var DBSTSUri = class extends DBSTSFhirDBParamTypeBase {
|
|
5884
|
+
constructor(options) {
|
|
5885
|
+
super(options);
|
|
5886
|
+
}
|
|
5567
5887
|
async InsertRecord(client, data) {
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5888
|
+
try {
|
|
5889
|
+
const text = `
|
|
5890
|
+
INSERT INTO stsresfhiruri (
|
|
5891
|
+
PID,
|
|
5892
|
+
PARTITION_ID,
|
|
5893
|
+
PARTITION_DATE,
|
|
5894
|
+
SP_NAME,
|
|
5895
|
+
SP_PARAM_TYPE,
|
|
5896
|
+
SP_STR,
|
|
5897
|
+
RES_ID,
|
|
5898
|
+
RES_TYPE,
|
|
5899
|
+
UPDATED,
|
|
5900
|
+
SP_MISSING,
|
|
5901
|
+
HASH_IDENTITY,
|
|
5902
|
+
SP_URI,
|
|
5903
|
+
HASH_URI,
|
|
5904
|
+
PATH_FOR_COMP,
|
|
5905
|
+
COMPOSITE,
|
|
5906
|
+
COMPOSITE_HASH_EXACT
|
|
5907
|
+
) VALUES (
|
|
5908
|
+
$1, $2, $3, $4, $5, $6,
|
|
5909
|
+
$7, $8, $9, $10, $11, $12, $13,
|
|
5910
|
+
$14, $15, $16
|
|
5911
|
+
)`;
|
|
5912
|
+
const values = [
|
|
5913
|
+
data.PID,
|
|
5914
|
+
data.PARTITION_ID ?? 0,
|
|
5915
|
+
data.PARTITION_DATE ?? 0,
|
|
5916
|
+
data.SP_NAME,
|
|
5917
|
+
data.SP_PARAM_TYPE,
|
|
5918
|
+
data.SP_STR,
|
|
5919
|
+
data.RES_ID,
|
|
5920
|
+
data.RES_TYPE,
|
|
5921
|
+
BigInt(data.UPDATED),
|
|
5922
|
+
data.SP_MISSING,
|
|
5923
|
+
BigInt(data.HASH_IDENTITY),
|
|
5924
|
+
data.SP_URI,
|
|
5925
|
+
data.HASH_URI,
|
|
5926
|
+
data.PATH_FOR_COMP,
|
|
5927
|
+
data.COMPOSITE,
|
|
5928
|
+
data.COMPOSITE_HASH_EXACT ? BigInt(data.COMPOSITE_HASH_EXACT) : null
|
|
5929
|
+
];
|
|
5930
|
+
await client.query(text, values);
|
|
5931
|
+
} catch (error) {
|
|
5932
|
+
const message = `DBSTSUri:InsertRecord(): Error: [${error}]`;
|
|
5933
|
+
this._options.logger.error(message);
|
|
5934
|
+
throw new Error(message);
|
|
5935
|
+
}
|
|
5610
5936
|
}
|
|
5611
5937
|
async DeleteRecord(client, data) {
|
|
5612
|
-
|
|
5938
|
+
try {
|
|
5939
|
+
await client.query(`DELETE FROM stsresfhiruri WHERE RES_ID = $1 AND RES_TYPE = $2`, [data.RES_ID, data.RES_TYPE]);
|
|
5940
|
+
} catch (error) {
|
|
5941
|
+
const message = `DBSTSUri:DeleteRecord(): Error: [${error}]`;
|
|
5942
|
+
this._options.logger.error(message);
|
|
5943
|
+
throw new Error(message);
|
|
5944
|
+
}
|
|
5613
5945
|
}
|
|
5614
5946
|
async ReadByPIDRecord(client, PID) {
|
|
5615
|
-
|
|
5947
|
+
try {
|
|
5948
|
+
return (await client.query(`SELECT * FROM stsresfhiruri WHERE PID = $1`, [PID])).rows[0];
|
|
5949
|
+
} catch (error) {
|
|
5950
|
+
const message = `DBSTSUri:ReadByPIDRecord(): Error: [${error}]`;
|
|
5951
|
+
this._options.logger.error(message);
|
|
5952
|
+
throw new Error(message);
|
|
5953
|
+
}
|
|
5616
5954
|
}
|
|
5617
5955
|
async ReadAllRecords(client) {
|
|
5618
|
-
|
|
5956
|
+
try {
|
|
5957
|
+
return (await client.query(`SELECT * FROM stsresfhiruri`)).rows;
|
|
5958
|
+
} catch (error) {
|
|
5959
|
+
const message = `DBSTSUri:ReadAllRecords(): Error: [${error}]`;
|
|
5960
|
+
this._options.logger.error(message);
|
|
5961
|
+
throw new Error(message);
|
|
5962
|
+
}
|
|
5619
5963
|
}
|
|
5620
5964
|
async ReadByIdentity(client, parameterName, resourceName) {
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5965
|
+
try {
|
|
5966
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
5967
|
+
const res = await client.query(`SELECT * FROM stsresfhiruri WHERE HASH_IDENTITY = $1`, [hash]);
|
|
5968
|
+
return this.#filterResults({
|
|
5969
|
+
SP_NAME: parameterName,
|
|
5970
|
+
RES_TYPE: resourceName
|
|
5971
|
+
}, res.rows);
|
|
5972
|
+
} catch (error) {
|
|
5973
|
+
const message = `DBSTSUri:ReadByIdentity(): Error: [${error}]`;
|
|
5974
|
+
this._options.logger.error(message);
|
|
5975
|
+
throw new Error(message);
|
|
5976
|
+
}
|
|
5627
5977
|
}
|
|
5628
5978
|
async ReadByURI(client, uri, parameterName, resourceName) {
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5979
|
+
try {
|
|
5980
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}|${uri}`, true);
|
|
5981
|
+
const res = await client.query(`SELECT * FROM stsresfhiruri WHERE HASH_URI = $1`, [hash]);
|
|
5982
|
+
return this.#filterResults({
|
|
5983
|
+
SP_NAME: parameterName,
|
|
5984
|
+
RES_TYPE: resourceName
|
|
5985
|
+
}, res.rows);
|
|
5986
|
+
} catch (error) {
|
|
5987
|
+
const message = `DBSTSUri:ReadByURI(): Error: [${error}]`;
|
|
5988
|
+
this._options.logger.error(message);
|
|
5989
|
+
throw new Error(message);
|
|
5990
|
+
}
|
|
5635
5991
|
}
|
|
5636
5992
|
async ReadByResID(client, RES_ID, RES_TYPE) {
|
|
5637
|
-
|
|
5993
|
+
try {
|
|
5994
|
+
return (await client.query(`SELECT * FROM stsresfhiruri WHERE RES_ID = $1 AND RES_TYPE = $2`, [RES_ID, RES_TYPE])).rows;
|
|
5995
|
+
} catch (error) {
|
|
5996
|
+
const message = `DBSTSUri:ReadByResID(): Error: [${error}]`;
|
|
5997
|
+
this._options.logger.error(message);
|
|
5998
|
+
throw new Error(message);
|
|
5999
|
+
}
|
|
5638
6000
|
}
|
|
5639
6001
|
#filterResults(data, results) {
|
|
5640
|
-
|
|
6002
|
+
try {
|
|
6003
|
+
return results.filter((r) => r.SP_NAME === data.SP_NAME && r.RES_TYPE === data.RES_TYPE);
|
|
6004
|
+
} catch (error) {
|
|
6005
|
+
const message = `DBSTSUri:#filterResults(): Error: [${error}]`;
|
|
6006
|
+
this._options.logger.error(message);
|
|
6007
|
+
throw new Error(message);
|
|
6008
|
+
}
|
|
5641
6009
|
}
|
|
5642
6010
|
};
|
|
5643
6011
|
//#endregion
|
|
5644
6012
|
//#region src/fhir-database/pg/pgfhircombo.ts
|
|
5645
|
-
var DBSTSCombo = class {
|
|
5646
|
-
|
|
5647
|
-
|
|
6013
|
+
var DBSTSCombo = class extends DBSTSFhirDBParamTypeBase {
|
|
6014
|
+
constructor(options) {
|
|
6015
|
+
super(options);
|
|
6016
|
+
}
|
|
5648
6017
|
async InsertRecord(client, data) {
|
|
5649
6018
|
try {
|
|
5650
6019
|
const text = `
|
|
@@ -5683,28 +6052,51 @@ var DBSTSCombo = class {
|
|
|
5683
6052
|
];
|
|
5684
6053
|
await client.query(text, values);
|
|
5685
6054
|
} catch (error) {
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
throw error;
|
|
6055
|
+
const message = `DBSTSCombo:InsertRecord(): Error: [${error}]`;
|
|
6056
|
+
this._options.logger.error(message);
|
|
6057
|
+
throw new Error(message);
|
|
5690
6058
|
}
|
|
5691
6059
|
}
|
|
5692
6060
|
async DeleteRecord(client, data) {
|
|
5693
|
-
|
|
6061
|
+
try {
|
|
6062
|
+
await client.query(`DELETE FROM stsresfhircombo WHERE RES_ID = $1 AND RES_TYPE = $2`, [data.RES_ID, data.RES_TYPE]);
|
|
6063
|
+
} catch (error) {
|
|
6064
|
+
const message = `DBSTSCombo:DeleteRecord(): Error: [${error}]`;
|
|
6065
|
+
this._options.logger.error(message);
|
|
6066
|
+
throw new Error(message);
|
|
6067
|
+
}
|
|
5694
6068
|
}
|
|
5695
6069
|
async ReadByPIDRecord(client, PID) {
|
|
5696
|
-
|
|
6070
|
+
try {
|
|
6071
|
+
return (await client.query(`SELECT * FROM stsresfhircombo WHERE PID = $1`, [PID])).rows[0];
|
|
6072
|
+
} catch (error) {
|
|
6073
|
+
const message = `DBSTSCombo:ReadByPIDRecord(): Error: [${error}]`;
|
|
6074
|
+
this._options.logger.error(message);
|
|
6075
|
+
throw new Error(message);
|
|
6076
|
+
}
|
|
5697
6077
|
}
|
|
5698
6078
|
async ReadAllRecords(client) {
|
|
5699
|
-
|
|
6079
|
+
try {
|
|
6080
|
+
return (await client.query(`SELECT * FROM stsresfhircombo`)).rows;
|
|
6081
|
+
} catch (error) {
|
|
6082
|
+
const message = `DBSTSCombo:ReadAllRecords(): Error: [${error}]`;
|
|
6083
|
+
this._options.logger.error(message);
|
|
6084
|
+
throw new Error(message);
|
|
6085
|
+
}
|
|
5700
6086
|
}
|
|
5701
6087
|
async ReadByIdentity(client, parameterName, resourceName) {
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
6088
|
+
try {
|
|
6089
|
+
const hash = hashStringParam(`${parameterName}|${resourceName}`, true);
|
|
6090
|
+
const res = await client.query(`SELECT * FROM stsresfhircombo WHERE HASH_IDENTITY = $1`, [hash]);
|
|
6091
|
+
return this.#filterResults({
|
|
6092
|
+
SP_NAME: parameterName,
|
|
6093
|
+
RES_TYPE: resourceName
|
|
6094
|
+
}, res.rows);
|
|
6095
|
+
} catch (error) {
|
|
6096
|
+
const message = `DBSTSCombo:ReadByIdentity(): Error: [${error}]`;
|
|
6097
|
+
this._options.logger.error(message);
|
|
6098
|
+
throw new Error(message);
|
|
6099
|
+
}
|
|
5708
6100
|
}
|
|
5709
6101
|
async ReadByString(client, stringVal, parameterName, resourceName) {
|
|
5710
6102
|
return [];
|
|
@@ -5728,10 +6120,22 @@ var DBSTSCombo = class {
|
|
|
5728
6120
|
return [];
|
|
5729
6121
|
}
|
|
5730
6122
|
async ReadByResID(client, RES_ID, RES_TYPE) {
|
|
5731
|
-
|
|
6123
|
+
try {
|
|
6124
|
+
return (await client.query(`SELECT * FROM stsresfhircombo WHERE RES_ID = $1 AND RES_TYPE = $2`, [RES_ID, RES_TYPE])).rows;
|
|
6125
|
+
} catch (error) {
|
|
6126
|
+
const message = `DBSTSCombo:ReadByResID(): Error: [${error}]`;
|
|
6127
|
+
this._options.logger.error(message);
|
|
6128
|
+
throw new Error(message);
|
|
6129
|
+
}
|
|
5732
6130
|
}
|
|
5733
6131
|
#filterResults(data, results) {
|
|
5734
|
-
|
|
6132
|
+
try {
|
|
6133
|
+
return results.filter((r) => r.SP_NAME === data.SP_NAME && r.RES_TYPE === data.RES_TYPE);
|
|
6134
|
+
} catch (error) {
|
|
6135
|
+
const message = `DBSTSCombo:#filterResults(): Error: [${error}]`;
|
|
6136
|
+
this._options.logger.error(message);
|
|
6137
|
+
throw new Error(message);
|
|
6138
|
+
}
|
|
5735
6139
|
}
|
|
5736
6140
|
};
|
|
5737
6141
|
//#endregion
|
|
@@ -5753,8 +6157,6 @@ var PGFhirAccessLayer = class extends TinyEmitter {
|
|
|
5753
6157
|
#dbSTSCombo;
|
|
5754
6158
|
#transactions = {};
|
|
5755
6159
|
#maxTransactionTime = 6e4;
|
|
5756
|
-
#replacer = (_, v) => typeof v === "bigint" ? { __bigint__: v.toString() } : v;
|
|
5757
|
-
#reviver = (_, v) => v && v.__bigint__ !== void 0 ? BigInt(v.__bigint__) : v;
|
|
5758
6160
|
constructor(options) {
|
|
5759
6161
|
super();
|
|
5760
6162
|
this.#options = options;
|
|
@@ -5771,14 +6173,14 @@ var PGFhirAccessLayer = class extends TinyEmitter {
|
|
|
5771
6173
|
poolManager: this.#poolManager
|
|
5772
6174
|
});
|
|
5773
6175
|
this.#dbSearchIndex = DBSearchIndex.getInstance();
|
|
5774
|
-
this.#dbSTSResourceLink = new DBSTSResourceLink();
|
|
5775
|
-
this.#dbSTSString = new DBSTSString();
|
|
5776
|
-
this.#dbSTSToken = new DBSTSToken();
|
|
5777
|
-
this.#dbSTSQuantity = new DBSTSQuantity();
|
|
5778
|
-
this.#dbSTSNumber = new DBSTSNumber();
|
|
5779
|
-
this.#dbSTSDate = new DBSTSDate();
|
|
5780
|
-
this.#dbSTSUri = new DBSTSUri();
|
|
5781
|
-
this.#dbSTSCombo = new DBSTSCombo();
|
|
6176
|
+
this.#dbSTSResourceLink = new DBSTSResourceLink({ logger: this.#options.logger });
|
|
6177
|
+
this.#dbSTSString = new DBSTSString({ logger: this.#options.logger });
|
|
6178
|
+
this.#dbSTSToken = new DBSTSToken({ logger: this.#options.logger });
|
|
6179
|
+
this.#dbSTSQuantity = new DBSTSQuantity({ logger: this.#options.logger });
|
|
6180
|
+
this.#dbSTSNumber = new DBSTSNumber({ logger: this.#options.logger });
|
|
6181
|
+
this.#dbSTSDate = new DBSTSDate({ logger: this.#options.logger });
|
|
6182
|
+
this.#dbSTSUri = new DBSTSUri({ logger: this.#options.logger });
|
|
6183
|
+
this.#dbSTSCombo = new DBSTSCombo({ logger: this.#options.logger });
|
|
5782
6184
|
}
|
|
5783
6185
|
GetOperationOutcome = (code, diagnostics) => {
|
|
5784
6186
|
return {
|