@medplum/core 3.0.7 → 3.0.8

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.
@@ -487,6 +487,8 @@ export declare function createFhircastMessagePayload<EventName extends FhircastE
487
487
 
488
488
  export declare function createFhircastMessagePayload<EventName extends FhircastEventVersionRequired>(topic: string, event: EventName, context: FhircastValidContextForEvent<EventName> | FhircastValidContextForEvent<EventName>[], versionId: string): FhircastMessagePayload<EventName>;
489
489
 
490
+ export declare function createOperationOutcomeIssue(severity: IssueSeverity, code: IssueType, message: string, path: string, data?: Record<string, any>): OperationOutcomeIssue;
491
+
490
492
  export declare interface CreatePdfFunction {
491
493
  (docDefinition: TDocumentDefinitions, tableLayouts?: Record<string, CustomTableLayout> | undefined, fonts?: TFontDictionary | undefined): Promise<any>;
492
494
  }
@@ -2014,6 +2016,10 @@ export declare function isSliceDefinitionWithTypes(slice: SliceDefinition): slic
2014
2016
  */
2015
2017
  export declare function isStringArray(arr: any[]): arr is string[];
2016
2018
 
2019
+ export declare type IssueSeverity = 'error' | 'fatal' | 'warning' | 'information';
2020
+
2021
+ export declare type IssueType = 'structure' | 'invariant' | 'processing';
2022
+
2017
2023
  /**
2018
2024
  * Returns true if the input string is a UUID.
2019
2025
  * @param input - The input string.
@@ -2312,6 +2318,7 @@ export declare class MedplumClient extends EventTarget_2 {
2312
2318
  private basicAuth?;
2313
2319
  private initPromise;
2314
2320
  private initComplete;
2321
+ private keyValueClient?;
2315
2322
  constructor(options?: MedplumClientOptions);
2316
2323
  /**
2317
2324
  * @returns Whether the client has been fully initialized or not. Should always be true unless a custom asynchronous `ClientStorage` was passed into the constructor.
@@ -3390,6 +3397,11 @@ export declare class MedplumClient extends EventTarget_2 {
3390
3397
  * @returns The response body.
3391
3398
  */
3392
3399
  startAsyncRequest<T>(url: string, options?: RequestInit): Promise<T>;
