@medplum/fhir-router 3.0.1 → 3.0.2

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.
@@ -53,7 +53,7 @@ export declare interface FhirOptions {
53
53
  * 1. MemoryRepository - A repository that stores resources in memory.
54
54
  * 2. Server Repository - A repository that stores resources in a relational database.
55
55
  */
56
- export declare interface FhirRepository {
56
+ export declare interface FhirRepository<TClient = unknown> {
57
57
  /**
58
58
  * Creates a FHIR resource.
59
59
  *
@@ -165,6 +165,12 @@ export declare interface FhirRepository {
165
165
  * @returns Promise to the array of search results.
166
166
  */
167
167
  searchResources<T extends Resource>(searchRequest: SearchRequest<T>): Promise<T[]>;
168
+ /**
169
+ * Runs a callback function within a transaction.
170
+ *
171
+ * @param callback - The callback function to be run within a transaction.
172
+ */
173
+ withTransaction<TResult>(callback: (client: TClient) => Promise<TResult>): Promise<TResult>;
168
174
  }
169
175
 
170
176
  export declare type FhirRequest = {
@@ -203,6 +209,7 @@ export declare class MemoryRepository extends BaseRepository implements FhirRepo
203
209
  readVersion<T extends Resource>(resourceType: string, id: string, versionId: string): Promise<T>;
204
210
  search<T extends Resource>(searchRequest: SearchRequest<T>): Promise<Bundle<T>>;
205
211
  deleteResource(resourceType: string, id: string): Promise<void>;
212
+ withTransaction<TResult>(callback: (client: unknown) => Promise<TResult>): Promise<TResult>;
206
213
  }
207
214
 
208
215
  export declare type PathSegment = {
@@ -53,7 +53,7 @@ export declare interface FhirOptions {
53
53
  * 1. MemoryRepository - A repository that stores resources in memory.
54
54
  * 2. Server Repository - A repository that stores resources in a relational database.
55
55
  */
56
- export declare interface FhirRepository {
56
+ export declare interface FhirRepository<TClient = unknown> {
57
57
  /**
58
58
  * Creates a FHIR resource.
59
59
  *
@@ -165,6 +165,12 @@ export declare interface FhirRepository {
165
165
  * @returns Promise to the array of search results.
166
166
  */
167
167
  searchResources<T extends Resource>(searchRequest: SearchRequest<T>): Promise<T[]>;
168
+ /**
169
+ * Runs a callback function within a transaction.
170
+ *
171
+ * @param callback - The callback function to be run within a transaction.
172
+ */
173
+ withTransaction<TResult>(callback: (client: TClient) => Promise<TResult>): Promise<TResult>;
168
174
  }
169
175
 
170
176
  export declare type FhirRequest = {
@@ -203,6 +209,7 @@ export declare class MemoryRepository extends BaseRepository implements FhirRepo
203
209
  readVersion<T extends Resource>(resourceType: string, id: string, versionId: string): Promise<T>;
204
210
  search<T extends Resource>(searchRequest: SearchRequest<T>): Promise<Bundle<T>>;
205
211
  deleteResource(resourceType: string, id: string): Promise<void>;
212
+ withTransaction<TResult>(callback: (client: unknown) => Promise<TResult>): Promise<TResult>;
206
213
  }
207
214
 
208
215
  export declare type PathSegment = {