@medplum/fhir-router 3.1.1 → 3.1.3

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.
@@ -127,6 +127,18 @@ export declare interface FhirRepository<TClient = unknown> {
127
127
  * @returns The updated resource.
128
128
  */
129
129
  updateResource<T extends Resource>(resource: T, versionId?: string): Promise<T>;
130
+ /**
131
+ * Creates or updates a resource based on a search criteria.
132
+ *
133
+ * See: https://www.hl7.org/fhir/http.html#cond-update
134
+ * @param resource - The FHIR resource to create or update.
135
+ * @param search - The search criteria to find an existing resource to update.
136
+ * @returns The updated resource.
137
+ */
138
+ conditionalUpdate<T extends Resource>(resource: T, search: SearchRequest): Promise<{
139
+ resource: T;
140
+ outcome: OperationOutcome;
141
+ }>;
130
142
  /**
131
143
  * Deletes a FHIR resource.
132
144
  *
@@ -220,6 +232,10 @@ export declare class MemoryRepository extends BaseRepository implements FhirRepo
220
232
  clear(): void;
221
233
  createResource<T extends Resource>(resource: T): Promise<T>;
222
234
  updateResource<T extends Resource>(resource: T, versionId?: string): Promise<T>;
235
+ conditionalUpdate<T extends Resource>(resource: T, search: SearchRequest): Promise<{
236
+ resource: T;
237
+ outcome: OperationOutcome;
238
+ }>;
223
239
  patchResource(resourceType: string, id: string, patch: Operation[]): Promise<Resource>;
224
240
  readResource<T extends Resource>(resourceType: string, id: string): Promise<T>;
225
241
  readReference<T extends Resource>(reference: Reference<T>): Promise<T>;
@@ -127,6 +127,18 @@ export declare interface FhirRepository<TClient = unknown> {
127
127
  * @returns The updated resource.
128
128
  */
129
129
  updateResource<T extends Resource>(resource: T, versionId?: string): Promise<T>;
130
+ /**
131
+ * Creates or updates a resource based on a search criteria.
132
+ *
133
+ * See: https://www.hl7.org/fhir/http.html#cond-update
134
+ * @param resource - The FHIR resource to create or update.
135
+ * @param search - The search criteria to find an existing resource to update.
136
+ * @returns The updated resource.
137
+ */
138
+ conditionalUpdate<T extends Resource>(resource: T, search: SearchRequest): Promise<{
139
+ resource: T;
140
+ outcome: OperationOutcome;
141
+ }>;
130
142
  /**
131
143
  * Deletes a FHIR resource.
132
144
  *
@@ -220,6 +232,10 @@ export declare class MemoryRepository extends BaseRepository implements FhirRepo
220
232
  clear(): void;
221
233
  createResource<T extends Resource>(resource: T): Promise<T>;
222
234
  updateResource<T extends Resource>(resource: T, versionId?: string): Promise<T>;
235
+ conditionalUpdate<T extends Resource>(resource: T, search: SearchRequest): Promise<{
236
+ resource: T;
237
+ outcome: OperationOutcome;
238
+ }>;
223
239
  patchResource(resourceType: string, id: string, patch: Operation[]): Promise<Resource>;
224
240
  readResource<T extends Resource>(resourceType: string, id: string): Promise<T>;
225
241
  readReference<T extends Resource>(reference: Reference<T>): Promise<T>;