@nsshunt/stsfhirpg 1.2.4 → 1.2.6

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.
Files changed (29) hide show
  1. package/dist/stsfhirpg.cjs +23 -37
  2. package/dist/stsfhirpg.cjs.map +1 -1
  3. package/dist/stsfhirpg.mjs +23 -37
  4. package/dist/stsfhirpg.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/types/fhir-database/dbsearchindex.d.ts +4 -4
  7. package/types/fhir-database/dbsearchindex.d.ts.map +1 -1
  8. package/types/fhir-database/dbsearchindexbase.d.ts +1 -1
  9. package/types/fhir-database/dbsearchindexbase.d.ts.map +1 -1
  10. package/types/fhir-database/dbsearchindexcomposite.d.ts +1 -1
  11. package/types/fhir-database/dbsearchindexcomposite.d.ts.map +1 -1
  12. package/types/fhir-database/dbsearchindexdates.d.ts +1 -1
  13. package/types/fhir-database/dbsearchindexdates.d.ts.map +1 -1
  14. package/types/fhir-database/dbsearchindexnumber.d.ts +1 -1
  15. package/types/fhir-database/dbsearchindexnumber.d.ts.map +1 -1
  16. package/types/fhir-database/dbsearchindexquantity.d.ts +1 -1
  17. package/types/fhir-database/dbsearchindexquantity.d.ts.map +1 -1
  18. package/types/fhir-database/dbsearchindexreference.d.ts +1 -1
  19. package/types/fhir-database/dbsearchindexreference.d.ts.map +1 -1
  20. package/types/fhir-database/dbsearchindexstring.d.ts +1 -1
  21. package/types/fhir-database/dbsearchindexstring.d.ts.map +1 -1
  22. package/types/fhir-database/dbsearchindextesthelpers.d.ts +1 -1
  23. package/types/fhir-database/dbsearchindextesthelpers.d.ts.map +1 -1
  24. package/types/fhir-database/dbsearchindextoken.d.ts +1 -1
  25. package/types/fhir-database/dbsearchindextoken.d.ts.map +1 -1
  26. package/types/fhir-database/dbsearchindexuri.d.ts +1 -1
  27. package/types/fhir-database/dbsearchindexuri.d.ts.map +1 -1
  28. package/types/fhir-utils/resourceHelper.d.ts +3 -3
  29. package/types/fhir-utils/resourceHelper.d.ts.map +1 -1
@@ -7254,28 +7254,19 @@ class ResourceHelper {
7254
7254
  }
7255
7255
  }
7256
7256
  };
