@medplum/fhir-router 5.1.17 → 5.1.21

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.
@@ -7,6 +7,7 @@ import type { IncomingHttpHeaders } from 'node:http';
7
7
  import type { Operation } from 'rfc6902';
8
8
  import type { OperationOutcome } from '@medplum/fhirtypes';
9
9
  import { OperationOutcomeError } from '@medplum/core';
10
+ import type { Parameters as Parameters_2 } from '@medplum/fhirtypes';
10
11
  import type { Reference } from '@medplum/fhirtypes';
11
12
  import type { Resource } from '@medplum/fhirtypes';
12
13
  import type { SearchRequest } from '@medplum/core';
@@ -39,7 +40,7 @@ export declare interface FhirOptions {
39
40
  * Additionally, several convenience method implementations are provided to offer advanced functionality on top of the
40
41
  * abstract basic operations.
41
42
  */
42
- export declare abstract class FhirRepository<TClient = unknown> {
43
+ export declare abstract class FhirRepository {
43
44
  /**
44
45
  * Sets the repository mode.
45
46
  * In general, it is assumed that repositories will start in "reader" mode,
@@ -134,7 +135,7 @@ export declare abstract class FhirRepository<TClient = unknown> {
134
135
  * @param patch - The JSONPatch operations.
135
136
  * @returns The patched resource.
136
137
  */
137
- abstract patchResource<T extends Resource>(resourceType: T['resourceType'], id: string, patch: Operation[]): Promise<WithId<T>>;
138
+ abstract patchResource<T extends Resource>(resourceType: T['resourceType'], id: string, patch: Operation[] | Parameters_2): Promise<WithId<T>>;
138
139
  /**
139
140
  * Searches for FHIR resources.
140
141
  *
@@ -159,7 +160,7 @@ export declare abstract class FhirRepository<TClient = unknown> {
159
160
  *
160
161
  * @param callback - The callback function to be run within a transaction.
161
162
  */
162
- abstract withTransaction<TResult>(callback: (client: TClient) => Promise<TResult>, options?: {
163
+ abstract withTransaction<TResult>(callback: (txRepo: this) => Promise<TResult>, options?: {
163
164
  serializable?: boolean;
164
165
  }): Promise<TResult>;
165
166
  /**
@@ -300,7 +301,7 @@ export declare interface LogEvent extends Event_2 {
300
301
 
301
302
  export declare function makeSimpleRequest(method: HttpMethod, path: string, body?: any): FhirRequest;
302
303
 
303
- export declare class MemoryRepository extends FhirRepository<undefined> {
304
+ export declare class MemoryRepository extends FhirRepository {
304
305
  private readonly resources;
305
306
  private readonly history;
306
307
  private seeding;
@@ -311,7 +312,7 @@ export declare class MemoryRepository extends FhirRepository<undefined> {
311
312
  createResource<T extends Resource>(resource: T, options?: CreateResourceOptions, update?: boolean): Promise<WithId<T>>;
312
313
  generateId(): string;
313
314
  updateResource<T extends Resource>(resource: T, options?: UpdateResourceOptions): Promise<WithId<T>>;
314
- patchResource<T extends Resource>(resourceType: T['resourceType'], id: string, patch: Operation[]): Promise<WithId<T>>;
315
+ patchResource<T extends Resource>(resourceType: T['resourceType'], id: string, patch: Operation[] | Parameters_2): Promise<WithId<T>>;
315
316
  readResource<T extends Resource>(resourceType: string, id: string): Promise<T>;
316
317
  readReference<T extends Resource>(reference: Reference<T>): Promise<WithId<T>>;
317
318
  readReferences<T extends Resource>(references: readonly Reference<T>[]): Promise<(T | OperationOutcomeError)[]>;
@@ -320,7 +321,7 @@ export declare class MemoryRepository extends FhirRepository<undefined> {
320
321
  search<T extends Resource>(searchRequest: SearchRequest<T>): Promise<Bundle<WithId<T>>>;
321
322
  searchByReference<T extends Resource>(searchRequest: SearchRequest<T>, referenceField: string, references: string[]): Promise<Record<string, WithId<T>[]>>;
322
323
  deleteResource(resourceType: string, id: string): Promise<void>;
323
- withTransaction<TResult>(callback: (client: undefined) => Promise<TResult>): Promise<TResult>;
324
+ withTransaction<TResult>(callback: (repo: this) => Promise<TResult>): Promise<TResult>;
324
325
  }
325
326
 
326
327
  export declare type PathSegment = {
@@ -7,6 +7,7 @@ import type { IncomingHttpHeaders } from 'node:http';
7
7
  import type { Operation } from 'rfc6902';
8
8
  import type { OperationOutcome } from '@medplum/fhirtypes';
9
9
  import { OperationOutcomeError } from '@medplum/core';
10
+ import type { Parameters as Parameters_2 } from '@medplum/fhirtypes';
10
11
  import type { Reference } from '@medplum/fhirtypes';
11
12
  import type { Resource } from '@medplum/fhirtypes';
12
13
  import type { SearchRequest } from '@medplum/core';
@@ -39,7 +40,7 @@ export declare interface FhirOptions {
39
40
  * Additionally, several convenience method implementations are provided to offer advanced functionality on top of the
40
41
  * abstract basic operations.
41
42
  */
42
- export declare abstract class FhirRepository<TClient = unknown> {
43
+ export declare abstract class FhirRepository {
43
44
  /**
44
45
  * Sets the repository mode.
45
46
  * In general, it is assumed that repositories will start in "reader" mode,
@@ -134,7 +135,7 @@ export declare abstract class FhirRepository<TClient = unknown> {
134
135
  * @param patch - The JSONPatch operations.
135
136
  * @returns The patched resource.
136
137
  */
137
- abstract patchResource<T extends Resource>(resourceType: T['resourceType'], id: string, patch: Operation[]): Promise<WithId<T>>;
138
+ abstract patchResource<T extends Resource>(resourceType: T['resourceType'], id: string, patch: Operation[] | Parameters_2): Promise<WithId<T>>;
138
139
  /**
139
140
  * Searches for FHIR resources.
140
141
  *
@@ -159,7 +160,7 @@ export declare abstract class FhirRepository<TClient = unknown> {
159
160
  *
160
161
  * @param callback - The callback function to be run within a transaction.
161
162
  */
162
- abstract withTransaction<TResult>(callback: (client: TClient) => Promise<TResult>, options?: {
163
+ abstract withTransaction<TResult>(callback: (txRepo: this) => Promise<TResult>, options?: {
163
164
  serializable?: boolean;
164
165
  }): Promise<TResult>;
165
166
  /**
@@ -300,7 +301,7 @@ export declare interface LogEvent extends Event_2 {
300
301
 
301
302
  export declare function makeSimpleRequest(method: HttpMethod, path: string, body?: any): FhirRequest;
302
303
 
303
- export declare class MemoryRepository extends FhirRepository<undefined> {
304
+ export declare class MemoryRepository extends FhirRepository {
304
305
  private readonly resources;
305
306
  private readonly history;
306
307
  private seeding;
@@ -311,7 +312,7 @@ export declare class MemoryRepository extends FhirRepository<undefined> {
311
312
  createResource<T extends Resource>(resource: T, options?: CreateResourceOptions, update?: boolean): Promise<WithId<T>>;
312
313
  generateId(): string;
313
314
  updateResource<T extends Resource>(resource: T, options?: UpdateResourceOptions): Promise<WithId<T>>;
314
- patchResource<T extends Resource>(resourceType: T['resourceType'], id: string, patch: Operation[]): Promise<WithId<T>>;
315
+ patchResource<T extends Resource>(resourceType: T['resourceType'], id: string, patch: Operation[] | Parameters_2): Promise<WithId<T>>;
315
316
  readResource<T extends Resource>(resourceType: string, id: string): Promise<T>;
316
317
  readReference<T extends Resource>(reference: Reference<T>): Promise<WithId<T>>;
317
318
  readReferences<T extends Resource>(references: readonly Reference<T>[]): Promise<(T | OperationOutcomeError)[]>;
@@ -320,7 +321,7 @@ export declare class MemoryRepository extends FhirRepository<undefined> {
320
321
  search<T extends Resource>(searchRequest: SearchRequest<T>): Promise<Bundle<WithId<T>>>;
321
322
  searchByReference<T extends Resource>(searchRequest: SearchRequest<T>, referenceField: string, references: string[]): Promise<Record<string, WithId<T>[]>>;
322
323
  deleteResource(resourceType: string, id: string): Promise<void>;
323
- withTransaction<TResult>(callback: (client: undefined) => Promise<TResult>): Promise<TResult>;
324
+ withTransaction<TResult>(callback: (repo: this) => Promise<TResult>): Promise<TResult>;
324
325
  }
325
326
 
326
327
  export declare type PathSegment = {