@medplum/fhir-router 2.0.11 → 2.0.13
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/cjs/index.cjs
CHANGED
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
* @param bundle The input bundle.
|
|
59
59
|
*/
|
|
60
60
|
constructor(router, repo, bundle) {
|
|
61
|
+
_BatchProcessor_instances.add(this);
|
|
61
62
|
this.router = router;
|
|
62
63
|
this.repo = repo;
|
|
63
64
|
this.bundle = bundle;
|
|
64
|
-
_BatchProcessor_instances.add(this);
|
|
65
65
|
_BatchProcessor_ids.set(this, void 0);
|
|
66
66
|
__classPrivateFieldSet(this, _BatchProcessor_ids, {}, "f");
|
|
67
67
|
}
|
|
@@ -13972,8 +13972,43 @@ spurious results.`);
|
|
|
13972
13972
|
}
|
|
13973
13973
|
|
|
13974
13974
|
var _MemoryRepository_resources, _MemoryRepository_history;
|
|
13975
|
-
class
|
|
13975
|
+
class BaseRepository {
|
|
13976
|
+
/**
|
|
13977
|
+
* Searches for a single FHIR resource.
|
|
13978
|
+
*
|
|
13979
|
+
* This is a convenience method for `search()` that returns the first resource rather than a `Bundle`.
|
|
13980
|
+
*
|
|
13981
|
+
* The return value is the resource, if available; otherwise, undefined.
|
|
13982
|
+
*
|
|
13983
|
+
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
13984
|
+
*
|
|
13985
|
+
* @param searchRequest The FHIR search request.
|
|
13986
|
+
* @returns Promise to the first search result or undefined.
|
|
13987
|
+
*/
|
|
13988
|
+
async searchOne(searchRequest) {
|
|
13989
|
+
const bundle = await this.search({ ...searchRequest, count: 1 });
|
|
13990
|
+
return bundle.entry?.[0]?.resource;
|
|
13991
|
+
}
|
|
13992
|
+
/**
|
|
13993
|
+
* Sends a FHIR search request for an array of resources.
|
|
13994
|
+
*
|
|
13995
|
+
* This is a convenience method for `search()` that returns the resources as an array rather than a `Bundle`.
|
|
13996
|
+
*
|
|
13997
|
+
* The return value is an array of resources.
|
|
13998
|
+
*
|
|
13999
|
+
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
14000
|
+
*
|
|
14001
|
+
* @param searchRequest The FHIR search request.
|
|
14002
|
+
* @returns Promise to the array of search results.
|
|
14003
|
+
*/
|
|
14004
|
+
async searchResources(searchRequest) {
|
|
14005
|
+
const bundle = await this.search(searchRequest);
|
|
14006
|
+
return bundle.entry?.map((e) => e.resource) || [];
|
|
14007
|
+
}
|
|
14008
|
+
}
|
|
14009
|
+
class MemoryRepository extends BaseRepository {
|
|
13976
14010
|
constructor() {
|
|
14011
|
+
super();
|
|
13977
14012
|
_MemoryRepository_resources.set(this, void 0);
|
|
13978
14013
|
_MemoryRepository_history.set(this, void 0);
|
|
13979
14014
|
__classPrivateFieldSet(this, _MemoryRepository_resources, {}, "f");
|
|
@@ -14121,6 +14156,7 @@ spurious results.`);
|
|
|
14121
14156
|
return v.toString(16);
|
|
14122
14157
|
});
|
|
14123
14158
|
|
|
14159
|
+
exports.BaseRepository = BaseRepository;
|
|
14124
14160
|
exports.FhirRouter = FhirRouter;
|
|
14125
14161
|
exports.MemoryRepository = MemoryRepository;
|
|
14126
14162
|
exports.Router = Router;
|