@medplum/fhir-router 2.0.11 → 2.0.12
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/cjs/index.cjs +38 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/cjs/index.min.cjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/index.min.mjs.map +1 -1
- package/dist/esm/index.mjs +38 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/repo.d.ts +72 -1
- package/package.json +1 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -56,10 +56,10 @@ class BatchProcessor {
|
|
|
56
56
|
* @param bundle The input bundle.
|
|
57
57
|
*/
|
|
58
58
|
constructor(router, repo, bundle) {
|
|
59
|
+
_BatchProcessor_instances.add(this);
|
|
59
60
|
this.router = router;
|
|
60
61
|
this.repo = repo;
|
|
61
62
|
this.bundle = bundle;
|
|
62
|
-
_BatchProcessor_instances.add(this);
|
|
63
63
|
_BatchProcessor_ids.set(this, void 0);
|
|
64
64
|
__classPrivateFieldSet(this, _BatchProcessor_ids, {}, "f");
|
|
65
65
|
}
|
|
@@ -13970,8 +13970,43 @@ class FhirRouter {
|
|
|
13970
13970
|
}
|
|
13971
13971
|
|
|
13972
13972
|
var _MemoryRepository_resources, _MemoryRepository_history;
|
|
13973
|
-
class
|
|
13973
|
+
class BaseRepository {
|
|
13974
|
+
/**
|
|
13975
|
+
* Searches for a single FHIR resource.
|
|
13976
|
+
*
|
|
13977
|
+
* This is a convenience method for `search()` that returns the first resource rather than a `Bundle`.
|
|
13978
|
+
*
|
|
13979
|
+
* The return value is the resource, if available; otherwise, undefined.
|
|
13980
|
+
*
|
|
13981
|
+
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
13982
|
+
*
|
|
13983
|
+
* @param searchRequest The FHIR search request.
|
|
13984
|
+
* @returns Promise to the first search result or undefined.
|
|
13985
|
+
*/
|
|
13986
|
+
async searchOne(searchRequest) {
|
|
13987
|
+
const bundle = await this.search({ ...searchRequest, count: 1 });
|
|
13988
|
+
return bundle.entry?.[0]?.resource;
|
|
13989
|
+
}
|
|
13990
|
+
/**
|
|
13991
|
+
* Sends a FHIR search request for an array of resources.
|
|
13992
|
+
*
|
|
13993
|
+
* This is a convenience method for `search()` that returns the resources as an array rather than a `Bundle`.
|
|
13994
|
+
*
|
|
13995
|
+
* The return value is an array of resources.
|
|
13996
|
+
*
|
|
13997
|
+
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
13998
|
+
*
|
|
13999
|
+
* @param searchRequest The FHIR search request.
|
|
14000
|
+
* @returns Promise to the array of search results.
|
|
14001
|
+
*/
|
|
14002
|
+
async searchResources(searchRequest) {
|
|
14003
|
+
const bundle = await this.search(searchRequest);
|
|
14004
|
+
return bundle.entry?.map((e) => e.resource) || [];
|
|
14005
|
+
}
|
|
14006
|
+
}
|
|
14007
|
+
class MemoryRepository extends BaseRepository {
|
|
13974
14008
|
constructor() {
|
|
14009
|
+
super();
|
|
13975
14010
|
_MemoryRepository_resources.set(this, void 0);
|
|
13976
14011
|
_MemoryRepository_history.set(this, void 0);
|
|
13977
14012
|
__classPrivateFieldSet(this, _MemoryRepository_resources, {}, "f");
|
|
@@ -14119,5 +14154,5 @@ const generateId = () => 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,
|
|
|
14119
14154
|
return v.toString(16);
|
|
14120
14155
|
});
|
|
14121
14156
|
|
|
14122
|
-
export { FhirRouter, MemoryRepository, Router };
|
|
14157
|
+
export { BaseRepository, FhirRouter, MemoryRepository, Router };
|
|
14123
14158
|
//# sourceMappingURL=index.mjs.map
|