@medplum/core 3.1.10 → 3.1.12

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.
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import { AccessPolicy } from '@medplum/fhirtypes';
4
2
  import { AccessPolicyResource } from '@medplum/fhirtypes';
5
3
  import { Address } from '@medplum/fhirtypes';
@@ -55,6 +53,8 @@ import type { TFontDictionary } from 'pdfmake/interfaces';
55
53
  import { Timing } from '@medplum/fhirtypes';
56
54
  import { UserConfiguration } from '@medplum/fhirtypes';
57
55
  import { ValueSet } from '@medplum/fhirtypes';
56
+ import { ViewDefinition } from '@medplum/fhirtypes';
57
+ import { ViewDefinitionSelect } from '@medplum/fhirtypes';
58
58
 
59
59
  export declare function accepted(location: string): OperationOutcome;
60
60
 
@@ -801,6 +801,14 @@ export declare function evalFhirPath(expression: string, input: unknown): unknow
801
801
  */
802
802
  export declare function evalFhirPathTyped(expression: string, input: TypedValue[], variables?: Record<string, TypedValue>): TypedValue[];
803
803
 
804
+ /**
805
+ * Evaluates a SQL-on-FHIR view on a set of FHIR resources.
806
+ * @param view - The view definition.
807
+ * @param resources - The array of FHIR resources.
808
+ * @returns The output rows.
809
+ */
810
+ export declare function evalSqlOnFhir(view: ViewDefinition, resources: Resource[]): OutputRow[];
811
+
804
812
  declare interface Event_2 {
805
813
  readonly type: string;
806
814
  readonly defaultPrevented?: boolean;
@@ -2579,7 +2587,7 @@ export declare const MEDPLUM_VERSION: string;
2579
2587
  * <meta name="algolia:pageRank" content="100" />
2580
2588
  * </head>
2581
2589
  */
2582
- export declare class MedplumClient extends EventTarget_2 {
2590
+ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMap> {
2583
2591
  private readonly options;
2584
2592
  private readonly fetch;
2585
2593
  private readonly createPdfImpl?;
@@ -2855,7 +2863,7 @@ export declare class MedplumClient extends EventTarget_2 {
2855
2863
  getExternalAuthRedirectUri(authorizeUrl: string, clientId: string, redirectUri: string, loginRequest: BaseLoginRequest, pkceEnabled?: boolean): string;
2856
2864
  /**
2857
2865
  * Builds a FHIR URL from a collection of URL path components.
2858
- * For example, `buildUrl('/Patient', '123')` returns `fhir/R4/Patient/123`.
2866
+ * For example, `fhirUrl('Patient', '123')` returns `fhir/R4/Patient/123`.
2859
2867
  * @category HTTP
2860
2868
  * @param path - The path component of the URL.
2861
2869
  * @returns The well-formed FHIR URL.
@@ -3987,7 +3995,6 @@ export declare class MedplumClient extends EventTarget_2 {
3987
3995
  * This synchronizes state across browser windows and browser tabs.
3988
3996
  */
3989
3997
  private setupStorageListener;
3990
- private retryCatch;
3991
3998
  /**
3992
3999
  * Gets the `SubscriptionManager` for WebSocket subscriptions.
3993
4000
  *
@@ -4056,6 +4063,27 @@ export declare class MedplumClient extends EventTarget_2 {
4056
4063
  getMasterSubscriptionEmitter(): SubscriptionEmitter;
4057
4064
  }
4058
4065
 
4066
+ /**
4067
+ * This map enumerates all the lifecycle events that `MedplumClient` emits and what the shape of the `Event` is.
4068
+ */
4069
+ export declare type MedplumClientEventMap = {
4070
+ change: {
4071
+ type: 'change';
4072
+ };
4073
+ offline: {
4074
+ type: 'offline';
4075
+ };
4076
+ profileRefreshing: {
4077
+ type: 'profileRefreshing';
4078
+ };
4079
+ profileRefreshed: {
4080
+ type: 'profileRefreshed';
4081
+ };
4082
+ storageInitialized: {
4083
+ type: 'storageInitialized';
4084
+ };
4085
+ };
4086
+
4059
4087
  /**
4060
4088
  * The MedplumClientOptions interface defines configuration options for MedplumClient.
4061
4089
  *
@@ -4265,6 +4293,7 @@ export declare interface MedplumInfraConfig {
4265
4293
  rdsSecretsArn?: string;
4266
4294
  rdsReaderInstanceType?: string;
4267
4295
  rdsProxyEnabled?: boolean;
4296
+ rdsForceRetain?: boolean;
4268
4297
  cacheNodeType?: string;
4269
4298
  cacheSecurityGroupId?: string;
4270
4299
  desiredServerCount: number;
@@ -4346,6 +4375,10 @@ export declare interface MedplumRequestOptions extends RequestInit {
4346
4375
  * Default value is 1000 (1 second).
4347
4376
  */
4348
4377
  pollStatusPeriod?: number;
4378
+ /**
4379
+ * Optional max number of retries that should be made in the case of a failed request. Default is `2`.
4380
+ */
4381
+ maxRetries?: number;
4349
4382
  }
4350
4383
 
4351
4384
  export declare interface MedplumSourceInfraConfig {
@@ -4379,6 +4412,7 @@ export declare interface MedplumSourceInfraConfig {
4379
4412
  rdsSecretsArn?: ValueOrExternalSecret<string>;
4380
4413
  rdsReaderInstanceType?: ValueOrExternalSecret<string>;
4381
4414
  rdsProxyEnabled?: ValueOrExternalSecret<boolean>;
4415
+ rdsForceRetain?: ValueOrExternalSecret<boolean>;
4382
4416
  cacheNodeType?: ValueOrExternalSecret<string>;
4383
4417
  cacheSecurityGroupId?: ValueOrExternalSecret<string>;
4384
4418
  desiredServerCount: ValueOrExternalSecret<number>;
@@ -4680,6 +4714,11 @@ export declare class OrAtom extends BooleanInfixOperatorAtom {
4680
4714
  eval(context: AtomContext, input: TypedValue[]): TypedValue[];
4681
4715
  }
4682
4716
 
4717
+ /**
4718
+ * SQL on FHIR output row.
4719
+ */
4720
+ export declare type OutputRow = Record<string, any>;
4721
+
4683
4722
  /**
4684
4723
  * Parses a FHIR criteria string into a SearchRequest.
4685
4724
  * FHIR criteria strings are found on resources such as Subscription.
@@ -5188,6 +5227,21 @@ export declare interface SearchRequest<T extends Resource = Resource> {
5188
5227
  types?: T['resourceType'][];
5189
5228
  }
5190
5229
 
5230
+ /**
5231
+ * Represents a "selection structure" in the SQL-on-FHIR specification.
5232
+ *
5233
+ * In practice, this can be a ViewDefinition or ViewDefinitionSelect.
5234
+ *
5235
+ * TypeScript does not like checks for properties that are not part of the type, so we use this interface instead.
5236
+ */
5237
+ export declare interface SelectionStructure {
5238
+ forEach?: string;
5239
+ forEachOrNull?: string;
5240
+ column?: ViewDefinitionSelect['column'];
5241
+ select?: SelectionStructure[];
5242
+ unionAll?: SelectionStructure[];
5243
+ }
5244
+
5191
5245
  /**
5192
5246
  * Creates a serialized url-encoded payload for a `FHIRcast` subscription from a `SubscriptionRequest` object that can be directly used in an HTTP request to the Hub.
5193
5247
  *
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
-
3
1
  import { AccessPolicy } from '@medplum/fhirtypes';
4
2
  import { AccessPolicyResource } from '@medplum/fhirtypes';
5
3
  import { Address } from '@medplum/fhirtypes';
@@ -55,6 +53,8 @@ import type { TFontDictionary } from 'pdfmake/interfaces';
55
53
  import { Timing } from '@medplum/fhirtypes';
56
54
  import { UserConfiguration } from '@medplum/fhirtypes';
57
55
  import { ValueSet } from '@medplum/fhirtypes';
56
+ import { ViewDefinition } from '@medplum/fhirtypes';
57
+ import { ViewDefinitionSelect } from '@medplum/fhirtypes';
58
58
 
59
59
  export declare function accepted(location: string): OperationOutcome;
60
60
 
@@ -801,6 +801,14 @@ export declare function evalFhirPath(expression: string, input: unknown): unknow
801
801
  */
802
802
  export declare function evalFhirPathTyped(expression: string, input: TypedValue[], variables?: Record<string, TypedValue>): TypedValue[];
803
803
 
804
+ /**
805
+ * Evaluates a SQL-on-FHIR view on a set of FHIR resources.
806
+ * @param view - The view definition.
807
+ * @param resources - The array of FHIR resources.
808
+ * @returns The output rows.
809
+ */
810
+ export declare function evalSqlOnFhir(view: ViewDefinition, resources: Resource[]): OutputRow[];
811
+
804
812
  declare interface Event_2 {
805
813
  readonly type: string;
806
814
  readonly defaultPrevented?: boolean;
@@ -2579,7 +2587,7 @@ export declare const MEDPLUM_VERSION: string;
2579
2587
  * <meta name="algolia:pageRank" content="100" />
2580
2588
  * </head>
2581
2589
  */
2582
- export declare class MedplumClient extends EventTarget_2 {
2590
+ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMap> {
2583
2591
  private readonly options;
2584
2592
  private readonly fetch;
2585
2593
  private readonly createPdfImpl?;
@@ -2855,7 +2863,7 @@ export declare class MedplumClient extends EventTarget_2 {
2855
2863
  getExternalAuthRedirectUri(authorizeUrl: string, clientId: string, redirectUri: string, loginRequest: BaseLoginRequest, pkceEnabled?: boolean): string;
2856
2864
  /**
2857
2865
  * Builds a FHIR URL from a collection of URL path components.
2858
- * For example, `buildUrl('/Patient', '123')` returns `fhir/R4/Patient/123`.
2866
+ * For example, `fhirUrl('Patient', '123')` returns `fhir/R4/Patient/123`.
2859
2867
  * @category HTTP
2860
2868
  * @param path - The path component of the URL.
2861
2869
  * @returns The well-formed FHIR URL.
@@ -3987,7 +3995,6 @@ export declare class MedplumClient extends EventTarget_2 {
3987
3995
  * This synchronizes state across browser windows and browser tabs.
3988
3996
  */
3989
3997
  private setupStorageListener;
3990
- private retryCatch;
3991
3998
  /**
3992
3999
  * Gets the `SubscriptionManager` for WebSocket subscriptions.
3993
4000
  *
@@ -4056,6 +4063,27 @@ export declare class MedplumClient extends EventTarget_2 {
4056
4063
  getMasterSubscriptionEmitter(): SubscriptionEmitter;
4057
4064
  }
4058
4065
 
4066
+ /**
4067
+ * This map enumerates all the lifecycle events that `MedplumClient` emits and what the shape of the `Event` is.
4068
+ */
4069
+ export declare type MedplumClientEventMap = {
4070
+ change: {
4071
+ type: 'change';
4072
+ };
4073
+ offline: {
4074
+ type: 'offline';
4075
+ };
4076
+ profileRefreshing: {
4077
+ type: 'profileRefreshing';
4078
+ };
4079
+ profileRefreshed: {
4080
+ type: 'profileRefreshed';
4081
+ };
4082
+ storageInitialized: {
4083
+ type: 'storageInitialized';
4084
+ };
4085
+ };
4086
+
4059
4087
  /**
4060
4088
  * The MedplumClientOptions interface defines configuration options for MedplumClient.
4061
4089
  *
@@ -4265,6 +4293,7 @@ export declare interface MedplumInfraConfig {
4265
4293
  rdsSecretsArn?: string;
4266
4294
  rdsReaderInstanceType?: string;
4267
4295
  rdsProxyEnabled?: boolean;
4296
+ rdsForceRetain?: boolean;
4268
4297
  cacheNodeType?: string;
4269
4298
  cacheSecurityGroupId?: string;
4270
4299
  desiredServerCount: number;
@@ -4346,6 +4375,10 @@ export declare interface MedplumRequestOptions extends RequestInit {
4346
4375
  * Default value is 1000 (1 second).
4347
4376
  */
4348
4377
  pollStatusPeriod?: number;
4378
+ /**
4379
+ * Optional max number of retries that should be made in the case of a failed request. Default is `2`.
4380
+ */
4381
+ maxRetries?: number;
4349
4382
  }
4350
4383
 
4351
4384
  export declare interface MedplumSourceInfraConfig {
@@ -4379,6 +4412,7 @@ export declare interface MedplumSourceInfraConfig {
4379
4412
  rdsSecretsArn?: ValueOrExternalSecret<string>;
4380
4413
  rdsReaderInstanceType?: ValueOrExternalSecret<string>;
4381
4414
  rdsProxyEnabled?: ValueOrExternalSecret<boolean>;
4415
+ rdsForceRetain?: ValueOrExternalSecret<boolean>;
4382
4416
  cacheNodeType?: ValueOrExternalSecret<string>;
4383
4417
  cacheSecurityGroupId?: ValueOrExternalSecret<string>;
4384
4418
  desiredServerCount: ValueOrExternalSecret<number>;
@@ -4680,6 +4714,11 @@ export declare class OrAtom extends BooleanInfixOperatorAtom {
4680
4714
  eval(context: AtomContext, input: TypedValue[]): TypedValue[];
4681
4715
  }
4682
4716
 
4717
+ /**
4718
+ * SQL on FHIR output row.
4719
+ */
4720
+ export declare type OutputRow = Record<string, any>;
4721
+
4683
4722
  /**
4684
4723
  * Parses a FHIR criteria string into a SearchRequest.
4685
4724
  * FHIR criteria strings are found on resources such as Subscription.
@@ -5188,6 +5227,21 @@ export declare interface SearchRequest<T extends Resource = Resource> {
5188
5227
  types?: T['resourceType'][];
5189
5228
  }
5190
5229
 
5230
+ /**
5231
+ * Represents a "selection structure" in the SQL-on-FHIR specification.
5232
+ *
5233
+ * In practice, this can be a ViewDefinition or ViewDefinitionSelect.
5234
+ *
5235
+ * TypeScript does not like checks for properties that are not part of the type, so we use this interface instead.
5236
+ */
5237
+ export declare interface SelectionStructure {
5238
+ forEach?: string;
5239
+ forEachOrNull?: string;
5240
+ column?: ViewDefinitionSelect['column'];
5241
+ select?: SelectionStructure[];
5242
+ unionAll?: SelectionStructure[];
5243
+ }
5244
+
5191
5245
  /**
5192
5246
  * Creates a serialized url-encoded payload for a `FHIRcast` subscription from a `SubscriptionRequest` object that can be directly used in an HTTP request to the Hub.
5193
5247
  *