7257
- GetSearchParamFromResourceTypeUrl = (resourceType, url) => {
7257
+ GetSearchParamFromResourceTypeUrl = async (resourceType, url) => {
7258
7258
  const filterByNameAndUrl = this.definitions.searchParametersByResourceType[resourceType].params.filter((rt) => rt.SP_URL.localeCompare(url) === 0);
7259
7259
  if (filterByNameAndUrl.length > 0) {
7260
7260
  return filterByNameAndUrl[0];
7261
7261
  }
7262
7262
  };
7263
- GetSearchParamFromResourceType = (resourceType, name) => {
7263
+ GetSearchParamFromResourceType = async (resourceType, name) => {
7264
7264
  const filterByName = this.definitions.searchParametersByResourceType[resourceType].params.filter((rt) => rt.SP_NAME.localeCompare(name) === 0);
7265
7265
  if (filterByName.length > 0) {
7266
7266
  return filterByName[0];
7267
7267
  }
7268
7268
  };
7269
- /*
7270
- GetPathsFromResourceType = (resourceType: string, name: string): string[] => {
7271
- const filterByName = this.definitions.searchParametersByResourceType[resourceType].params.filter(rt => rt.SP_NAME.localeCompare(name) === 0);
7272
- if (filterByName.length > 0) {
7273
- return filterByName[0].expressions.map(e => e.path)
7274
- }
7275
- return [ ];
7276
- }
7277
- */
7278
- GetSearchParamsFromResourceType = (resourceType) => {
7269
+ GetSearchParamsFromResourceType = async (resourceType) => {
7279
7270
  return this.definitions.searchParametersByResourceType[resourceType].params;
7280
7271
  };
7281
7272
  }
@@ -10710,7 +10701,7 @@ class DBSearchIndexToken extends DBSearchIndexBase {
10710
10701
  }
10711
10702
  return retVal;
10712
10703
  };
10713
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
10704
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
10714
10705
  let retVal = [];
10715
10706
  searchFieldRecord.expressions.forEach((expression) => {
10716
10707
  let tokens = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -10746,15 +10737,15 @@ class DBSearchIndexComposite extends DBSearchIndexBase {
10746
10737
  // / root level code and quantity, i.e. Observation.code + Observation.value[x]Quantity
10747
10738
  // /component_0 component level at index 0 Observation.component[0].code + Observation.component[0].value[x]Quantity
10748
10739
  // /component_1 component level at index 1 Observation.component[1].code + Observation.component[1].value[x]Quantity
10749
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
10740
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
10750
10741
  let comboNonUniqueRecords = [];
10751
10742
  const searchIndex = DBSearchIndex.getInstance();
10752
10743
  let index = 0;
10753
10744
  let components = [];
10754
- searchFieldRecord.component.forEach((searchParamComponentRecord) => {
10745
+ for (const searchParamComponentRecord of searchFieldRecord.component) {
10755
10746
  components.push([]);
10756
10747
  const url = searchParamComponentRecord.definition;
10757
- const sp = searchIndex.resourceHelper.GetSearchParamFromResourceTypeUrl(resource.resourceType, url);
10748
+ const sp = await searchIndex.resourceHelper.GetSearchParamFromResourceTypeUrl(resource.resourceType, url);
10758
10749
  if (this.IsDefined(sp)) {
10759
10750
  const tir2 = {
10760
10751
  PID: v4(),
@@ -10770,7 +10761,7 @@ class DBSearchIndexComposite extends DBSearchIndexBase {
10770
10761
  COMPOSITE: null,
10771
10762
  COMPOSITE_HASH_EXACT: null
10772
10763
  };
10773
- const retVal = SearchRegistry.getInstance().searchIndexBaseRegistry[sp.SP_TYPE].OutputIndexRecord(resource, tir2, sp);
10764
+ const retVal = await SearchRegistry.getInstance().searchIndexBaseRegistry[sp.SP_TYPE].OutputIndexRecord(resource, tir2, sp);
10774
10765
  retVal.forEach((rv) => {
10775
10766
  if (!(rv.SP_MISSING && rv.SP_MISSING === true)) {
10776
10767
  if (rv.SP_STR && rv.SP_STR !== void 0) {
@@ -10780,7 +10771,7 @@ class DBSearchIndexComposite extends DBSearchIndexBase {
10780
10771
  });
10781
10772
  index++;
10782
10773
  }
10783
- });
10774
+ }
10784
10775
  for (let i = 0; i < components[0].length; i++) {
10785
10776
  for (let j = 0; j < components[1].length; j++) {
10786
10777
  const idxString = `${components[0][i].SP_STR}|${components[1][j].SP_STR}`;
@@ -10893,7 +10884,7 @@ class DBSearchIndexDates extends DBSearchIndexBase {
10893
10884
  }
10894
10885
  return retVal;
10895
10886
  };
10896
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
10887
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
10897
10888
  let retVal = [];
10898
10889
  searchFieldRecord.expressions.forEach((expression) => {
10899
10890
  let referenceVal = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -10981,7 +10972,7 @@ class DBSearchIndexQuantity extends DBSearchIndexBase {
10981
10972
  }
10982
10973
  return retVal;
10983
10974
  };
10984
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
10975
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
10985
10976
  const retVal = [];
10986
10977
  searchFieldRecord.expressions.forEach((expression) => {
10987
10978
  let quantityVal = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -11088,7 +11079,7 @@ class DBSearchIndexReference extends DBSearchIndexBase {
11088
11079
  }
11089
11080
  return retVal;
11090
11081
  };
11091
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
11082
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
11092
11083
  let retVal = [];
11093
11084
  searchFieldRecord.expressions.forEach((expression) => {
11094
11085
  const referenceVal = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -11204,7 +11195,7 @@ class DBSearchIndexString extends DBSearchIndexBase {
11204
11195
  }
11205
11196
  return retVal;
11206
11197
  };
11207
- OutputIndexRecord = (resource, tir, searchParamRecord) => {
11198
+ OutputIndexRecord = async (resource, tir, searchParamRecord) => {
11208
11199
  const retVal = [];
11209
11200
  searchParamRecord.expressions.forEach((expression) => {
11210
11201
  let stringVal = this.GetValueFromPath(resource, expression.path, searchParamRecord, expression);
@@ -11258,7 +11249,7 @@ class DBSearchIndexNumber extends DBSearchIndexBase {
11258
11249
  }
11259
11250
  return retVal;
11260
11251
  };
11261
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
11252
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
11262
11253
  const retVal = [];
11263
11254
  searchFieldRecord.expressions.forEach((expression) => {
11264
11255
  let numberVal = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -11318,7 +11309,7 @@ class DBSearchIndexURI extends DBSearchIndexBase {
11318
11309
  }
11319
11310
  return retVal;
11320
11311
  };
11321
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
11312
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
11322
11313
  const retVal = [];
11323
11314
  searchFieldRecord.expressions.forEach((expression) => {
11324
11315
  let uriVal = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -11377,7 +11368,7 @@ class DBSearchIndex {
11377
11368
  this.#debug("------------------");
11378
11369
  this.#debug(`resource: [${hl(resourceName)}] resourceId: [${hl(resourceId)}] SP_NAME: [${hl(searchFieldRecord.SP_NAME)}] SP_TYPE: [${hl(searchFieldRecord.SP_TYPE)}] SP_BASE: [${hl(searchFieldRecord.SP_BASE)}] path: [${hl(searchFieldRecord.path)}] RESOURCE_DATATYPE: [${hl(searchFieldRecord.RESOURCE_DATATYPE)}] subFieldDataType: [${hl(searchFieldRecord.subFieldDataType)}] stringIndexFields: [${hl(searchFieldRecord.stringIndexFields)}]`);
11379
11370
  };
11380
- UpdateIndex = (resource, searchFieldRecord) => {
11371
+ UpdateIndex = async (resource, searchFieldRecord) => {
11381
11372
  try {
11382
11373
  const tir = {
11383
11374
  PID: v4(),
@@ -11396,7 +11387,7 @@ class DBSearchIndex {
11396
11387
  let saveRecord;
11397
11388
  const searchIndexBaseProcessor = this.searchRegistry.searchIndexBaseRegistry[searchFieldRecord.SP_TYPE];
11398
11389
  if (searchIndexBaseProcessor) {
11399
- saveRecord = searchIndexBaseProcessor.OutputIndexRecord(resource, tir, searchFieldRecord);
11390
+ saveRecord = await searchIndexBaseProcessor.OutputIndexRecord(resource, tir, searchFieldRecord);
11400
11391
  } else if (searchFieldRecord.SP_TYPE.localeCompare("special") === 0) {
11401
11392
  } else {
11402
11393
  const message = `DBSearchIndex:UpdateIndex(): Error: Search field paramater type: [${searchFieldRecord.SP_TYPE}] unknown.`;
@@ -11409,14 +11400,14 @@ class DBSearchIndex {
11409
11400
  return [];
11410
11401
  }
11411
11402
  };
11412
- GetSearchIndexData = (resource) => {
11403
+ GetSearchIndexData = async (resource) => {
11413
11404
  try {
11414
- const searchParamRecords = this.resourceHelper.GetSearchParamsFromResourceType(resource.resourceType);
11405
+ const searchParamRecords = await this.resourceHelper.GetSearchParamsFromResourceType(resource.resourceType);
11415
11406
  const searchIndexData = [];
11416
11407
  for (let i = 0; i < searchParamRecords.length; i++) {
11417
11408
  const searchRecord = searchParamRecords[i];
11418
11409
  try {
11419
- const retVal = this.UpdateIndex(resource, searchRecord);
11410
+ const retVal = await this.UpdateIndex(resource, searchRecord);
11420
11411
  if (retVal && retVal.length > 0) {
11421
11412
  searchIndexData.push(...retVal);
11422
11413
  }
@@ -11430,17 +11421,12 @@ class DBSearchIndex {
11430
11421
  return [];
11431
11422
  }
11432
11423
  };
11433
- GetSearchParamFromResourceType = (resourceType, name) => {
11424
+ GetSearchParamFromResourceType = async (resourceType, name) => {
11434
11425
  return this.resourceHelper.GetSearchParamFromResourceType(resourceType, name);
11435
11426
  };
11436
- GetSearchParamFromResourceTypeUrl = (resourceType, url) => {
11427
+ GetSearchParamFromResourceTypeUrl = async (resourceType, url) => {
11437
11428
  return this.resourceHelper.GetSearchParamFromResourceTypeUrl(resourceType, url);
11438
11429
  };
11439
- /*
11440
- GetPathsFromResourceType = (resourceType: string, name: string): string[] => {
11441
- return this.resourceHelper.GetPathsFromResourceType(resourceType, name);
11442
- }
11443
- */
11444
11430
  }
11445
11431
  var lib$1 = { exports: {} };
11446
11432
  var defaults = { exports: {} };
@@ -18216,7 +18202,7 @@ class PGFhirAccessLayer extends tinyEmitterExports.TinyEmitter {
18216
18202
  UpdateIndexes = async (client2, resource) => {
18217
18203
  let start = performance.now();
18218
18204
  const oa = start;
18219
- const searchIndexData = this.#dbSearchIndex.GetSearchIndexData(resource);
18205
+ const searchIndexData = await this.#dbSearchIndex.GetSearchIndexData(resource);
18220
18206
  const lap1 = performance.now() - start;
18221
18207
  start = performance.now();
18222
18208
  const InsertResourceLinkRecord = async (client22, resourceLinkIndexRecord) => {