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