@medplum/core 3.1.10 → 3.2.0
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.
- package/dist/cjs/index.cjs +5 -5
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/cjs/index.d.ts +70 -7
- package/dist/esm/index.d.ts +70 -7
- package/dist/esm/index.mjs +5 -5
- package/dist/esm/index.mjs.map +4 -4
- package/package.json +3 -3
package/dist/cjs/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -1193,6 +1201,7 @@ export declare const fhirTypeToJsType: {
|
|
|
1193
1201
|
readonly id: "string";
|
|
1194
1202
|
readonly instant: "string";
|
|
1195
1203
|
readonly integer: "number";
|
|
1204
|
+
readonly integer64: "string";
|
|
1196
1205
|
readonly markdown: "string";
|
|
1197
1206
|
readonly oid: "string";
|
|
1198
1207
|
readonly positiveInt: "number";
|
|
@@ -2579,7 +2588,7 @@ export declare const MEDPLUM_VERSION: string;
|
|
|
2579
2588
|
* <meta name="algolia:pageRank" content="100" />
|
|
2580
2589
|
* </head>
|
|
2581
2590
|
*/
|
|
2582
|
-
export declare class MedplumClient extends
|
|
2591
|
+
export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMap> {
|
|
2583
2592
|
private readonly options;
|
|
2584
2593
|
private readonly fetch;
|
|
2585
2594
|
private readonly createPdfImpl?;
|
|
@@ -2855,7 +2864,7 @@ export declare class MedplumClient extends EventTarget_2 {
|
|
|
2855
2864
|
getExternalAuthRedirectUri(authorizeUrl: string, clientId: string, redirectUri: string, loginRequest: BaseLoginRequest, pkceEnabled?: boolean): string;
|
|
2856
2865
|
/**
|
|
2857
2866
|
* Builds a FHIR URL from a collection of URL path components.
|
|
2858
|
-
* For example, `
|
|
2867
|
+
* For example, `fhirUrl('Patient', '123')` returns `fhir/R4/Patient/123`.
|
|
2859
2868
|
* @category HTTP
|
|
2860
2869
|
* @param path - The path component of the URL.
|
|
2861
2870
|
* @returns The well-formed FHIR URL.
|
|
@@ -3950,8 +3959,8 @@ export declare class MedplumClient extends EventTarget_2 {
|
|
|
3950
3959
|
* @param versionId - The `versionId` of the `anchor context` of the given event. Used for `DiagnosticReport-update` event.
|
|
3951
3960
|
* @returns A `Promise` that resolves once the request completes, or rejects if it fails.
|
|
3952
3961
|
*/
|
|
3953
|
-
fhircastPublish<EventName extends FhircastEventVersionOptional>(topic: string, event: EventName, context: FhircastEventContext<EventName> | FhircastEventContext<EventName>[], versionId?: never): Promise<
|
|
3954
|
-
fhircastPublish<RequiredVersionEvent extends FhircastEventVersionRequired>(topic: string, event: RequiredVersionEvent, context: FhircastEventContext<RequiredVersionEvent> | FhircastEventContext<RequiredVersionEvent>[], versionId: string): Promise<
|
|
3962
|
+
fhircastPublish<EventName extends FhircastEventVersionOptional>(topic: string, event: EventName, context: FhircastEventContext<EventName> | FhircastEventContext<EventName>[], versionId?: never): Promise<Record<string, any>>;
|
|
3963
|
+
fhircastPublish<RequiredVersionEvent extends FhircastEventVersionRequired>(topic: string, event: RequiredVersionEvent, context: FhircastEventContext<RequiredVersionEvent> | FhircastEventContext<RequiredVersionEvent>[], versionId: string): Promise<Record<string, any>>;
|
|
3955
3964
|
/**
|
|
3956
3965
|
* Gets the current context of the given FHIRcast `topic`.
|
|
3957
3966
|
*
|
|
@@ -3987,7 +3996,6 @@ export declare class MedplumClient extends EventTarget_2 {
|
|
|
3987
3996
|
* This synchronizes state across browser windows and browser tabs.
|
|
3988
3997
|
*/
|
|
3989
3998
|
private setupStorageListener;
|
|
3990
|
-
private retryCatch;
|
|
3991
3999
|
/**
|
|
3992
4000
|
* Gets the `SubscriptionManager` for WebSocket subscriptions.
|
|
3993
4001
|
*
|
|
@@ -4056,6 +4064,33 @@ export declare class MedplumClient extends EventTarget_2 {
|
|
|
4056
4064
|
getMasterSubscriptionEmitter(): SubscriptionEmitter;
|
|
4057
4065
|
}
|
|
4058
4066
|
|
|
4067
|
+
/**
|
|
4068
|
+
* This map enumerates all the lifecycle events that `MedplumClient` emits and what the shape of the `Event` is.
|
|
4069
|
+
*/
|
|
4070
|
+
export declare type MedplumClientEventMap = {
|
|
4071
|
+
change: {
|
|
4072
|
+
type: 'change';
|
|
4073
|
+
};
|
|
4074
|
+
offline: {
|
|
4075
|
+
type: 'offline';
|
|
4076
|
+
};
|
|
4077
|
+
profileRefreshing: {
|
|
4078
|
+
type: 'profileRefreshing';
|
|
4079
|
+
};
|
|
4080
|
+
profileRefreshed: {
|
|
4081
|
+
type: 'profileRefreshed';
|
|
4082
|
+
};
|
|
4083
|
+
storageInitialized: {
|
|
4084
|
+
type: 'storageInitialized';
|
|
4085
|
+
};
|
|
4086
|
+
storageInitFailed: {
|
|
4087
|
+
type: 'storageInitFailed';
|
|
4088
|
+
payload: {
|
|
4089
|
+
error: Error;
|
|
4090
|
+
};
|
|
4091
|
+
};
|
|
4092
|
+
};
|
|
4093
|
+
|
|
4059
4094
|
/**
|
|
4060
4095
|
* The MedplumClientOptions interface defines configuration options for MedplumClient.
|
|
4061
4096
|
*
|
|
@@ -4290,6 +4325,7 @@ export declare interface MedplumInfraConfig {
|
|
|
4290
4325
|
[key: string]: string;
|
|
4291
4326
|
};
|
|
4292
4327
|
}[];
|
|
4328
|
+
containerInsights?: boolean;
|
|
4293
4329
|
cloudTrailAlarms?: {
|
|
4294
4330
|
logGroupName: string;
|
|
4295
4331
|
logGroupCreate?: boolean;
|
|
@@ -4346,6 +4382,10 @@ export declare interface MedplumRequestOptions extends RequestInit {
|
|
|
4346
4382
|
* Default value is 1000 (1 second).
|
|
4347
4383
|
*/
|
|
4348
4384
|
pollStatusPeriod?: number;
|
|
4385
|
+
/**
|
|
4386
|
+
* Optional max number of retries that should be made in the case of a failed request. Default is `2`.
|
|
4387
|
+
*/
|
|
4388
|
+
maxRetries?: number;
|
|
4349
4389
|
}
|
|
4350
4390
|
|
|
4351
4391
|
export declare interface MedplumSourceInfraConfig {
|
|
@@ -4404,6 +4444,7 @@ export declare interface MedplumSourceInfraConfig {
|
|
|
4404
4444
|
[key: string]: ValueOrExternalSecret<string>;
|
|
4405
4445
|
};
|
|
4406
4446
|
}[];
|
|
4447
|
+
containerInsights?: ValueOrExternalSecret<boolean>;
|
|
4407
4448
|
cloudTrailAlarms?: {
|
|
4408
4449
|
logGroupName: ValueOrExternalSecret<string>;
|
|
4409
4450
|
logGroupCreate?: ValueOrExternalSecret<boolean>;
|
|
@@ -4680,6 +4721,11 @@ export declare class OrAtom extends BooleanInfixOperatorAtom {
|
|
|
4680
4721
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
4681
4722
|
}
|
|
4682
4723
|
|
|
4724
|
+
/**
|
|
4725
|
+
* SQL on FHIR output row.
|
|
4726
|
+
*/
|
|
4727
|
+
export declare type OutputRow = Record<string, any>;
|
|
4728
|
+
|
|
4683
4729
|
/**
|
|
4684
4730
|
* Parses a FHIR criteria string into a SearchRequest.
|
|
4685
4731
|
* FHIR criteria strings are found on resources such as Subscription.
|
|
@@ -5188,6 +5234,21 @@ export declare interface SearchRequest<T extends Resource = Resource> {
|
|
|
5188
5234
|
types?: T['resourceType'][];
|
|
5189
5235
|
}
|
|
5190
5236
|
|
|
5237
|
+
/**
|
|
5238
|
+
* Represents a "selection structure" in the SQL-on-FHIR specification.
|
|
5239
|
+
*
|
|
5240
|
+
* In practice, this can be a ViewDefinition or ViewDefinitionSelect.
|
|
5241
|
+
*
|
|
5242
|
+
* TypeScript does not like checks for properties that are not part of the type, so we use this interface instead.
|
|
5243
|
+
*/
|
|
5244
|
+
export declare interface SelectionStructure {
|
|
5245
|
+
forEach?: string;
|
|
5246
|
+
forEachOrNull?: string;
|
|
5247
|
+
column?: ViewDefinitionSelect['column'];
|
|
5248
|
+
select?: SelectionStructure[];
|
|
5249
|
+
unionAll?: SelectionStructure[];
|
|
5250
|
+
}
|
|
5251
|
+
|
|
5191
5252
|
/**
|
|
5192
5253
|
* 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
5254
|
*
|
|
@@ -5650,6 +5711,8 @@ export declare function validateResource(resource: Resource, options?: Validator
|
|
|
5650
5711
|
*/
|
|
5651
5712
|
export declare function validateResourceType(resourceType: string): void;
|
|
5652
5713
|
|
|
5714
|
+
export declare function validateTypedValue(typedValue: TypedValue, options?: ValidatorOptions): OperationOutcomeIssue[];
|
|
5715
|
+
|
|
5653
5716
|
export declare function validationError(details: string): OperationOutcome;
|
|
5654
5717
|
|
|
5655
5718
|
export declare const validationRegexes: Record<string, RegExp>;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -1193,6 +1201,7 @@ export declare const fhirTypeToJsType: {
|
|
|
1193
1201
|
readonly id: "string";
|
|
1194
1202
|
readonly instant: "string";
|
|
1195
1203
|
readonly integer: "number";
|
|
1204
|
+
readonly integer64: "string";
|
|
1196
1205
|
readonly markdown: "string";
|
|
1197
1206
|
readonly oid: "string";
|
|
1198
1207
|
readonly positiveInt: "number";
|
|
@@ -2579,7 +2588,7 @@ export declare const MEDPLUM_VERSION: string;
|
|
|
2579
2588
|
* <meta name="algolia:pageRank" content="100" />
|
|
2580
2589
|
* </head>
|
|
2581
2590
|
*/
|
|
2582
|
-
export declare class MedplumClient extends
|
|
2591
|
+
export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMap> {
|
|
2583
2592
|
private readonly options;
|
|
2584
2593
|
private readonly fetch;
|
|
2585
2594
|
private readonly createPdfImpl?;
|
|
@@ -2855,7 +2864,7 @@ export declare class MedplumClient extends EventTarget_2 {
|
|
|
2855
2864
|
getExternalAuthRedirectUri(authorizeUrl: string, clientId: string, redirectUri: string, loginRequest: BaseLoginRequest, pkceEnabled?: boolean): string;
|
|
2856
2865
|
/**
|
|
2857
2866
|
* Builds a FHIR URL from a collection of URL path components.
|
|
2858
|
-
* For example, `
|
|
2867
|
+
* For example, `fhirUrl('Patient', '123')` returns `fhir/R4/Patient/123`.
|
|
2859
2868
|
* @category HTTP
|
|
2860
2869
|
* @param path - The path component of the URL.
|
|
2861
2870
|
* @returns The well-formed FHIR URL.
|
|
@@ -3950,8 +3959,8 @@ export declare class MedplumClient extends EventTarget_2 {
|
|
|
3950
3959
|
* @param versionId - The `versionId` of the `anchor context` of the given event. Used for `DiagnosticReport-update` event.
|
|
3951
3960
|
* @returns A `Promise` that resolves once the request completes, or rejects if it fails.
|
|
3952
3961
|
*/
|
|
3953
|
-
fhircastPublish<EventName extends FhircastEventVersionOptional>(topic: string, event: EventName, context: FhircastEventContext<EventName> | FhircastEventContext<EventName>[], versionId?: never): Promise<
|
|
3954
|
-
fhircastPublish<RequiredVersionEvent extends FhircastEventVersionRequired>(topic: string, event: RequiredVersionEvent, context: FhircastEventContext<RequiredVersionEvent> | FhircastEventContext<RequiredVersionEvent>[], versionId: string): Promise<
|
|
3962
|
+
fhircastPublish<EventName extends FhircastEventVersionOptional>(topic: string, event: EventName, context: FhircastEventContext<EventName> | FhircastEventContext<EventName>[], versionId?: never): Promise<Record<string, any>>;
|
|
3963
|
+
fhircastPublish<RequiredVersionEvent extends FhircastEventVersionRequired>(topic: string, event: RequiredVersionEvent, context: FhircastEventContext<RequiredVersionEvent> | FhircastEventContext<RequiredVersionEvent>[], versionId: string): Promise<Record<string, any>>;
|
|
3955
3964
|
/**
|
|
3956
3965
|
* Gets the current context of the given FHIRcast `topic`.
|
|
3957
3966
|
*
|
|
@@ -3987,7 +3996,6 @@ export declare class MedplumClient extends EventTarget_2 {
|
|
|
3987
3996
|
* This synchronizes state across browser windows and browser tabs.
|
|
3988
3997
|
*/
|
|
3989
3998
|
private setupStorageListener;
|
|
3990
|
-
private retryCatch;
|
|
3991
3999
|
/**
|
|
3992
4000
|
* Gets the `SubscriptionManager` for WebSocket subscriptions.
|
|
3993
4001
|
*
|
|
@@ -4056,6 +4064,33 @@ export declare class MedplumClient extends EventTarget_2 {
|
|
|
4056
4064
|
getMasterSubscriptionEmitter(): SubscriptionEmitter;
|
|
4057
4065
|
}
|
|
4058
4066
|
|
|
4067
|
+
/**
|
|
4068
|
+
* This map enumerates all the lifecycle events that `MedplumClient` emits and what the shape of the `Event` is.
|
|
4069
|
+
*/
|
|
4070
|
+
export declare type MedplumClientEventMap = {
|
|
4071
|
+
change: {
|
|
4072
|
+
type: 'change';
|
|
4073
|
+
};
|
|
4074
|
+
offline: {
|
|
4075
|
+
type: 'offline';
|
|
4076
|
+
};
|
|
4077
|
+
profileRefreshing: {
|
|
4078
|
+
type: 'profileRefreshing';
|
|
4079
|
+
};
|
|
4080
|
+
profileRefreshed: {
|
|
4081
|
+
type: 'profileRefreshed';
|
|
4082
|
+
};
|
|
4083
|
+
storageInitialized: {
|
|
4084
|
+
type: 'storageInitialized';
|
|
4085
|
+
};
|
|
4086
|
+
storageInitFailed: {
|
|
4087
|
+
type: 'storageInitFailed';
|
|
4088
|
+
payload: {
|
|
4089
|
+
error: Error;
|
|
4090
|
+
};
|
|
4091
|
+
};
|
|
4092
|
+
};
|
|
4093
|
+
|
|
4059
4094
|
/**
|
|
4060
4095
|
* The MedplumClientOptions interface defines configuration options for MedplumClient.
|
|
4061
4096
|
*
|
|
@@ -4290,6 +4325,7 @@ export declare interface MedplumInfraConfig {
|
|
|
4290
4325
|
[key: string]: string;
|
|
4291
4326
|
};
|
|
4292
4327
|
}[];
|
|
4328
|
+
containerInsights?: boolean;
|
|
4293
4329
|
cloudTrailAlarms?: {
|
|
4294
4330
|
logGroupName: string;
|
|
4295
4331
|
logGroupCreate?: boolean;
|
|
@@ -4346,6 +4382,10 @@ export declare interface MedplumRequestOptions extends RequestInit {
|
|
|
4346
4382
|
* Default value is 1000 (1 second).
|
|
4347
4383
|
*/
|
|
4348
4384
|
pollStatusPeriod?: number;
|
|
4385
|
+
/**
|
|
4386
|
+
* Optional max number of retries that should be made in the case of a failed request. Default is `2`.
|
|
4387
|
+
*/
|
|
4388
|
+
maxRetries?: number;
|
|
4349
4389
|
}
|
|
4350
4390
|
|
|
4351
4391
|
export declare interface MedplumSourceInfraConfig {
|
|
@@ -4404,6 +4444,7 @@ export declare interface MedplumSourceInfraConfig {
|
|
|
4404
4444
|
[key: string]: ValueOrExternalSecret<string>;
|
|
4405
4445
|
};
|
|
4406
4446
|
}[];
|
|
4447
|
+
containerInsights?: ValueOrExternalSecret<boolean>;
|
|
4407
4448
|
cloudTrailAlarms?: {
|
|
4408
4449
|
logGroupName: ValueOrExternalSecret<string>;
|
|
4409
4450
|
logGroupCreate?: ValueOrExternalSecret<boolean>;
|
|
@@ -4680,6 +4721,11 @@ export declare class OrAtom extends BooleanInfixOperatorAtom {
|
|
|
4680
4721
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
4681
4722
|
}
|
|
4682
4723
|
|
|
4724
|
+
/**
|
|
4725
|
+
* SQL on FHIR output row.
|
|
4726
|
+
*/
|
|
4727
|
+
export declare type OutputRow = Record<string, any>;
|
|
4728
|
+
|
|
4683
4729
|
/**
|
|
4684
4730
|
* Parses a FHIR criteria string into a SearchRequest.
|
|
4685
4731
|
* FHIR criteria strings are found on resources such as Subscription.
|
|
@@ -5188,6 +5234,21 @@ export declare interface SearchRequest<T extends Resource = Resource> {
|
|
|
5188
5234
|
types?: T['resourceType'][];
|
|
5189
5235
|
}
|
|
5190
5236
|
|
|
5237
|
+
/**
|
|
5238
|
+
* Represents a "selection structure" in the SQL-on-FHIR specification.
|
|
5239
|
+
*
|
|
5240
|
+
* In practice, this can be a ViewDefinition or ViewDefinitionSelect.
|
|
5241
|
+
*
|
|
5242
|
+
* TypeScript does not like checks for properties that are not part of the type, so we use this interface instead.
|
|
5243
|
+
*/
|
|
5244
|
+
export declare interface SelectionStructure {
|
|
5245
|
+
forEach?: string;
|
|
5246
|
+
forEachOrNull?: string;
|
|
5247
|
+
column?: ViewDefinitionSelect['column'];
|
|
5248
|
+
select?: SelectionStructure[];
|
|
5249
|
+
unionAll?: SelectionStructure[];
|
|
5250
|
+
}
|
|
5251
|
+
|
|
5191
5252
|
/**
|
|
5192
5253
|
* 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
5254
|
*
|
|
@@ -5650,6 +5711,8 @@ export declare function validateResource(resource: Resource, options?: Validator
|
|
|
5650
5711
|
*/
|
|
5651
5712
|
export declare function validateResourceType(resourceType: string): void;
|
|
5652
5713
|
|
|
5714
|
+
export declare function validateTypedValue(typedValue: TypedValue, options?: ValidatorOptions): OperationOutcomeIssue[];
|
|
5715
|
+
|
|
5653
5716
|
export declare function validationError(details: string): OperationOutcome;
|
|
5654
5717
|
|
|
5655
5718
|
export declare const validationRegexes: Record<string, RegExp>;
|