@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
@@ -7256,28 +7256,19 @@ class ResourceHelper {
7256
7256
  }
7257
7257
  }
7258
7258
  };
7259
- GetSearchParamFromResourceTypeUrl = (resourceType, url) => {
7259
+ GetSearchParamFromResourceTypeUrl = async (resourceType, url) => {
7260
7260
  const filterByNameAndUrl = this.definitions.searchParametersByResourceType[resourceType].params.filter((rt) => rt.SP_URL.localeCompare(url) === 0);
7261
7261
  if (filterByNameAndUrl.length > 0) {
7262
7262
  return filterByNameAndUrl[0];
7263
7263
  }
7264
7264
  };
7265
- GetSearchParamFromResourceType = (resourceType, name) => {
7265
+ GetSearchParamFromResourceType = async (resourceType, name) => {
7266
7266
  const filterByName = this.definitions.searchParametersByResourceType[resourceType].params.filter((rt) => rt.SP_NAME.localeCompare(name) === 0);
7267
7267
  if (filterByName.length > 0) {
7268
7268
  return filterByName[0];
7269
7269
  }
7270
7270
  };
7271
- /*
7272
- GetPathsFromResourceType = (resourceType: string, name: string): string[] => {
7273
- const filterByName = this.definitions.searchParametersByResourceType[resourceType].params.filter(rt => rt.SP_NAME.localeCompare(name) === 0);
7274
- if (filterByName.length > 0) {
7275
- return filterByName[0].expressions.map(e => e.path)
7276
- }
7277
- return [ ];
7278
- }
7279
- */
7280
- GetSearchParamsFromResourceType = (resourceType) => {
7271
+ GetSearchParamsFromResourceType = async (resourceType) => {
7281
7272
  return this.definitions.searchParametersByResourceType[resourceType].params;
7282
7273
  };
7283
7274
  }
@@ -10712,7 +10703,7 @@ class DBSearchIndexToken extends DBSearchIndexBase {
10712
10703
  }
10713
10704
  return retVal;
10714
10705
  };
10715
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
10706
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
10716
10707
  let retVal = [];
10717
10708
  searchFieldRecord.expressions.forEach((expression) => {
10718
10709
  let tokens = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -10748,15 +10739,15 @@ class DBSearchIndexComposite extends DBSearchIndexBase {
10748
10739
  // / root level code and quantity, i.e. Observation.code + Observation.value[x]Quantity
10749
10740
  // /component_0 component level at index 0 Observation.component[0].code + Observation.component[0].value[x]Quantity
10750
10741
  // /component_1 component level at index 1 Observation.component[1].code + Observation.component[1].value[x]Quantity
10751
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
10742
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
10752
10743
  let comboNonUniqueRecords = [];
10753
10744
  const searchIndex = DBSearchIndex.getInstance();
10754
10745
  let index = 0;
10755
10746
  let components = [];
10756
- searchFieldRecord.component.forEach((searchParamComponentRecord) => {
10747
+ for (const searchParamComponentRecord of searchFieldRecord.component) {
10757
10748
  components.push([]);
10758
10749
  const url = searchParamComponentRecord.definition;
10759
- const sp = searchIndex.resourceHelper.GetSearchParamFromResourceTypeUrl(resource.resourceType, url);
10750
+ const sp = await searchIndex.resourceHelper.GetSearchParamFromResourceTypeUrl(resource.resourceType, url);
10760
10751
  if (this.IsDefined(sp)) {
10761
10752
  const tir2 = {
10762
10753
  PID: v4(),
@@ -10772,7 +10763,7 @@ class DBSearchIndexComposite extends DBSearchIndexBase {
10772
10763
  COMPOSITE: null,
10773
10764
  COMPOSITE_HASH_EXACT: null
10774
10765
  };
10775
- const retVal = SearchRegistry.getInstance().searchIndexBaseRegistry[sp.SP_TYPE].OutputIndexRecord(resource, tir2, sp);
10766
+ const retVal = await SearchRegistry.getInstance().searchIndexBaseRegistry[sp.SP_TYPE].OutputIndexRecord(resource, tir2, sp);
10776
10767
  retVal.forEach((rv) => {
10777
10768
  if (!(rv.SP_MISSING && rv.SP_MISSING === true)) {
10778
10769
  if (rv.SP_STR && rv.SP_STR !== void 0) {
@@ -10782,7 +10773,7 @@ class DBSearchIndexComposite extends DBSearchIndexBase {
10782
10773
  });
10783
10774
  index++;
10784
10775
  }
10785
- });
10776
+ }
10786
10777
  for (let i = 0; i < components[0].length; i++) {
10787
10778
  for (let j = 0; j < components[1].length; j++) {
10788
10779
  const idxString = `${components[0][i].SP_STR}|${components[1][j].SP_STR}`;
@@ -10895,7 +10886,7 @@ class DBSearchIndexDates extends DBSearchIndexBase {
10895
10886
  }
10896
10887
  return retVal;
10897
10888
  };
10898
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
10889
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
10899
10890
  let retVal = [];
10900
10891
  searchFieldRecord.expressions.forEach((expression) => {
10901
10892
  let referenceVal = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -10983,7 +10974,7 @@ class DBSearchIndexQuantity extends DBSearchIndexBase {
10983
10974
  }
10984
10975
  return retVal;
10985
10976
  };
10986
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
10977
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
10987
10978
  const retVal = [];
10988
10979
  searchFieldRecord.expressions.forEach((expression) => {
10989
10980
  let quantityVal = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -11090,7 +11081,7 @@ class DBSearchIndexReference extends DBSearchIndexBase {
11090
11081
  }
11091
11082
  return retVal;
11092
11083
  };
11093
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
11084
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
11094
11085
  let retVal = [];
11095
11086
  searchFieldRecord.expressions.forEach((expression) => {
11096
11087
  const referenceVal = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -11206,7 +11197,7 @@ class DBSearchIndexString extends DBSearchIndexBase {
11206
11197
  }
11207
11198
  return retVal;
11208
11199
  };
11209
- OutputIndexRecord = (resource, tir, searchParamRecord) => {
11200
+ OutputIndexRecord = async (resource, tir, searchParamRecord) => {
11210
11201
  const retVal = [];
11211
11202
  searchParamRecord.expressions.forEach((expression) => {
11212
11203
  let stringVal = this.GetValueFromPath(resource, expression.path, searchParamRecord, expression);
@@ -11260,7 +11251,7 @@ class DBSearchIndexNumber extends DBSearchIndexBase {
11260
11251
  }
11261
11252
  return retVal;
11262
11253
  };
11263
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
11254
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
11264
11255
  const retVal = [];
11265
11256
  searchFieldRecord.expressions.forEach((expression) => {
11266
11257
  let numberVal = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -11320,7 +11311,7 @@ class DBSearchIndexURI extends DBSearchIndexBase {
11320
11311
  }
11321
11312
  return retVal;
11322
11313
  };
11323
- OutputIndexRecord = (resource, tir, searchFieldRecord) => {
11314
+ OutputIndexRecord = async (resource, tir, searchFieldRecord) => {
11324
11315
  const retVal = [];
11325
11316
  searchFieldRecord.expressions.forEach((expression) => {
11326
11317
  let uriVal = this.GetValueFromPath(resource, expression.path, searchFieldRecord, expression);
@@ -11379,7 +11370,7 @@ class DBSearchIndex {
11379
11370
  this.#debug("------------------");
11380
11371
  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)}]`);
11381
11372
  };
11382
- UpdateIndex = (resource, searchFieldRecord) => {
11373
+ UpdateIndex = async (resource, searchFieldRecord) => {
11383
11374
  try {
11384
11375
  const tir = {
11385
11376
  PID: v4(),
@@ -11398,7 +11389,7 @@ class DBSearchIndex {
11398
11389
  let saveRecord;
11399
11390
  const searchIndexBaseProcessor = this.searchRegistry.searchIndexBaseRegistry[searchFieldRecord.SP_TYPE];
11400
11391
  if (searchIndexBaseProcessor) {
11401
- saveRecord = searchIndexBaseProcessor.OutputIndexRecord(resource, tir, searchFieldRecord);
11392
+ saveRecord = await searchIndexBaseProcessor.OutputIndexRecord(resource, tir, searchFieldRecord);
11402
11393
  } else if (searchFieldRecord.SP_TYPE.localeCompare("special") === 0) {
11403
11394
  } else {
11404
11395
  const message = `DBSearchIndex:UpdateIndex(): Error: Search field paramater type: [${searchFieldRecord.SP_TYPE}] unknown.`;
@@ -11411,14 +11402,14 @@ class DBSearchIndex {
11411
11402
  return [];
11412
11403
  }
11413
11404
  };
11414
- GetSearchIndexData = (resource) => {
11405
+ GetSearchIndexData = async (resource) => {
11415
11406
  try {
11416
- const searchParamRecords = this.resourceHelper.GetSearchParamsFromResourceType(resource.resourceType);
11407
+ const searchParamRecords = await this.resourceHelper.GetSearchParamsFromResourceType(resource.resourceType);
11417
11408
  const searchIndexData = [];
11418
11409
  for (let i = 0; i < searchParamRecords.length; i++) {
11419
11410
  const searchRecord = searchParamRecords[i];
11420
11411
  try {
11421
- const retVal = this.UpdateIndex(resource, searchRecord);
11412
+ const retVal = await this.UpdateIndex(resource, searchRecord);
11422
11413
  if (retVal && retVal.length > 0) {
11423
11414
  searchIndexData.push(...retVal);
11424
11415
  }
@@ -11432,17 +11423,12 @@ class DBSearchIndex {
11432
11423
  return [];
11433
11424
  }
11434
11425
  };
11435
- GetSearchParamFromResourceType = (resourceType, name) => {
11426
+ GetSearchParamFromResourceType = async (resourceType, name) => {
11436
11427
  return this.resourceHelper.GetSearchParamFromResourceType(resourceType, name);
11437
11428
  };
11438
- GetSearchParamFromResourceTypeUrl = (resourceType, url) => {
11429
+ GetSearchParamFromResourceTypeUrl = async (resourceType, url) => {
11439
11430
  return this.resourceHelper.GetSearchParamFromResourceTypeUrl(resourceType, url);
11440
11431
  };
11441
- /*
11442
- GetPathsFromResourceType = (resourceType: string, name: string): string[] => {
11443
- return this.resourceHelper.GetPathsFromResourceType(resourceType, name);
11444
- }
11445
- */
11446
11432
  }
11447
11433
  var lib$1 = { exports: {} };
11448
11434
  var defaults = { exports: {} };
@@ -18218,7 +18204,7 @@ class PGFhirAccessLayer extends tinyEmitterExports.TinyEmitter {
18218
18204
  UpdateIndexes = async (client2, resource) => {
18219
18205
  let start = performance.now();
18220
18206
  const oa = start;
18221
- const searchIndexData = this.#dbSearchIndex.GetSearchIndexData(resource);
18207
+ const searchIndexData = await this.#dbSearchIndex.GetSearchIndexData(resource);
18222
18208
  const lap1 = performance.now() - start;
18223
18209
  start = performance.now();
18224
18210
  const InsertResourceLinkRecord = async (client22, resourceLinkIndexRecord) => {