3400
+ /**
3401
+ * Returns the key value client.
3402
+ * @returns The key value client.
3403
+ */
3404
+ get keyValue(): MedplumKeyValueClient;
3393
3405
  /**
3394
3406
  * Returns the cache entry if available and not expired.
3395
3407
  * @param key - The cache key to retrieve.
@@ -3941,6 +3953,28 @@ export declare interface MedplumInfraConfig {
3941
3953
  environment?: StringMap;
3942
3954
  }
3943
3955
 
3956
+ declare class MedplumKeyValueClient {
3957
+ readonly medplum: MedplumClient;
3958
+ constructor(medplum: MedplumClient);
3959
+ /**
3960
+ * Gets the value for the given key from the keyvalue store.
3961
+ * @param key - The key to get the value for.
3962
+ * @returns The value for the given key.
3963
+ */
3964
+ get(key: string): Promise<string | undefined>;
3965
+ /**
3966
+ * Sets the value for the given key in the keyvalue store.
3967
+ * @param key - The key to set the value for.
3968
+ * @param value - The value to set.
3969
+ */
3970
+ set(key: string, value: string): Promise<void>;
3971
+ /**
3972
+ * Deletes the value for the given key from the keyvalue store.
3973
+ * @param key - The key to delete the value for.
3974
+ */
3975
+ delete(key: string): Promise<void>;
3976
+ }
3977
+
3944
3978
  export declare interface MedplumSourceInfraConfig {
3945
3979
  name: ValueOrExternalSecret<string>;
3946
3980
  stackName: ValueOrExternalSecret<string>;
@@ -4464,6 +4498,8 @@ export declare function preciseLessThanOrEquals(a: number, b: number, precision?
4464
4498
  */
4465
4499
  export declare function preciseRound(a: number, precision: number): number;
4466
4500
 
4501
+ export declare const preconditionFailed: OperationOutcome;
4502
+
4467
4503
  export declare abstract class PrefixOperatorAtom implements Atom {
4468
4504
  readonly operator: string;
4469
4505
  readonly child: Atom;
@@ -4736,6 +4772,7 @@ export declare interface SearchRequest<T extends Resource = Resource> {
4736
4772
  summary?: 'true' | 'text' | 'data';
4737
4773
  format?: string;
4738
4774
  pretty?: boolean;
4775
+ types?: T['resourceType'][];
4739
4776
  }
4740
4777
 
4741
4778
  /**
@@ -5122,7 +5159,7 @@ export declare class UnionAtom extends InfixOperatorAtom {
5122
5159
  */
5123
5160
  export declare function validateFhircastSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): boolean;
5124
5161
 
5125
- export declare function validateResource(resource: Resource, profile?: StructureDefinition): void;
5162
+ export declare function validateResource(resource: Resource, options?: ValidatorOptions): OperationOutcomeIssue[];
5126
5163
 
5127
5164
  /**
5128
5165
  * Validates that the given string is a valid FHIR resource type.
@@ -5167,6 +5204,10 @@ export declare function validationError(details: string): OperationOutcome;
5167
5204
 
5168
5205
  export declare const validationRegexes: Record<string, RegExp>;
5169
5206
 
5207
+ export declare interface ValidatorOptions {
5208
+ profile?: StructureDefinition;
5209
+ }
5210
+
5170
5211
  export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
5171
5212
 
5172
5213
  /**
@@ -487,6 +487,8 @@ export declare function createFhircastMessagePayload<EventName extends FhircastE
487
487
 
488
488
  export declare function createFhircastMessagePayload<EventName extends FhircastEventVersionRequired>(topic: string, event: EventName, context: FhircastValidContextForEvent<EventName> | FhircastValidContextForEvent<EventName>[], versionId: string): FhircastMessagePayload<EventName>;
489
489
 
490
+ export declare function createOperationOutcomeIssue(severity: IssueSeverity, code: IssueType, message: string, path: string, data?: Record<string, any>): OperationOutcomeIssue;
491
+
490
492
  export declare interface CreatePdfFunction {
491
493
  (docDefinition: TDocumentDefinitions, tableLayouts?: Record<string, CustomTableLayout> | undefined, fonts?: TFontDictionary | undefined): Promise<any>;
492
494
  }
@@ -2014,6 +2016,10 @@ export declare function isSliceDefinitionWithTypes(slice: SliceDefinition): slic
2014
2016
  */
2015
2017
  export declare function isStringArray(arr: any[]): arr is string[];
2016
2018
 
2019
+ export declare type IssueSeverity = 'error' | 'fatal' | 'warning' | 'information';
2020
+
2021
+ export declare type IssueType = 'structure' | 'invariant' | 'processing';
2022
+
2017
2023
  /**
2018
2024
  * Returns true if the input string is a UUID.
2019
2025
  * @param input - The input string.
@@ -2312,6 +2318,7 @@ export declare class MedplumClient extends EventTarget_2 {
2312
2318
  private basicAuth?;
2313
2319
  private initPromise;
2314
2320
  private initComplete;
2321
+ private keyValueClient?;
2315
2322
  constructor(options?: MedplumClientOptions);
2316
2323
  /**
2317
2324
  * @returns Whether the client has been fully initialized or not. Should always be true unless a custom asynchronous `ClientStorage` was passed into the constructor.
@@ -3390,6 +3397,11 @@ export declare class MedplumClient extends EventTarget_2 {
3390
3397
  * @returns The response body.
3391
3398
  */
3392
3399
  startAsyncRequest<T>(url: string, options?: RequestInit): Promise<T>;
3400
+ /**
3401
+ * Returns the key value client.
3402
+ * @returns The key value client.
3403
+ */
3404
+ get keyValue(): MedplumKeyValueClient;
3393
3405
  /**
3394
3406
  * Returns the cache entry if available and not expired.
3395
3407
  * @param key - The cache key to retrieve.
@@ -3941,6 +3953,28 @@ export declare interface MedplumInfraConfig {
3941
3953
  environment?: StringMap;
3942
3954
  }
3943
3955
 
3956
+ declare class MedplumKeyValueClient {
3957
+ readonly medplum: MedplumClient;
3958
+ constructor(medplum: MedplumClient);
3959
+ /**
3960
+ * Gets the value for the given key from the keyvalue store.
3961
+ * @param key - The key to get the value for.
3962
+ * @returns The value for the given key.
3963
+ */
3964
+ get(key: string): Promise<string | undefined>;
3965
+ /**
3966
+ * Sets the value for the given key in the keyvalue store.
3967
+ * @param key - The key to set the value for.
3968
+ * @param value - The value to set.
3969
+ */
3970
+ set(key: string, value: string): Promise<void>;
3971
+ /**
3972
+ * Deletes the value for the given key from the keyvalue store.
3973
+ * @param key - The key to delete the value for.
3974
+ */
3975
+ delete(key: string): Promise<void>;
3976
+ }
3977
+
3944
3978
  export declare interface MedplumSourceInfraConfig {
3945
3979
  name: ValueOrExternalSecret<string>;
3946
3980
  stackName: ValueOrExternalSecret<string>;
@@ -4464,6 +4498,8 @@ export declare function preciseLessThanOrEquals(a: number, b: number, precision?
4464
4498
  */
4465
4499
  export declare function preciseRound(a: number, precision: number): number;
4466
4500
 
4501
+ export declare const preconditionFailed: OperationOutcome;
4502
+
4467
4503
  export declare abstract class PrefixOperatorAtom implements Atom {
4468
4504
  readonly operator: string;
4469
4505
  readonly child: Atom;
@@ -4736,6 +4772,7 @@ export declare interface SearchRequest<T extends Resource = Resource> {
4736
4772
  summary?: 'true' | 'text' | 'data';
4737
4773
  format?: string;
4738
4774
  pretty?: boolean;
4775
+ types?: T['resourceType'][];
4739
4776
  }
4740
4777
 
4741
4778
  /**
@@ -5122,7 +5159,7 @@ export declare class UnionAtom extends InfixOperatorAtom {
5122
5159
  */
5123
5160
  export declare function validateFhircastSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): boolean;
5124
5161
 
5125
- export declare function validateResource(resource: Resource, profile?: StructureDefinition): void;
5162
+ export declare function validateResource(resource: Resource, options?: ValidatorOptions): OperationOutcomeIssue[];
5126
5163
 
5127
5164
  /**
5128
5165
  * Validates that the given string is a valid FHIR resource type.
@@ -5167,6 +5204,10 @@ export declare function validationError(details: string): OperationOutcome;
5167
5204
 
5168
5205
  export declare const validationRegexes: Record<string, RegExp>;
5169
5206
 
5207
+ export declare interface ValidatorOptions {
5208
+ profile?: StructureDefinition;
5209
+ }
5210
+
5170
5211
  export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
5171
5212
 
5172
5213
  /**