@medplum/core 4.5.1 → 5.0.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.
@@ -26,6 +26,7 @@ import type { HumanName } from '@medplum/fhirtypes';
26
26
  import type { Identifier } from '@medplum/fhirtypes';
27
27
  import type { ImagingStudy } from '@medplum/fhirtypes';
28
28
  import type { Media } from '@medplum/fhirtypes';
29
+ import type { Meta } from '@medplum/fhirtypes';
29
30
  import type { Money } from '@medplum/fhirtypes';
30
31
  import type { Observation } from '@medplum/fhirtypes';
31
32
  import type { ObservationComponent } from '@medplum/fhirtypes';
@@ -480,7 +481,9 @@ export declare function clearReleaseCache(): void;
480
481
  */
481
482
  export declare class ClientStorage implements IClientStorage {
482
483
  private readonly storage;
483
- constructor(storage?: Storage);
484
+ private readonly prefix;
485
+ constructor(storage?: Storage, prefix?: string);
486
+ makeKey(key: string): string;
484
487
  clear(): void;
485
488
  getString(key: string): string | undefined;
486
489
  setString(key: string, value: string | undefined): void;
@@ -1057,6 +1060,13 @@ export declare const ExternalSecretSystems: {
1057
1060
  readonly aws_ssm_parameter_store: "aws_ssm_parameter_store";
1058
1061
  };
1059
1062
 
1063
+ /**
1064
+ * Normalizes Medplum's `meta.account` and `meta.accounts` into a singular array of FHIR references.
1065
+ * @param meta - The `meta` object of a FHIR resource.
1066
+ * @returns An array of references, or `undefined` if none.
1067
+ */
1068
+ export declare function extractAccountReferences(meta: Meta | undefined): Reference[] | undefined;
1069
+
1060
1070
  /**
1061
1071
  * Fetches the latest Medplum release version string.
1062
1072
  * @param appName - The name of the app to fetch the latest version for.
@@ -2304,6 +2314,7 @@ export declare interface IClientStorage {
2304
2314
  setString(key: string, value: string | undefined): void;
2305
2315
  getObject<T>(key: string): T | undefined;
2306
2316
  setObject<T>(key: string, value: T): void;
2317
+ makeKey(key: string): string;
2307
2318
  }
2308
2319
 
2309
2320
  export declare interface ILogger {
@@ -2459,6 +2470,8 @@ export declare interface InternalTypeSchema {
2459
2470
  mandatoryProperties?: Set<string>;
2460
2471
  }
2461
2472
 
2473
+ export declare function invalidSearchOperator(operator: Operator, searchParameterCodeOrId: string): OperationOutcome;
2474
+
2462
2475
  export declare interface InviteRequest {
2463
2476
  resourceType: 'Patient' | 'Practitioner' | 'RelatedPerson';
2464
2477
  firstName: string;
@@ -4962,6 +4975,12 @@ export declare interface MedplumClientOptions {
4962
4975
  * This can be used to set custom headers such as Cookies or Authorization headers.
4963
4976
  */
4964
4977
  defaultHeaders?: Record<string, string>;
4978
+ /**
4979
+ * Prefix to add to all keys when using `localStorage` as the backing store for `ClientStorage` (the default option in the browser).
4980
+ *
4981
+ * Default is `''` (no prefix).
4982
+ */
4983
+ storagePrefix?: string;
4965
4984
  }
4966
4985
 
4967
4986
  export declare interface MedplumInfraConfig {
@@ -4996,6 +5015,7 @@ export declare interface MedplumInfraConfig {
4996
5015
  rdsInstanceType: string;
4997
5016
  rdsInstanceVersion?: string;
4998
5017
  rdsClusterParameters?: StringMap;
5018
+ rdsAutoMinorVersionUpgrade?: boolean;
4999
5019
  rdsSecretsArn?: string;
5000
5020
  rdsReaderInstanceType?: string;
5001
5021
  rdsProxyEnabled?: boolean;
@@ -5026,8 +5046,7 @@ export declare interface MedplumInfraConfig {
5026
5046
  [key: string]: string;
5027
5047
  };
5028
5048
  }[];
5029
- /** @deprecated Use containerInsightsV2 instead */
5030
- containerInsights?: boolean;
5049
+ containerRegistryCredentialsSecretArn?: string;
5031
5050
  containerInsightsV2?: 'enabled' | 'disabled' | 'enhanced';
5032
5051
  cloudTrailAlarms?: {
5033
5052
  logGroupName: string;
@@ -5155,6 +5174,7 @@ export declare interface MedplumSourceInfraConfig {
5155
5174
  rdsReaderInstanceType?: ValueOrExternalSecret<string>;
5156
5175
  rdsProxyEnabled?: ValueOrExternalSecret<boolean>;
5157
5176
  rdsClusterParameters?: StringMap;
5177
+ rdsAutoMinorVersionUpgrade?: ValueOrExternalSecret<boolean>;
5158
5178
  cacheNodeType?: ValueOrExternalSecret<string>;
5159
5179
  cacheSecurityGroupId?: ValueOrExternalSecret<string>;
5160
5180
  desiredServerCount: ValueOrExternalSecret<number>;
@@ -5182,8 +5202,7 @@ export declare interface MedplumSourceInfraConfig {
5182
5202
  [key: string]: ValueOrExternalSecret<string>;
5183
5203
  };
5184
5204
  }[];
5185
- /** @deprecated Use containerInsightsV2 instead */
5186
- containerInsights?: ValueOrExternalSecret<boolean>;
5205
+ containerRegistryCredentialsSecretArn?: ValueOrExternalSecret<string>;
5187
5206
  containerInsightsV2?: ValueOrExternalSecret<'enabled' | 'disabled' | 'enhanced'>;
5188
5207
  cloudTrailAlarms?: {
5189
5208
  logGroupName: ValueOrExternalSecret<string>;
@@ -5199,8 +5218,8 @@ export declare interface MedplumSourceInfraConfig {
5199
5218
  scaleOutCooldown: ValueOrExternalSecret<number>;
5200
5219
  };
5201
5220
  environment?: StringMap;
5202
- rdsIdsMajorVersionSuffix?: boolean;
5203
- rdsPersistentParameterGroups?: boolean;
5221
+ rdsIdsMajorVersionSuffix?: ValueOrExternalSecret<boolean>;
5222
+ rdsPersistentParameterGroups?: ValueOrExternalSecret<boolean>;
5204
5223
  fireLens?: {
5205
5224
  enabled: true;
5206
5225
  logDriverConfig?: {
@@ -5605,1152 +5624,1155 @@ export declare class ParserBuilder {
5605
5624
  * Parses a reference and returns a tuple of [ResourceType, ID].
5606
5625
  * @param reference - A reference to a FHIR resource.
5607
5626
  * @returns A tuple containing the `ResourceType` and the ID of the resource.
5608
- * @throws {OperationOutcomeError} If the reference cannot be parsed.
5609
- */
5610
- export declare function parseReference<T extends Resource>(reference: Reference<T> | undefined): [T['resourceType'], string];
5611
-
5612
- /**
5613
- * Parses a search URL into a search request.
5614
- * @param url - The original search URL or the FHIR resource type.
5615
- * @param query - Optional collection of additional query string parameters.
5616
- * @returns A parsed SearchRequest.
5617
- */
5618
- export declare function parseSearchRequest<T extends Resource = Resource>(url: T['resourceType'] | URL | string, query?: Record<string, string[] | string | undefined>): SearchRequest<T>;
5619
-
5620
- /**
5621
- * Parses a StructureDefinition resource into an internal schema better suited for
5622
- * programmatic validation and usage in internal systems
5623
- * @param sd - The StructureDefinition resource to parse
5624
- * @returns The parsed schema for the given resource type
5625
- * @experimental
5626
- */
5627
- export declare function parseStructureDefinition(sd: StructureDefinition): InternalTypeSchema;
5628
-
5629
- /**
5630
- * Parses an extended FHIR search criteria string (i.e. application/x-fhir-query).
5631
- *
5632
- * @example Evaluating a FHIRPath subexpression
5633
- *
5634
- * ```typescript
5635
- * const query = 'Patient?name={{ %patient.name }}';
5636
- * const variables = { patient: { name: 'John Doe' } };
5637
- * const request = parseXFhirQuery(query, variables);
5638
- * console.log(request.filters[0].value); // "John Doe"
5639
- * ```
5640
- *
5641
- * @see https://hl7.org/fhir/fhir-xquery.html
5642
- * @param query - The X-Fhir-Query string to parse
5643
- * @param variables - Values to pass into embedded FHIRPath expressions
5644
- * @returns The parsed search request
5645
- */
5646
- export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>): SearchRequest;
5647
-
5648
- /**
5649
- * JSONPatch patch operation.
5650
- * Compatible with fast-json-patch and rfc6902 Operation.
5651
- */
5652
- export declare interface PatchOperation {
5653
- readonly op: 'add' | 'remove' | 'replace' | 'copy' | 'move' | 'test';
5654
- readonly path: string;
5655
- readonly value?: any;
5656
- }
5657
-
5658
- export declare type PendingSubscriptionRequest = Omit<SubscriptionRequest, 'endpoint'>;
5659
-
5660
- /**
5661
- * Returns true if the two numbers are equal to the given precision.
5662
- * @param a - The first number.
5663
- * @param b - The second number.
5664
- * @param precision - Optional precision in number of digits.
5665
- * @returns True if the two numbers are equal to the given precision.
5666
- */
5667
- export declare function preciseEquals(a: number, b: number, precision?: number): boolean;
5668
-
5669
- /**
5670
- * Returns true if the first number is greater than the second number to the given precision.
5671
- * @param a - The first number.
5672
- * @param b - The second number.
5673
- * @param precision - Optional precision in number of digits.
5674
- * @returns True if the first number is greater than the second number to the given precision.
5675
- */
5676
- export declare function preciseGreaterThan(a: number, b: number, precision?: number): boolean;
5677
-
5678
- /**
5679
- * Returns true if the first number is greater than or equal to the second number to the given precision.
5680
- * @param a - The first number.
5681
- * @param b - The second number.
5682
- * @param precision - Optional precision in number of digits.
5683
- * @returns True if the first number is greater than or equal to the second number to the given precision.
5684
- */
5685
- export declare function preciseGreaterThanOrEquals(a: number, b: number, precision?: number): boolean;
5686
-
5687
- /**
5688
- * Returns true if the first number is less than the second number to the given precision.
5689
- * @param a - The first number.
5690
- * @param b - The second number.
5691
- * @param precision - Optional precision in number of digits.
5692
- * @returns True if the first number is less than the second number to the given precision.
5693
- */
5694
- export declare function preciseLessThan(a: number, b: number, precision?: number): boolean;
5695
-
5696
- /**
5697
- * Returns true if the first number is less than or equal to the second number to the given precision.
5698
- * @param a - The first number.
5699
- * @param b - The second number.
5700
- * @param precision - Optional precision in number of digits.
5701
- * @returns True if the first number is less than or equal to the second number to the given precision.
5702
- */
5703
- export declare function preciseLessThanOrEquals(a: number, b: number, precision?: number): boolean;
5704
-
5705
- /**
5706
- * Returns the input number rounded to the specified number of digits.
5707
- * @param a - The input number.
5708
- * @param precision - The precision in number of digits.
5709
- * @returns The number rounded to the specified number of digits.
5710
- */
5711
- export declare function preciseRound(a: number, precision: number): number;
5712
-
5713
- export declare const preconditionFailed: OperationOutcome;
5714
-
5715
- export declare abstract class PrefixOperatorAtom implements Atom {
5716
- readonly operator: string;
5717
- readonly child: Atom;
5718
- constructor(operator: string, child: Atom);
5719
- abstract eval(context: AtomContext, input: TypedValue[]): TypedValue[];
5720
- toString(): string;
5721
- }
5722
-
5723
- export declare interface PrefixParselet {
5724
- parse(parser: Parser, token: Token): Atom;
5725
- }
5726
-
5727
- export declare type ProfileResource = Patient | Practitioner | RelatedPerson;
5728
-
5729
- /**
5730
- * Project admin resource types are special resources that are only
5731
- * accessible to project administrators.
5732
- */
5733
- export declare const projectAdminResourceTypes: string[];
5734
-
5735
- /**
5736
- * List of property types.
5737
- * http://www.hl7.org/fhir/valueset-defined-types.html
5738
- * The list here includes additions found from StructureDefinition resources.
5739
- */
5740
- export declare const PropertyType: {
5741
- readonly Address: "Address";
5742
- readonly Age: "Age";
5743
- readonly Annotation: "Annotation";
5744
- readonly Attachment: "Attachment";
5745
- readonly BackboneElement: "BackboneElement";
5746
- readonly CodeableConcept: "CodeableConcept";
5747
- readonly Coding: "Coding";
5748
- readonly ContactDetail: "ContactDetail";
5749
- readonly ContactPoint: "ContactPoint";
5750
- readonly Contributor: "Contributor";
5751
- readonly Count: "Count";
5752
- readonly DataRequirement: "DataRequirement";
5753
- readonly Distance: "Distance";
5754
- readonly Dosage: "Dosage";
5755
- readonly Duration: "Duration";
5756
- readonly Expression: "Expression";
5757
- readonly Extension: "Extension";
5758
- readonly HumanName: "HumanName";
5759
- readonly Identifier: "Identifier";
5760
- readonly MarketingStatus: "MarketingStatus";
5761
- readonly Meta: "Meta";
5762
- readonly Money: "Money";
5763
- readonly Narrative: "Narrative";
5764
- readonly ParameterDefinition: "ParameterDefinition";
5765
- readonly Period: "Period";
5766
- readonly Population: "Population";
5767
- readonly ProdCharacteristic: "ProdCharacteristic";
5768
- readonly ProductShelfLife: "ProductShelfLife";
5769
- readonly Quantity: "Quantity";
5770
- readonly Range: "Range";
5771
- readonly Ratio: "Ratio";
5772
- readonly Reference: "Reference";
5773
- readonly RelatedArtifact: "RelatedArtifact";
5774
- readonly SampledData: "SampledData";
5775
- readonly Signature: "Signature";
5776
- readonly SubstanceAmount: "SubstanceAmount";
5777
- readonly SystemString: "http://hl7.org/fhirpath/System.String";
5778
- readonly Timing: "Timing";
5779
- readonly TriggerDefinition: "TriggerDefinition";
5780
- readonly UsageContext: "UsageContext";
5781
- readonly base64Binary: "base64Binary";
5782
- readonly boolean: "boolean";
5783
- readonly canonical: "canonical";
5784
- readonly code: "code";
5785
- readonly date: "date";
5786
- readonly dateTime: "dateTime";
5787
- readonly decimal: "decimal";
5788
- readonly id: "id";
5789
- readonly instant: "instant";
5790
- readonly integer: "integer";
5791
- readonly markdown: "markdown";
5792
- readonly oid: "oid";
5793
- readonly positiveInt: "positiveInt";
5794
- readonly string: "string";
5795
- readonly time: "time";
5796
- readonly unsignedInt: "unsignedInt";
5797
- readonly uri: "uri";
5798
- readonly url: "url";
5799
- readonly uuid: "uuid";
5800
- };
5801
-
5802
- /**
5803
- * Protected resource types are in the "medplum" project.
5804
- * Reading and writing is limited to the system account.
5805
- */
5806
- export declare const protectedResourceTypes: string[];
5807
-
5808
- export declare type ProtocolsProvider = null | string | string[];
5809
-
5810
- export declare interface PushToAgentOptions extends MedplumRequestOptions {
5811
- /**
5812
- * Time to wait before request timeout in milliseconds; defaults to `10000` (10 s)
5813
- */
5814
- waitTimeout?: number;
5815
- }
5816
-
5817
- export declare type QuantityUnit = Pick<Quantity, 'unit' | 'code' | 'system'>;
5818
-
5819
- /**
5820
- * QueryTypes defines the different ways to specify FHIR search parameters.
5821
- *
5822
- * Can be any valid input to the URLSearchParams() constructor.
5823
- *
5824
- * TypeScript definitions for URLSearchParams do not match runtime behavior.
5825
- * The official spec only accepts string values.
5826
- * Web browsers and Node.js automatically coerce values to strings.
5827
- * See: https://github.com/microsoft/TypeScript/issues/32951
5828
- */
5829
- export declare type QueryTypes = URLSearchParams | string[][] | Record<string, string | number | boolean | undefined> | string | undefined;
5830
-
5831
- export declare type RateLimitInfo = {
5832
- name: string;
5833
- remainingUnits: number;
5834
- secondsUntilReset: number;
5835
- };
5836
-
5837
- /**
5838
- * The ReadablePromise class wraps a request promise suitable for React Suspense.
5839
- * See: https://blog.logrocket.com/react-suspense-data-fetching/#wrappromise-js
5840
- * See: https://github.com/ovieokeh/suspense-data-fetching/blob/master/lib/api/wrapPromise.js
5841
- */
5842
- export declare class ReadablePromise<T> implements Promise<T> {
5843
- readonly [Symbol.toStringTag]: string;
5844
- private readonly suspender;
5845
- private status;
5846
- private response;
5847
- private error;
5848
- constructor(requestPromise: Promise<T>);
5849
- /**
5850
- * Returns true if the promise is pending.
5851
- * @returns True if the Promise is pending.
5852
- */
5853
- isPending(): boolean;
5854
- /**
5855
- * Returns true if the promise resolved successfully.
5856
- * @returns True if the Promise resolved successfully.
5857
- */
5858
- isOk(): boolean;
5859
- /**
5860
- * Attempts to read the value of the promise.
5861
- * If the promise is pending, this method will throw a promise.
5862
- * If the promise rejected, this method will throw the rejection reason.
5863
- * If the promise resolved, this method will return the resolved value.
5864
- * @returns The resolved value of the Promise.
5865
- */
5866
- read(): T;
5867
- /**
5868
- * Attaches callbacks for the resolution and/or rejection of the Promise.
5869
- * @param onfulfilled - The callback to execute when the Promise is resolved.
5870
- * @param onrejected - The callback to execute when the Promise is rejected.
5871
- * @returns A Promise for the completion of which ever callback is executed.
5872
- */
5873
- then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
5874
- /**
5875
- * Attaches a callback for only the rejection of the Promise.
5876
- * @param onrejected - The callback to execute when the Promise is rejected.
5877
- * @returns A Promise for the completion of the callback.
5878
- */
5879
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
5880
- /**
5881
- * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
5882
- * resolved value cannot be modified from the callback.
5883
- * @param onfinally - The callback to execute when the Promise is settled (fulfilled or rejected).
5884
- * @returns A Promise for the completion of the callback.
5885
- */
5886
- finally(onfinally?: (() => void) | null): Promise<T>;
5887
- }
5888
-
5889
- export declare interface ReadHistoryOptions {
5890
- readonly count?: number;
5891
- readonly offset?: number;
5892
- }
5893
-
5894
- export declare const readInteractions: AccessPolicyInteraction[];
5895
-
5896
- export declare class ReconnectingWebSocket<WS extends IWebSocket = WebSocket> extends TypedEventTarget<WebSocketEventMap_2> implements IReconnectingWebSocket {
5897
- private _ws;
5898
- private _retryCount;
5899
- private _uptimeTimeout;
5900
- private _connectTimeout;
5901
- private _shouldReconnect;
5902
- private _connectLock;
5903
- private _binaryType;
5904
- private _closeCalled;
5905
- private _messageQueue;
5906
- private readonly _debugLogger;
5907
- protected _url: string;
5908
- protected _protocols?: ProtocolsProvider;
5909
- protected _options: Options<WS>;
5910
- constructor(url: string, protocols?: ProtocolsProvider, options?: Options<WS>);
5911
- static get CONNECTING(): number;
5912
- static get OPEN(): number;
5913
- static get CLOSING(): number;
5914
- static get CLOSED(): number;
5915
- get CONNECTING(): number;
5916
- get OPEN(): number;
5917
- get CLOSING(): number;
5918
- get CLOSED(): number;
5919
- get binaryType(): WS['binaryType'];
5920
- set binaryType(value: WS['binaryType']);
5921
- /**
5922
- * @returns The number or connection retries.
5923
- */
5924
- get retryCount(): number;
5925
- /**
5926
- * @returns The number of bytes of data that have been queued using calls to send() but not yet
5927
- * transmitted to the network. This value resets to zero once all queued data has been sent.
5928
- * This value does not reset to zero when the connection is closed; if you keep calling send(),
5929
- * this will continue to climb. Read only
5930
- *
5931
- */
5932
- get bufferedAmount(): number;
5933
- /**
5934
- * @returns The extensions selected by the server. This is currently only the empty string or a list of
5935
- * extensions as negotiated by the connection
5936
- */
5937
- get extensions(): string;
5938
- /**
5939
- * @returns A string indicating the name of the sub-protocol the server selected;
5940
- * this will be one of the strings specified in the protocols parameter when creating the
5941
- * WebSocket object.
5942
- */
5943
- get protocol(): string;
5944
- /**
5945
- * @returns The current state of the connection; this is one of the Ready state constants.
5946
- */
5947
- get readyState(): number;
5948
- /**
5949
- * @returns The URL as resolved by the constructor.
5950
- */
5951
- get url(): string;
5952
- /**
5953
- * @returns Whether the websocket object is now in reconnectable state.
5954
- */
5955
- get shouldReconnect(): boolean;
5956
- /**
5957
- * An event listener to be called when the WebSocket connection's readyState changes to CLOSED
5958
- */
5959
- onclose: ((event: CloseEvent_2) => void) | null;
5960
- /**
5961
- * An event listener to be called when an error occurs
5962
- */
5963
- onerror: ((event: ErrorEvent_2) => void) | null;
5964
- /**
5965
- * An event listener to be called when a message is received from the server
5966
- */
5967
- onmessage: ((event: MessageEvent) => void) | null;
5968
- /**
5969
- * An event listener to be called when the WebSocket connection's readyState changes to OPEN;
5970
- * this indicates that the connection is ready to send and receive data
5971
- */
5972
- onopen: ((event: Event) => void) | null;
5973
- /**
5974
- * Closes the WebSocket connection or connection attempt, if any. If the connection is already
5975
- * CLOSED, this method does nothing
5976
- * @param code - The code to close with. Default is 1000.
5977
- * @param reason - An optional reason for closing the connection.
5978
- */
5979
- close(code?: number, reason?: string): void;
5980
- /**
5981
- * Closes the WebSocket connection or connection attempt and connects again.
5982
- * Resets retry counter;
5983
- * @param code - The code to disconnect with. Default is 1000.
5984
- * @param reason - An optional reason for disconnecting the connection.
5985
- */
5986
- reconnect(code?: number, reason?: string): void;
5987
- /**
5988
- * Enqueue specified data to be transmitted to the server over the WebSocket connection
5989
- * @param data - The data to enqueue.
5990
- */
5991
- send(data: Message): void;
5992
- private _debug;
5993
- private _getNextDelay;
5994
- private _wait;
5995
- private _connect;
5996
- private _handleTimeout;
5997
- private _disconnect;
5998
- private _acceptOpen;
5999
- private readonly _handleOpen;
6000
- private readonly _handleMessage;
6001
- private readonly _handleError;
6002
- private readonly _handleClose;
6003
- private _removeListeners;
6004
- private _addListeners;
6005
- private _clearTimeouts;
6006
- }
6007
-
6008
- export declare function redirect(url: URL): OperationOutcome;
6009
-
6010
- export declare type ReleaseManifest = {
6011
- tag_name: string;
6012
- assets: {
6013
- name: string;
6014
- browser_download_url: string;
6015
- }[];
6016
- };
6017
-
6018
- /**
6019
- * Removes duplicates in array using FHIRPath equality rules.
6020
- * @param arr - The input array.
6021
- * @returns The result array with duplicates removed.
6022
- */
6023
- export declare function removeDuplicates(arr: TypedValue[]): TypedValue[];
6024
-
6025
- /**
6026
- * Removes the supplied profileUrl from the resource.meta.profile if it is present
6027
- * @param resource - A FHIR resource
6028
- * @param profileUrl - The profile URL to remove
6029
- * @returns The resource
6030
- */
6031
- export declare function removeProfileFromResource<T extends Resource = Resource>(resource: T, profileUrl: string): T;
6032
-
6033
- /**
6034
- * Topologically sorts a `batch` or `transaction` bundle to improve reference resolution.
6035
- * The bundle is sorted such that a resource is created _before_ references to that resource appear in the bundle.
6036
- *
6037
- * In the event of cycles, this function will first create a POST request for each resource in the cycle, and then will
6038
- * append a PUT request to the bundle. This ensures that each resources in the cycle is visited twice, and all
6039
- * references can be resolved
6040
- * @param bundle - Input bundle with type `batch` or `transaction`
6041
- * @returns Bundle of the same type, with Bundle.entry reordered
6042
- */
6043
- export declare function reorderBundle(bundle: Bundle): Bundle;
6044
-
6045
- export declare interface RequestProfileSchemaOptions {
6046
- /** (optional) Whether to include nested profiles, e.g. from extensions. Defaults to false. */
6047
- expandProfile?: boolean;
6048
- }
6049
-
6050
- /**
6051
- * Returns the ID portion of a reference.
6052
- * @param input - A FHIR reference or resource.
6053
- * @returns The ID portion of a reference.
6054
- */
6055
- export declare function resolveId(input: Reference | Resource | undefined): string | undefined;
6056
-
6057
- /**
6058
- * ResourceArray is an array of resources with a bundle property.
6059
- * The bundle property is a FHIR Bundle containing the search results.
6060
- * This is useful for retrieving bundle metadata such as total, offset, and next link.
6061
- */
6062
- export declare type ResourceArray<T extends Resource = Resource> = T[] & {
6063
- bundle: Bundle<T>;
6064
- };
6065
-
6066
- export declare type ResourceMatchesSubscriptionCriteria = {
6067
- resource: Resource;
6068
- subscription: Subscription;
6069
- context: BackgroundJobContext;
6070
- logger?: Logger;
6071
- getPreviousResource: (currentResource: Resource) => Promise<Resource | undefined>;
6072
- };
6073
-
6074
- export declare function resourceMatchesSubscriptionCriteria({ resource, subscription, context, getPreviousResource, logger, }: ResourceMatchesSubscriptionCriteria): Promise<boolean>;
6075
-
6076
- export declare type ResourceWithCode = Resource & Code;
6077
-
6078
- export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
6079
-
6080
- export declare type SamplingInfo = Omit<SampledData, 'data'>;
6081
-
6082
- /**
6083
- * Checks that there is an access policy permitting the given resource interaction, returning the matching policy object.
6084
- * @param resource - The resource being acted upon.
6085
- * @param interaction - The interaction being performed on the resource.
6086
- * @param accessPolicy - The relevant access policy for the current user.
6087
- * @returns The satisfied access policy, or undefined if the access policy does not permit the given interaction.
6088
- */
6089
- export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
6090
-
6091
- export declare interface SearchableToken {
6092
- readonly system: string | undefined;
6093
- readonly value: string | undefined;
6094
- }
6095
-
6096
- export declare interface SearchParameterDetails {
6097
- readonly type: SearchParameterType;
6098
- readonly elementDefinitions?: InternalSchemaElement[];
6099
- readonly parsedExpression: FhirPathAtom;
6100
- readonly array?: boolean;
6101
- }
6102
-
6103
- export declare const SearchParameterType: {
6104
- readonly BOOLEAN: "BOOLEAN";
6105
- readonly NUMBER: "NUMBER";
6106
- readonly QUANTITY: "QUANTITY";
6107
- readonly TEXT: "TEXT";
6108
- readonly REFERENCE: "REFERENCE";
6109
- readonly CANONICAL: "CANONICAL";
6110
- readonly DATE: "DATE";
6111
- readonly DATETIME: "DATETIME";
6112
- readonly PERIOD: "PERIOD";
6113
- readonly UUID: "UUID";
6114
- };
6115
-
6116
- export declare type SearchParameterType = (typeof SearchParameterType)[keyof typeof SearchParameterType];
6117
-
6118
- export declare interface SearchRequest<T extends Resource = Resource> {
6119
- readonly resourceType: T['resourceType'];
6120
- filters?: Filter[];
6121
- sortRules?: SortRule[];
6122
- cursor?: string;
6123
- offset?: number;
6124
- count?: number;
6125
- fields?: string[];
6126
- name?: string;
6127
- total?: 'none' | 'estimate' | 'accurate';
6128
- include?: IncludeTarget[];
6129
- revInclude?: IncludeTarget[];
6130
- summary?: 'true' | 'text' | 'data';
6131
- format?: string;
6132
- pretty?: boolean;
6133
- types?: T['resourceType'][];
6134
- }
6135
-
6136
- /**
6137
- * Represents a "selection structure" in the SQL-on-FHIR specification.
6138
- *
6139
- * In practice, this can be a ViewDefinition or ViewDefinitionSelect.
6140
- *
6141
- * TypeScript does not like checks for properties that are not part of the type, so we use this interface instead.
6142
- */
6143
- export declare interface SelectionStructure {
6144
- forEach?: string;
6145
- forEachOrNull?: string;
6146
- column?: ViewDefinitionSelect['column'];
6147
- select?: SelectionStructure[];
6148
- unionAll?: SelectionStructure[];
6149
- }
6150
-
6151
- /**
6152
- * Serializes an Error object into a plain object, including nested causes and custom properties.
6153
- * @param error - The error to serialize.
6154
- * @param depth - The current depth of recursion.
6155
- * @param maxDepth - The maximum depth of recursion.
6156
- * @returns A serialized representation of the error.
6157
- */
6158
- export declare function serializeError(error: Error, depth?: number, maxDepth?: number): Record<string, any>;
6159
-
6160
- /**
6161
- * 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.
6162
- *
6163
- * @param subscriptionRequest - An object representing a subscription request.
6164
- * @returns A serialized subscription in url-encoded form.
6165
- */
6166
- export declare function serializeFhircastSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): string;
6167
-
6168
- export declare function serverError(err: Error): OperationOutcome;
6169
-
6170
- export declare function serverTimeout(msg?: string): OperationOutcome;
6171
-
6172
- /**
6173
- * Sets a code for a given system within a given codeable concept.
6174
- * @param concept - The codeable concept.
6175
- * @param system - The system string.
6176
- * @param code - The code value.
6177
- */
6178
- export declare function setCodeBySystem(concept: CodeableConcept, system: string, code: string): void;
6179
-
6180
- /**
6181
- * Sets a resource identifier for the given system.
6182
- *
6183
- * Note that this method is only available on resources that have an "identifier" property,
6184
- * and that property must be an array of Identifier objects,
6185
- * which is not true for all FHIR resources.
6186
- *
6187
- * If the identifier already exists, then the value is updated.
6188
- *
6189
- * Otherwise a new identifier is added.
6190
- *
6191
- * @param resource - The resource to add the identifier to.
6192
- * @param system - The identifier system.
6193
- * @param value - The identifier value.
6194
- */
6195
- export declare function setIdentifier(resource: Resource & {
6196
- identifier?: Identifier[];
6197
- }, system: string, value: string): void;
6198
-
6199
- export declare function singleton(collection: TypedValue[], type?: string): TypedValue | undefined;
6200
-
6201
- export declare function singularize<T>(value: T | T[] | undefined): T | undefined;
6202
-
6203
- /**
6204
- * Sleeps for the specified number of milliseconds.
6205
- * @param ms - Time delay in milliseconds
6206
- * @returns A promise that resolves after the specified number of milliseconds.
6207
- */
6208
- export declare const sleep: (ms: number) => Promise<void>;
6209
-
6210
- export declare interface SliceDefinition extends Omit<InternalSchemaElement, 'slicing'> {
6211
- name: string;
6212
- definition?: string;
6213
- elements: Record<string, InternalSchemaElement>;
6214
- }
6215
-
6216
- export declare type SliceDefinitionWithTypes = SliceDefinition & {
6217
- type: NonNullable<SliceDefinition['type']>;
6218
- typeSchema?: InternalTypeSchema;
6219
- };
6220
-
6221
- export declare interface SliceDiscriminator {
6222
- path: string;
6223
- type: string;
6224
- }
6225
-
6226
- export declare interface SlicingRules {
6227
- discriminator: SliceDiscriminator[];
6228
- ordered: boolean;
6229
- rule?: 'open' | 'closed' | 'openAtEnd';
6230
- slices: SliceDefinition[];
6231
- }
6232
-
6233
- export declare const SNOMED = "http://snomed.info/sct";
6234
-
6235
- export declare interface SortRule {
6236
- code: string;
6237
- descending?: boolean;
6238
- }
6239
-
6240
- /**
6241
- * Sorts an array of strings in place using the localeCompare method.
6242
- *
6243
- * This method will mutate the input array.
6244
- *
6245
- * @param array - The array of strings to sort.
6246
- * @returns The sorted array of strings.
6247
- */
6248
- export declare function sortStringArray(array: string[]): string[];
6249
-
6250
- /**
6251
- * Splits a string into an array of strings using the specified delimiter.
6252
- * Unlike the built-in split function, this function will split the string into a maximum of exactly n parts.
6253
- * Trailing empty strings are included in the result.
6254
- * @param str - The string to split.
6255
- * @param delim - The delimiter.
6256
- * @param n - The maximum number of parts to split the string into.
6257
- * @returns The resulting array of strings.
6258
- */
6259
- export declare function splitN(str: string, delim: string, n: number): string[];
6260
-
6261
- /**
6262
- * Splits a FHIR search value on commas.
6263
- * Respects backslash escape.
6264
- *
6265
- * See: https://hl7.org/fhir/r4/search.html#escaping
6266
- *
6267
- * @param input - The FHIR search value to split.
6268
- * @returns The individual search values.
6269
- */
6270
- export declare function splitSearchOnComma(input: string): string[];
6271
-
6272
- export declare type StatsFn = (data: number[]) => number | Quantity;
6273
-
6274
- /**
6275
- * Reads data from a Readable stream and returns a Promise that resolves with a Buffer containing all the data.
6276
- * @param stream - The Readable stream to read from.
6277
- * @returns A Promise that resolves with a Buffer containing all the data from the Readable stream.
6278
- */
6279
- export declare function streamToBuffer(stream: Readable): Promise<Buffer>;
6280
-
6281
- /**
6282
- * Returns the FHIR JSON string representation of the input value.
6283
- *
6284
- * Removes properties with empty string values.
6285
- * Removes objects with zero properties.
6286
- *
6287
- * Does not modify the input value.
6288
- * If the input value does not contain any empty properties, then the original value is returned.
6289
- * Otherwise, a new value is returned with the empty properties removed.
6290
- *
6291
- * See: https://www.hl7.org/fhir/json.html
6292
- *
6293
- * @param value - The input value.
6294
- * @param pretty - Optional flag to pretty-print the JSON.
6295
- * @returns The resulting JSON string.
6296
- */
6297
- export declare function stringify(value: any, pretty?: boolean): string;
6298
-
6299
- /**
6300
- * Output the string representation of a value, suitable for use as part of a search query.
6301
- * @param v - The value to format as a string
6302
- * @returns The stringified value
6303
- */
6304
- export declare function stringifyTypedValue(v: TypedValue): string;
6305
-
6306
- export declare type StringMap = {
6307
- [key: string]: string;
6308
- };
6309
-
6310
- /**
6311
- * Transforms input values using a FHIR StructureMap.
6312
- *
6313
- * See: https://www.hl7.org/fhir/mapping-language.html
6314
- *
6315
- * @param structureMap - The StructureMap to transform.
6316
- * @param input - The input values.
6317
- * @param transformMaps - Optional collection of imported StructureMaps and ConceptMaps.
6318
- * @returns The transformed values.
6319
- */
6320
- export declare function structureMapTransform(structureMap: StructureMap, input: TypedValue[], transformMaps?: TransformMapCollection): TypedValue[];
6321
-
6322
- export declare interface SubManagerOptions {
6323
- ReconnectingWebSocket?: IReconnectingWebSocketCtor;
6324
- pingIntervalMs?: number;
6325
- debug?: boolean;
6326
- debugLogger?: (...args: any[]) => void;
6327
- }
6328
-
6329
- /**
6330
- * An `EventTarget` that emits events when new subscription notifications come in over WebSockets.
6331
- *
6332
- * -----
6333
- *
6334
- * ### Events emitted:
6335
- *
6336
- * - `connect` - A new subscription is connected to the `SubscriptionManager` and `message` events for this subscription can be expected.
6337
- * - `disconnect` - The specified subscription is no longer being monitored by the `SubscriptionManager`.
6338
- * - `error` - An error has occurred.
6339
- * - `message` - A message containing a notification `Bundle` has been received.
6340
- * - `open` - The WebSocket has been opened.
6341
- * - `close` - The WebSocket has been closed.
6342
- * - `heartbeat` - A `heartbeat` message has been received.
6343
- */
6344
- export declare class SubscriptionEmitter extends TypedEventTarget<SubscriptionEventMap> {
6345
- private readonly criteria;
6346
- constructor(...criteria: string[]);
6347
- getCriteria(): Set<string>;
6348
- /**
6349
- * @internal
6350
- * @param criteria - The criteria to add to this `SubscriptionEmitter`.
6351
- */
6352
- _addCriteria(criteria: string): void;
6353
- /**
6354
- * @internal
6355
- * @param criteria - The criteria to remove from this `SubscriptionEmitter`.
6356
- */
6357
- _removeCriteria(criteria: string): void;
6358
- }
6359
-
6360
- export declare type SubscriptionEventMap = {
6361
- connect: {
6362
- type: 'connect';
6363
- payload: {
6364
- subscriptionId: string;
6365
- };
6366
- };
6367
- disconnect: {
6368
- type: 'disconnect';
6369
- payload: {
6370
- subscriptionId: string;
6371
- };
6372
- };
6373
- error: {
6374
- type: 'error';
6375
- payload: Error;
6376
- };
6377
- message: {
6378
- type: 'message';
6379
- payload: Bundle;
6380
- };
6381
- open: {
6382
- type: 'open';
6383
- };
6384
- close: {
6385
- type: 'close';
6386
- };
6387
- heartbeat: {
6388
- type: 'heartbeat';
6389
- payload: Bundle;
6390
- };
6391
- };
6392
-
6393
- export declare class SubscriptionManager {
6394
- private readonly medplum;
6395
- private readonly ws;
6396
- private masterSubEmitter?;
6397
- private readonly criteriaEntries;
6398
- private readonly criteriaEntriesBySubscriptionId;
6399
- private wsClosed;
6400
- private pingTimer;
6401
- private readonly pingIntervalMs;
6402
- private waitingForPong;
6403
- private currentProfile;
6404
- constructor(medplum: MedplumClient, wsUrl: URL | string, options?: SubManagerOptions);
6405
- private setupListeners;
6406
- private emitError;
6407
- private maybeEmitDisconnect;
6408
- private getTokenForCriteria;
6409
- private maybeGetCriteriaEntry;
6410
- private getAllCriteriaEmitters;
6411
- private addCriteriaEntry;
6412
- private removeCriteriaEntry;
6413
- private subscribeToCriteria;
6414
- private refreshAllSubscriptions;
6415
- addCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): SubscriptionEmitter;
6416
- removeCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): void;
6417
- getWebSocket(): IReconnectingWebSocket;
6418
- closeWebSocket(): void;
6419
- reconnectWebSocket(): void;
6420
- getCriteriaCount(): number;
6421
- getMasterEmitter(): SubscriptionEmitter;
6422
- }
6423
-
6424
- /**
6425
- * A `FHIRcast` subscription request.
6426
- *
6427
- * Can be passed to `MedplumClient.fhircastConnect` or `MedplumClient.fhircastUnsubscribe` to either open a `FHIRcast` connection, or unsubscribe from the subscription.
6428
- */
6429
- export declare type SubscriptionRequest = {
6430
- channelType: 'websocket';
6431
- mode: 'subscribe' | 'unsubscribe';
6432
- events: FhircastEventName[];
6433
- topic: string;
6434
- endpoint: string;
6435
- };
6436
-
6437
- /**
6438
- * Construct the subset of a resource containing a minimum set of fields. The returned resource is not guaranteed
6439
- * to contain only the provided properties, and may contain others (e.g. `resourceType` and `id`)
6440
- *
6441
- * @param resource - The resource to subset
6442
- * @param properties - The minimum properties to include in the subset
6443
- * @returns The modified resource, containing the listed properties and possibly other mandatory ones
6444
- */
6445
- export declare function subsetResource<T extends Resource>(resource: T | undefined, properties: string[]): T | undefined;
6446
-
6447
- /**
6448
- * Summarizes a group of Observations into a single computed summary value, with the individual values
6449
- * preserved in `Observation.component.valueSampledData`.
6450
- *
6451
- * @param observations - The Observations to summarize.
6452
- * @param summaryCode - The code for the summarized value.
6453
- * @param summarizeFn - Function to summarize the data points.
6454
- * @returns - The summary Observation resource.
6455
- */
6456
- export declare function summarizeObservations(observations: Observation[] | Bundle<Observation>, summaryCode: CodeableConcept, summarizeFn: StatsFn): Observation;
6457
-
6458
- export declare class SymbolAtom implements Atom {
6459
- readonly name: string;
6460
- constructor(name: string);
6461
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
6462
- private getVariable;
6463
- private evalValue;
6464
- toString(): string;
6465
- }
6466
-
6467
- /**
6468
- * Converts unknown object into a JavaScript boolean.
6469
- * Note that this is different than the FHIRPath "toBoolean",
6470
- * which has particular semantics around arrays, empty arrays, and type conversions.
6471
- * @param obj - Any value or array of values.
6472
- * @returns The converted boolean value according to FHIRPath rules.
6473
- */
6474
- export declare function toJsBoolean(obj: TypedValue[]): boolean;
6475
-
6476
- export declare interface Token extends Marker {
6477
- id: string;
6478
- value: string;
6479
- }
6480
-
6481
- export declare class Tokenizer {
6482
- private readonly str;
6483
- private readonly keywords;
6484
- private readonly operators;
6485
- private readonly dateTimeLiterals;
6486
- private readonly symbolRegex;
6487
- private readonly result;
6488
- private readonly pos;
6489
- private readonly markStack;
6490
- constructor(str: string, keywords: string[], operators: string[], options?: TokenizerOptions);
6491
- tokenize(): Token[];
6492
- private prevToken;
6493
- private peekToken;
6494
- private consumeToken;
6495
- private consumeWhitespace;
6496
- private consumeMultiLineComment;
6497
- private consumeSingleLineComment;
6498
- private consumeString;
6499
- private consumeChar;
6500
- private consumeQuotedSymbol;
6501
- private consumeDateTime;
6502
- private consumeNumber;
6503
- private consumeSymbol;
6504
- private consumeOperator;
6505
- private consumeWhile;
6506
- private curr;
6507
- private peek;
6508
- private mark;
6509
- private reset;
6510
- private advance;
6511
- private buildToken;
6512
- }
6513
-
6514
- export declare interface TokenizerOptions {
6515
- dateTimeLiterals?: boolean;
6516
- symbolRegex?: RegExp;
6517
- }
6518
-
6519
- export declare interface TokenResponse {
6520
- readonly token_type: string;
6521
- readonly id_token: string;
6522
- readonly access_token: string;
6523
- readonly refresh_token: string;
6524
- readonly expires_in: number;
6525
- readonly project: Reference<Project>;
6526
- readonly profile: Reference<ProfileResource>;
6527
- }
6528
-
6529
- export declare interface TokensContext {
6530
- caseInsensitive?: boolean;
6531
- textSearchSystem?: string;
6532
- }
6533
-
6534
- export declare const tooManyRequests: OperationOutcome;
6535
-
6536
- /**
6537
- * Tries to convert an unknown input value to a Period object.
6538
- * @param input - Unknown input value.
6539
- * @returns A Period object or undefined.
6540
- */
6541
- export declare function toPeriod(input: unknown): Period | undefined;
6542
-
6543
- /**
6544
- * Returns a "best guess" TypedValue for a given value.
6545
- * @param value - The unknown value to check.
6546
- * @returns A "best guess" TypedValue for the given value.
6547
- */
6548
- export declare function toTypedValue(value: unknown): TypedValue;
6549
-
6550
- /**
6551
- * The TransformMapCollection class is a collection of StructureMap and ConceptMap resources.
6552
- * It is used to store and retrieve imported StructureMaps and ConceptMaps by URL.
6553
- */
6554
- export declare class TransformMapCollection {
6555
- readonly resources: (StructureMap | ConceptMap)[];
6556
- constructor(resources?: (StructureMap | ConceptMap)[]);
6557
- get<K extends ResourceType>(resourceType: K, url: string): ExtractResource<K>[];
6558
- private matchesUrl;
6559
- }
6560
-
6561
- /**
6562
- * Returns an array with trailing empty elements removed.
6563
- * For example, [1, 2, 3, null, undefined, ''] becomes [1, 2, 3].
6564
- * This is useful for FHIR arrays, which by default must maintain the same length,
6565
- * but while editing we may want to trim trailing empty elements.
6566
- * @param arr - The input array.
6567
- * @returns The array with trailing empty elements removed.
6568
- */
6569
- export declare function trimTrailingEmptyElements<T>(arr: T[] | undefined): T[] | undefined;
6570
-
6571
- export declare function tryGetDataType(type: string, profileUrl?: string): InternalTypeSchema | undefined;
6572
-
6573
- /**
6574
- * Returns the JWT expiration time in number of milliseconds elapsed since the epoch.
6575
- * @param token - The JWT token.
6576
- * @returns The JWT expiration time in number of milliseconds elapsed since the epoch if available, undefined if unknown.
6577
- */
6578
- export declare function tryGetJwtExpiration(token: string): number | undefined;
6579
-
6580
- export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
6581
-
6582
- export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
6583
- private readonly emitter;
6584
- dispatchEvent<TEventType extends keyof TEvents & string>(event: TEvents[TEventType]): void;
6585
- addEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
6586
- removeEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
6587
- removeAllListeners(): void;
6588
- }
6589
-
6590
- export declare interface TypedValue {
6591
- readonly type: string;
6592
- readonly value: any;
6593
- }
6594
-
6595
- /**
6596
- * Converts a typed value to a string.
6597
- * @param typedValue - The typed value to convert to a string.
6598
- * @returns The string representation of the typed value.
6599
- */
6600
- export declare function typedValueToString(typedValue: TypedValue | undefined): string;
6601
-
6602
- export declare type TypedValueWithPath = TypedValue & {
6603
- path: string;
6604
- };
6605
-
6606
- /**
6607
- * An indexed TypeSchema.
6608
- *
6609
- * Example: The IndexedStructureDefinition for "Patient" would include the following TypeSchemas:
6610
- * 1) Patient
6611
- * 2) Patient_Contact
6612
- * 3) Patient_Communication
6613
- * 4) Patient_Link
6614
- */
6615
- export declare interface TypeInfo {
6616
- searchParams?: Record<string, SearchParameter>;
6617
- searchParamsDetails?: Record<string, SearchParameterDetails>;
6618
- }
6619
-
6620
- export declare type TypeName<T> = T extends string ? 'string' : T extends number ? 'number' : T extends boolean ? 'boolean' : T extends undefined ? 'undefined' : 'object';
6621
-
6622
- export declare const UCUM = "http://unitsofmeasure.org";
6623
-
6624
- export declare class UnaryOperatorAtom extends PrefixOperatorAtom {
6625
- readonly impl: (x: TypedValue[]) => TypedValue[];
6626
- constructor(operator: string, child: Atom, impl: (x: TypedValue[]) => TypedValue[]);
6627
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
6628
- toString(): string;
6629
- }
6630
-
6631
- export declare const unauthorized: OperationOutcome;
6632
-
6633
- export declare const unauthorizedTokenAudience: OperationOutcome;
6634
-
6635
- export declare const unauthorizedTokenExpired: OperationOutcome;
6636
-
6637
- export declare class UnionAtom extends InfixOperatorAtom {
6638
- constructor(left: Atom, right: Atom);
6639
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
6640
- }
6641
-
6642
- export declare const VALID_HOSTNAME_REGEX: RegExp;
6643
-
6644
- /**
6645
- * Validates that a `SubscriptionRequest`.
6646
- *
6647
- * @param subscriptionRequest - The `SubscriptionRequest` to validate.
6648
- * @returns A `boolean` indicating whether or not the `SubscriptionRequest` is valid.
6649
- */
6650
- export declare function validateFhircastSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): boolean;
6651
-
6652
- export declare function validateResource(resource: Resource, options?: ValidatorOptions): OperationOutcomeIssue[];
6653
-
6654
- /**
6655
- * Validates that the given string is a valid FHIR resource type.
6656
- *
6657
- * On success, silently returns void.
6658
- * On failure, throws an OperationOutcomeError.
6659
- *
6660
- * @example
6661
- * ```ts
6662
- * validateResourceType('Patient'); // nothing
6663
- * validateResourceType('XYZ'); // throws OperationOutcomeError
6664
- * ```
6665
- *
6666
- * Note that this depends on globalSchema, which is populated by the StructureDefinition loader.
6667
- *
6668
- * @example
6669
- * In a server context, you can load all schema definitions:
6670
- *
6671
- * ```ts
6672
- * import { indexStructureDefinitionBundle } from '@medplum/core';
6673
- * import { readJson } from '@medplum/definitions';
6674
- * import { Bundle } from '@medplum/fhirtypes';
6675
- *
6676
- * indexStructureDefinitionBundle(readJson('fhir/r4/profiles-resources.json') as Bundle);
6677
- * ```
6678
- *
6679
- * @example
6680
- * In a client context, you can load the schema definitions using MedplumClient:
6681
- *
6682
- * ```ts
6683
- * import { MedplumClient } from '@medplum/core';
6684
- *
6685
- * const medplum = new MedplumClient();
6686
- * await medplum.requestSchema('Patient');
6687
- * ```
6688
- *
6689
- * @param resourceType - The candidate resource type string.
6690
- */
6691
- export declare function validateResourceType(resourceType: string): void;
6692
-
6693
- export declare function validateTypedValue(typedValue: TypedValue, options?: ValidatorOptions): OperationOutcomeIssue[];
6694
-
6695
- export declare function validationError(details: string): OperationOutcome;
6696
-
6697
- export declare const validationRegexes: Record<string, RegExp>;
6698
-
6699
- export declare interface ValidatorOptions {
6700
- profile?: StructureDefinition;
6701
- }
6702
-
6703
- export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
6704
-
6705
- /**
6706
- * ValueSet $expand operation parameters.
6707
- * See {@link https://hl7.org/fhir/r4/valueset-operation-expand.html | FHIR ValueSet $expand Operation Parameters} for full details.
6708
- */
6709
- export declare interface ValueSetExpandParams {
6710
- url?: string;
6711
- filter?: string;
6712
- date?: string;
6713
- offset?: number;
6714
- count?: number;
6715
- }
6716
-
6717
- /**
6718
- * Checks if a newer version of Medplum is available and logs a warning if so.
6719
- * @param appName - The name of the app to check the version for.
6720
- * @param params - An optional list of key-value pairs to be appended to the URL query string.
6721
- */
6722
- export declare function warnIfNewerVersionAvailable(appName: string, params?: Record<string, string>): Promise<void>;
6723
-
6724
- declare type WebSocketEventMap_2 = {
6725
- close: CloseEvent_2;
6726
- error: ErrorEvent_2;
6727
- message: MessageEvent;
6728
- open: Event;
6729
- };
6730
- export { WebSocketEventMap_2 as WebSocketEventMap }
6731
-
6732
- export declare type WithId<T> = T & {
6733
- id: string;
6734
- };
6735
-
6736
- /**
6737
- * Returns a word-wrapped string.
6738
- * Based on: https://stackoverflow.com/a/38709683
6739
- * @param text - Original input string.
6740
- * @param maxLength - Width in number of characters.
6741
- * @returns Array of lines.
6742
- */
6743
- export declare function wordWrap(text: string, maxLength: number): string[];
6744
-
6745
- /**
6746
- * 6.5.4. xor
6747
- * Returns true if exactly one of the operands evaluates to true,
6748
- * false if either both operands evaluate to true or both operands evaluate to false,
6749
- * and the empty collection otherwise.
6750
- */
6751
- export declare class XorAtom extends BooleanInfixOperatorAtom {
6752
- constructor(left: Atom, right: Atom);
6753
- eval(context: AtomContext, input: TypedValue[]): TypedValue[];
6754
- }
6755
-
6756
- export { }
5627
+ * @throws {@link OperationOutcomeError} If the reference cannot be parsed.
5628
+ */
5629
+ export declare function parseReference<T extends Resource>(reference: Reference<T> | undefined): [T['resourceType'], string];
5630
+
5631
+ /**
5632
+ * Parses a search URL into a search request.
5633
+ * @param url - The original search URL or the FHIR resource type.
5634
+ * @param query - Optional collection of additional query string parameters.
5635
+ * @returns A parsed SearchRequest.
5636
+ */
5637
+ export declare function parseSearchRequest<T extends Resource = Resource>(url: T['resourceType'] | URL | string, query?: Record<string, string[] | string | undefined>): SearchRequest<T>;
5638
+
5639
+ /**
5640
+ * Parses a StructureDefinition resource into an internal schema better suited for
5641
+ * programmatic validation and usage in internal systems
5642
+ * @param sd - The StructureDefinition resource to parse
5643
+ * @returns The parsed schema for the given resource type
5644
+ * @experimental
5645
+ */
5646
+ export declare function parseStructureDefinition(sd: StructureDefinition): InternalTypeSchema;
5647
+
5648
+ /**
5649
+ * Parses an extended FHIR search criteria string (i.e. application/x-fhir-query).
5650
+ *
5651
+ * @example Evaluating a FHIRPath subexpression
5652
+ *
5653
+ * ```typescript
5654
+ * const query = 'Patient?name={{ %patient.name }}';
5655
+ * const variables = { patient: { name: 'John Doe' } };
5656
+ * const request = parseXFhirQuery(query, variables);
5657
+ * console.log(request.filters[0].value); // "John Doe"
5658
+ * ```
5659
+ *
5660
+ * @see https://hl7.org/fhir/fhir-xquery.html
5661
+ * @param query - The X-Fhir-Query string to parse
5662
+ * @param variables - Values to pass into embedded FHIRPath expressions
5663
+ * @returns The parsed search request
5664
+ */
5665
+ export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>): SearchRequest;
5666
+
5667
+ /**
5668
+ * JSONPatch patch operation.
5669
+ * Compatible with fast-json-patch and rfc6902 Operation.
5670
+ */
5671
+ export declare interface PatchOperation {
5672
+ readonly op: 'add' | 'remove' | 'replace' | 'copy' | 'move' | 'test';
5673
+ readonly path: string;
5674
+ readonly value?: any;
5675
+ }
5676
+
5677
+ export declare type PendingSubscriptionRequest = Omit<SubscriptionRequest, 'endpoint'>;
5678
+
5679
+ /**
5680
+ * Returns true if the two numbers are equal to the given precision.
5681
+ * @param a - The first number.
5682
+ * @param b - The second number.
5683
+ * @param precision - Optional precision in number of digits.
5684
+ * @returns True if the two numbers are equal to the given precision.
5685
+ */
5686
+ export declare function preciseEquals(a: number, b: number, precision?: number): boolean;
5687
+
5688
+ /**
5689
+ * Returns true if the first number is greater than the second number to the given precision.
5690
+ * @param a - The first number.
5691
+ * @param b - The second number.
5692
+ * @param precision - Optional precision in number of digits.
5693
+ * @returns True if the first number is greater than the second number to the given precision.
5694
+ */
5695
+ export declare function preciseGreaterThan(a: number, b: number, precision?: number): boolean;
5696
+
5697
+ /**
5698
+ * Returns true if the first number is greater than or equal to the second number to the given precision.
5699
+ * @param a - The first number.
5700
+ * @param b - The second number.
5701
+ * @param precision - Optional precision in number of digits.
5702
+ * @returns True if the first number is greater than or equal to the second number to the given precision.
5703
+ */
5704
+ export declare function preciseGreaterThanOrEquals(a: number, b: number, precision?: number): boolean;
5705
+
5706
+ /**
5707
+ * Returns true if the first number is less than the second number to the given precision.
5708
+ * @param a - The first number.
5709
+ * @param b - The second number.
5710
+ * @param precision - Optional precision in number of digits.
5711
+ * @returns True if the first number is less than the second number to the given precision.
5712
+ */
5713
+ export declare function preciseLessThan(a: number, b: number, precision?: number): boolean;
5714
+
5715
+ /**
5716
+ * Returns true if the first number is less than or equal to the second number to the given precision.
5717
+ * @param a - The first number.
5718
+ * @param b - The second number.
5719
+ * @param precision - Optional precision in number of digits.
5720
+ * @returns True if the first number is less than or equal to the second number to the given precision.
5721
+ */
5722
+ export declare function preciseLessThanOrEquals(a: number, b: number, precision?: number): boolean;
5723
+
5724
+ /**
5725
+ * Returns the input number rounded to the specified number of digits.
5726
+ * @param a - The input number.
5727
+ * @param precision - The precision in number of digits.
5728
+ * @returns The number rounded to the specified number of digits.
5729
+ */
5730
+ export declare function preciseRound(a: number, precision: number): number;
5731
+
5732
+ export declare const preconditionFailed: OperationOutcome;
5733
+
5734
+ export declare abstract class PrefixOperatorAtom implements Atom {
5735
+ readonly operator: string;
5736
+ readonly child: Atom;
5737
+ constructor(operator: string, child: Atom);
5738
+ abstract eval(context: AtomContext, input: TypedValue[]): TypedValue[];
5739
+ toString(): string;
5740
+ }
5741
+
5742
+ export declare interface PrefixParselet {
5743
+ parse(parser: Parser, token: Token): Atom;
5744
+ }
5745
+
5746
+ export declare type ProfileResource = Patient | Practitioner | RelatedPerson;
5747
+
5748
+ /**
5749
+ * Project admin resource types are special resources that are only
5750
+ * accessible to project administrators.
5751
+ */
5752
+ export declare const projectAdminResourceTypes: string[];
5753
+
5754
+ /**
5755
+ * List of property types.
5756
+ * http://www.hl7.org/fhir/valueset-defined-types.html
5757
+ * The list here includes additions found from StructureDefinition resources.
5758
+ */
5759
+ export declare const PropertyType: {
5760
+ readonly Address: "Address";
5761
+ readonly Age: "Age";
5762
+ readonly Annotation: "Annotation";
5763
+ readonly Attachment: "Attachment";
5764
+ readonly BackboneElement: "BackboneElement";
5765
+ readonly CodeableConcept: "CodeableConcept";
5766
+ readonly Coding: "Coding";
5767
+ readonly ContactDetail: "ContactDetail";
5768
+ readonly ContactPoint: "ContactPoint";
5769
+ readonly Contributor: "Contributor";
5770
+ readonly Count: "Count";
5771
+ readonly DataRequirement: "DataRequirement";
5772
+ readonly Distance: "Distance";
5773
+ readonly Dosage: "Dosage";
5774
+ readonly Duration: "Duration";
5775
+ readonly Expression: "Expression";
5776
+ readonly Extension: "Extension";
5777
+ readonly HumanName: "HumanName";
5778
+ readonly Identifier: "Identifier";
5779
+ readonly MarketingStatus: "MarketingStatus";
5780
+ readonly Meta: "Meta";
5781
+ readonly Money: "Money";
5782
+ readonly Narrative: "Narrative";
5783
+ readonly ParameterDefinition: "ParameterDefinition";
5784
+ readonly Period: "Period";
5785
+ readonly Population: "Population";
5786
+ readonly ProdCharacteristic: "ProdCharacteristic";
5787
+ readonly ProductShelfLife: "ProductShelfLife";
5788
+ readonly Quantity: "Quantity";
5789
+ readonly Range: "Range";
5790
+ readonly Ratio: "Ratio";
5791
+ readonly Reference: "Reference";
5792
+ readonly RelatedArtifact: "RelatedArtifact";
5793
+ readonly SampledData: "SampledData";
5794
+ readonly Signature: "Signature";
5795
+ readonly SubstanceAmount: "SubstanceAmount";
5796
+ readonly SystemString: "http://hl7.org/fhirpath/System.String";
5797
+ readonly Timing: "Timing";
5798
+ readonly TriggerDefinition: "TriggerDefinition";
5799
+ readonly UsageContext: "UsageContext";
5800
+ readonly base64Binary: "base64Binary";
5801
+ readonly boolean: "boolean";
5802
+ readonly canonical: "canonical";
5803
+ readonly code: "code";
5804
+ readonly date: "date";
5805
+ readonly dateTime: "dateTime";
5806
+ readonly decimal: "decimal";
5807
+ readonly id: "id";
5808
+ readonly instant: "instant";
5809
+ readonly integer: "integer";
5810
+ readonly markdown: "markdown";
5811
+ readonly oid: "oid";
5812
+ readonly positiveInt: "positiveInt";
5813
+ readonly string: "string";
5814
+ readonly time: "time";
5815
+ readonly unsignedInt: "unsignedInt";
5816
+ readonly uri: "uri";
5817
+ readonly url: "url";
5818
+ readonly uuid: "uuid";
5819
+ };
5820
+
5821
+ /**
5822
+ * Protected resource types are in the "medplum" project.
5823
+ * Reading and writing is limited to the system account.
5824
+ */
5825
+ export declare const protectedResourceTypes: string[];
5826
+
5827
+ export declare type ProtocolsProvider = null | string | string[];
5828
+
5829
+ export declare interface PushToAgentOptions extends MedplumRequestOptions {
5830
+ /**
5831
+ * Time to wait before request timeout in milliseconds; defaults to `10000` (10 s)
5832
+ */
5833
+ waitTimeout?: number;
5834
+ }
5835
+
5836
+ export declare type QuantityUnit = Pick<Quantity, 'unit' | 'code' | 'system'>;
5837
+
5838
+ /**
5839
+ * QueryTypes defines the different ways to specify FHIR search parameters.
5840
+ *
5841
+ * Can be any valid input to the URLSearchParams() constructor.
5842
+ *
5843
+ * TypeScript definitions for URLSearchParams do not match runtime behavior.
5844
+ * The official spec only accepts string values.
5845
+ * Web browsers and Node.js automatically coerce values to strings.
5846
+ * See: https://github.com/microsoft/TypeScript/issues/32951
5847
+ */
5848
+ export declare type QueryTypes = URLSearchParams | string[][] | Record<string, string | number | boolean | undefined> | string | undefined;
5849
+
5850
+ export declare type RateLimitInfo = {
5851
+ name: string;
5852
+ remainingUnits: number;
5853
+ secondsUntilReset: number;
5854
+ };
5855
+
5856
+ /**
5857
+ * The ReadablePromise class wraps a request promise suitable for React Suspense.
5858
+ * See: https://blog.logrocket.com/react-suspense-data-fetching/#wrappromise-js
5859
+ * See: https://github.com/ovieokeh/suspense-data-fetching/blob/master/lib/api/wrapPromise.js
5860
+ */
5861
+ export declare class ReadablePromise<T> implements Promise<T> {
5862
+ readonly [Symbol.toStringTag]: string;
5863
+ private readonly suspender;
5864
+ private status;
5865
+ private response;
5866
+ private error;
5867
+ constructor(requestPromise: Promise<T>);
5868
+ /**
5869
+ * Returns true if the promise is pending.
5870
+ * @returns True if the Promise is pending.
5871
+ */
5872
+ isPending(): boolean;
5873
+ /**
5874
+ * Returns true if the promise resolved successfully.
5875
+ * @returns True if the Promise resolved successfully.
5876
+ */
5877
+ isOk(): boolean;
5878
+ /**
5879
+ * Attempts to read the value of the promise.
5880
+ * If the promise is pending, this method will throw a promise.
5881
+ * If the promise rejected, this method will throw the rejection reason.
5882
+ * If the promise resolved, this method will return the resolved value.
5883
+ * @returns The resolved value of the Promise.
5884
+ */
5885
+ read(): T;
5886
+ /**
5887
+ * Attaches callbacks for the resolution and/or rejection of the Promise.
5888
+ * @param onfulfilled - The callback to execute when the Promise is resolved.
5889
+ * @param onrejected - The callback to execute when the Promise is rejected.
5890
+ * @returns A Promise for the completion of which ever callback is executed.
5891
+ */
5892
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
5893
+ /**
5894
+ * Attaches a callback for only the rejection of the Promise.
5895
+ * @param onrejected - The callback to execute when the Promise is rejected.
5896
+ * @returns A Promise for the completion of the callback.
5897
+ */
5898
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
5899
+ /**
5900
+ * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
5901
+ * resolved value cannot be modified from the callback.
5902
+ * @param onfinally - The callback to execute when the Promise is settled (fulfilled or rejected).
5903
+ * @returns A Promise for the completion of the callback.
5904
+ */
5905
+ finally(onfinally?: (() => void) | null): Promise<T>;
5906
+ }
5907
+
5908
+ export declare interface ReadHistoryOptions {
5909
+ readonly count?: number;
5910
+ readonly offset?: number;
5911
+ }
5912
+
5913
+ export declare const readInteractions: AccessPolicyInteraction[];
5914
+
5915
+ export declare class ReconnectingWebSocket<WS extends IWebSocket = WebSocket> extends TypedEventTarget<WebSocketEventMap_2> implements IReconnectingWebSocket {
5916
+ private _ws;
5917
+ private _retryCount;
5918
+ private _uptimeTimeout;
5919
+ private _connectTimeout;
5920
+ private _shouldReconnect;
5921
+ private _connectLock;
5922
+ private _binaryType;
5923
+ private _closeCalled;
5924
+ private _messageQueue;
5925
+ private readonly _debugLogger;
5926
+ protected _url: string;
5927
+ protected _protocols?: ProtocolsProvider;
5928
+ protected _options: Options<WS>;
5929
+ constructor(url: string, protocols?: ProtocolsProvider, options?: Options<WS>);
5930
+ static get CONNECTING(): number;
5931
+ static get OPEN(): number;
5932
+ static get CLOSING(): number;
5933
+ static get CLOSED(): number;
5934
+ get CONNECTING(): number;
5935
+ get OPEN(): number;
5936
+ get CLOSING(): number;
5937
+ get CLOSED(): number;
5938
+ get binaryType(): WS['binaryType'];
5939
+ set binaryType(value: WS['binaryType']);
5940
+ /**
5941
+ * @returns The number or connection retries.
5942
+ */
5943
+ get retryCount(): number;
5944
+ /**
5945
+ * @returns The number of bytes of data that have been queued using calls to send() but not yet
5946
+ * transmitted to the network. This value resets to zero once all queued data has been sent.
5947
+ * This value does not reset to zero when the connection is closed; if you keep calling send(),
5948
+ * this will continue to climb. Read only
5949
+ *
5950
+ */
5951
+ get bufferedAmount(): number;
5952
+ /**
5953
+ * @returns The extensions selected by the server. This is currently only the empty string or a list of
5954
+ * extensions as negotiated by the connection
5955
+ */
5956
+ get extensions(): string;
5957
+ /**
5958
+ * @returns A string indicating the name of the sub-protocol the server selected;
5959
+ * this will be one of the strings specified in the protocols parameter when creating the
5960
+ * WebSocket object.
5961
+ */
5962
+ get protocol(): string;
5963
+ /**
5964
+ * @returns The current state of the connection; this is one of the Ready state constants.
5965
+ */
5966
+ get readyState(): number;
5967
+ /**
5968
+ * @returns The URL as resolved by the constructor.
5969
+ */
5970
+ get url(): string;
5971
+ /**
5972
+ * @returns Whether the websocket object is now in reconnectable state.
5973
+ */
5974
+ get shouldReconnect(): boolean;
5975
+ /**
5976
+ * An event listener to be called when the WebSocket connection's readyState changes to CLOSED
5977
+ */
5978
+ onclose: ((event: CloseEvent_2) => void) | null;
5979
+ /**
5980
+ * An event listener to be called when an error occurs
5981
+ */
5982
+ onerror: ((event: ErrorEvent_2) => void) | null;
5983
+ /**
5984
+ * An event listener to be called when a message is received from the server
5985
+ */
5986
+ onmessage: ((event: MessageEvent) => void) | null;
5987
+ /**
5988
+ * An event listener to be called when the WebSocket connection's readyState changes to OPEN;
5989
+ * this indicates that the connection is ready to send and receive data
5990
+ */
5991
+ onopen: ((event: Event) => void) | null;
5992
+ /**
5993
+ * Closes the WebSocket connection or connection attempt, if any. If the connection is already
5994
+ * CLOSED, this method does nothing
5995
+ * @param code - The code to close with. Default is 1000.
5996
+ * @param reason - An optional reason for closing the connection.
5997
+ */
5998
+ close(code?: number, reason?: string): void;
5999
+ /**
6000
+ * Closes the WebSocket connection or connection attempt and connects again.
6001
+ * Resets retry counter;
6002
+ * @param code - The code to disconnect with. Default is 1000.
6003
+ * @param reason - An optional reason for disconnecting the connection.
6004
+ */
6005
+ reconnect(code?: number, reason?: string): void;
6006
+ /**
6007
+ * Enqueue specified data to be transmitted to the server over the WebSocket connection
6008
+ * @param data - The data to enqueue.
6009
+ */
6010
+ send(data: Message): void;
6011
+ private _debug;
6012
+ private _getNextDelay;
6013
+ private _wait;
6014
+ private _connect;
6015
+ private _handleTimeout;
6016
+ private _disconnect;
6017
+ private _acceptOpen;
6018
+ private readonly _handleOpen;
6019
+ private readonly _handleMessage;
6020
+ private readonly _handleError;
6021
+ private readonly _handleClose;
6022
+ private _removeListeners;
6023
+ private _addListeners;
6024
+ private _clearTimeouts;
6025
+ }
6026
+
6027
+ export declare function redirect(url: URL): OperationOutcome;
6028
+
6029
+ export declare type ReleaseManifest = {
6030
+ tag_name: string;
6031
+ assets: {
6032
+ name: string;
6033
+ browser_download_url: string;
6034
+ }[];
6035
+ };
6036
+
6037
+ /**
6038
+ * Removes duplicates in array using FHIRPath equality rules.
6039
+ * @param arr - The input array.
6040
+ * @returns The result array with duplicates removed.
6041
+ */
6042
+ export declare function removeDuplicates(arr: TypedValue[]): TypedValue[];
6043
+
6044
+ /**
6045
+ * Removes the supplied profileUrl from the resource.meta.profile if it is present
6046
+ * @param resource - A FHIR resource
6047
+ * @param profileUrl - The profile URL to remove
6048
+ * @returns The resource
6049
+ */
6050
+ export declare function removeProfileFromResource<T extends Resource = Resource>(resource: T, profileUrl: string): T;
6051
+
6052
+ /**
6053
+ * Topologically sorts a `batch` or `transaction` bundle to improve reference resolution.
6054
+ * The bundle is sorted such that a resource is created _before_ references to that resource appear in the bundle.
6055
+ *
6056
+ * In the event of cycles, this function will first create a POST request for each resource in the cycle, and then will
6057
+ * append a PUT request to the bundle. This ensures that each resources in the cycle is visited twice, and all
6058
+ * references can be resolved
6059
+ * @param bundle - Input bundle with type `batch` or `transaction`
6060
+ * @returns Bundle of the same type, with Bundle.entry reordered
6061
+ */
6062
+ export declare function reorderBundle(bundle: Bundle): Bundle;
6063
+
6064
+ export declare interface RequestProfileSchemaOptions {
6065
+ /** (optional) Whether to include nested profiles, e.g. from extensions. Defaults to false. */
6066
+ expandProfile?: boolean;
6067
+ }
6068
+
6069
+ /**
6070
+ * Returns the ID portion of a reference.
6071
+ * @param input - A FHIR reference or resource.
6072
+ * @returns The ID portion of a reference.
6073
+ */
6074
+ export declare function resolveId(input: Reference | Resource | undefined): string | undefined;
6075
+
6076
+ /**
6077
+ * ResourceArray is an array of resources with a bundle property.
6078
+ * The bundle property is a FHIR Bundle containing the search results.
6079
+ * This is useful for retrieving bundle metadata such as total, offset, and next link.
6080
+ */
6081
+ export declare type ResourceArray<T extends Resource = Resource> = T[] & {
6082
+ bundle: Bundle<T>;
6083
+ };
6084
+
6085
+ export declare type ResourceMatchesSubscriptionCriteria = {
6086
+ resource: Resource;
6087
+ subscription: Subscription;
6088
+ context: BackgroundJobContext;
6089
+ logger?: Logger;
6090
+ getPreviousResource: (currentResource: Resource) => Promise<Resource | undefined>;
6091
+ };
6092
+
6093
+ export declare function resourceMatchesSubscriptionCriteria({ resource, subscription, context, getPreviousResource, logger, }: ResourceMatchesSubscriptionCriteria): Promise<boolean>;
6094
+
6095
+ export declare type ResourceWithCode = Resource & Code;
6096
+
6097
+ export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
6098
+
6099
+ export declare type SamplingInfo = Omit<SampledData, 'data'>;
6100
+
6101
+ /**
6102
+ * Checks that there is an access policy permitting the given resource interaction, returning the matching policy object.
6103
+ * @param resource - The resource being acted upon.
6104
+ * @param interaction - The interaction being performed on the resource.
6105
+ * @param accessPolicy - The relevant access policy for the current user.
6106
+ * @returns The satisfied access policy, or undefined if the access policy does not permit the given interaction.
6107
+ */
6108
+ export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
6109
+
6110
+ export declare interface SearchableToken {
6111
+ readonly system: string | undefined;
6112
+ readonly value: string | undefined;
6113
+ }
6114
+
6115
+ export declare interface SearchParameterDetails {
6116
+ readonly type: SearchParameterType;
6117
+ readonly elementDefinitions?: InternalSchemaElement[];
6118
+ readonly parsedExpression: FhirPathAtom;
6119
+ readonly array?: boolean;
6120
+ }
6121
+
6122
+ export declare const SearchParameterType: {
6123
+ readonly BOOLEAN: "BOOLEAN";
6124
+ readonly NUMBER: "NUMBER";
6125
+ readonly QUANTITY: "QUANTITY";
6126
+ readonly TEXT: "TEXT";
6127
+ readonly REFERENCE: "REFERENCE";
6128
+ readonly CANONICAL: "CANONICAL";
6129
+ readonly DATE: "DATE";
6130
+ readonly DATETIME: "DATETIME";
6131
+ readonly PERIOD: "PERIOD";
6132
+ readonly UUID: "UUID";
6133
+ };
6134
+
6135
+ export declare type SearchParameterType = (typeof SearchParameterType)[keyof typeof SearchParameterType];
6136
+
6137
+ export declare interface SearchRequest<T extends Resource = Resource> {
6138
+ readonly resourceType: T['resourceType'];
6139
+ filters?: Filter[];
6140
+ sortRules?: SortRule[];
6141
+ cursor?: string;
6142
+ offset?: number;
6143
+ count?: number;
6144
+ fields?: string[];
6145
+ name?: string;
6146
+ total?: 'none' | 'estimate' | 'accurate';
6147
+ include?: IncludeTarget[];
6148
+ revInclude?: IncludeTarget[];
6149
+ summary?: 'true' | 'text' | 'data';
6150
+ format?: string;
6151
+ pretty?: boolean;
6152
+ types?: T['resourceType'][];
6153
+ }
6154
+
6155
+ /**
6156
+ * Represents a "selection structure" in the SQL-on-FHIR specification.
6157
+ *
6158
+ * In practice, this can be a ViewDefinition or ViewDefinitionSelect.
6159
+ *
6160
+ * TypeScript does not like checks for properties that are not part of the type, so we use this interface instead.
6161
+ */
6162
+ export declare interface SelectionStructure {
6163
+ forEach?: string;
6164
+ forEachOrNull?: string;
6165
+ column?: ViewDefinitionSelect['column'];
6166
+ select?: SelectionStructure[];
6167
+ unionAll?: SelectionStructure[];
6168
+ }
6169
+
6170
+ /**
6171
+ * Serializes an Error object into a plain object, including nested causes and custom properties.
6172
+ * @param error - The error to serialize.
6173
+ * @param depth - The current depth of recursion.
6174
+ * @param maxDepth - The maximum depth of recursion.
6175
+ * @returns A serialized representation of the error.
6176
+ */
6177
+ export declare function serializeError(error: Error, depth?: number, maxDepth?: number): Record<string, any>;
6178
+
6179
+ /**
6180
+ * 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.
6181
+ *
6182
+ * @param subscriptionRequest - An object representing a subscription request.
6183
+ * @returns A serialized subscription in url-encoded form.
6184
+ */
6185
+ export declare function serializeFhircastSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): string;
6186
+
6187
+ export declare function serverError(err: Error): OperationOutcome;
6188
+
6189
+ export declare function serverTimeout(msg?: string): OperationOutcome;
6190
+
6191
+ /**
6192
+ * Sets a code for a given system within a given codeable concept.
6193
+ * @param concept - The codeable concept.
6194
+ * @param system - The system string.
6195
+ * @param code - The code value.
6196
+ */
6197
+ export declare function setCodeBySystem(concept: CodeableConcept, system: string, code: string): void;
6198
+
6199
+ /**
6200
+ * Sets a resource identifier for the given system.
6201
+ *
6202
+ * Note that this method is only available on resources that have an "identifier" property,
6203
+ * and that property must be an array of Identifier objects,
6204
+ * which is not true for all FHIR resources.
6205
+ *
6206
+ * If the identifier already exists, then the value is updated.
6207
+ *
6208
+ * Otherwise a new identifier is added.
6209
+ *
6210
+ * @param resource - The resource to add the identifier to.
6211
+ * @param system - The identifier system.
6212
+ * @param value - The identifier value.
6213
+ */
6214
+ export declare function setIdentifier(resource: Resource & {
6215
+ identifier?: Identifier[];
6216
+ }, system: string, value: string): void;
6217
+
6218
+ export declare function singleton(collection: TypedValue[], type?: string): TypedValue | undefined;
6219
+
6220
+ export declare function singularize<T>(value: T | T[] | undefined): T | undefined;
6221
+
6222
+ /**
6223
+ * Sleeps for the specified number of milliseconds.
6224
+ * @param ms - Time delay in milliseconds
6225
+ * @returns A promise that resolves after the specified number of milliseconds.
6226
+ */
6227
+ export declare const sleep: (ms: number) => Promise<void>;
6228
+
6229
+ export declare interface SliceDefinition extends Omit<InternalSchemaElement, 'slicing'> {
6230
+ name: string;
6231
+ definition?: string;
6232
+ elements: Record<string, InternalSchemaElement>;
6233
+ }
6234
+
6235
+ export declare type SliceDefinitionWithTypes = SliceDefinition & {
6236
+ type: NonNullable<SliceDefinition['type']>;
6237
+ typeSchema?: InternalTypeSchema;
6238
+ };
6239
+
6240
+ export declare interface SliceDiscriminator {
6241
+ path: string;
6242
+ type: string;
6243
+ }
6244
+
6245
+ export declare interface SlicingRules {
6246
+ discriminator: SliceDiscriminator[];
6247
+ ordered: boolean;
6248
+ rule?: 'open' | 'closed' | 'openAtEnd';
6249
+ slices: SliceDefinition[];
6250
+ }
6251
+
6252
+ export declare const SNOMED = "http://snomed.info/sct";
6253
+
6254
+ export declare interface SortRule {
6255
+ code: string;
6256
+ descending?: boolean;
6257
+ }
6258
+
6259
+ /**
6260
+ * Sorts an array of strings in place using the localeCompare method.
6261
+ *
6262
+ * This method will mutate the input array.
6263
+ *
6264
+ * @param array - The array of strings to sort.
6265
+ * @returns The sorted array of strings.
6266
+ */
6267
+ export declare function sortStringArray(array: string[]): string[];
6268
+
6269
+ /**
6270
+ * Splits a string into an array of strings using the specified delimiter.
6271
+ * Unlike the built-in split function, this function will split the string into a maximum of exactly n parts.
6272
+ * Trailing empty strings are included in the result.
6273
+ * @param str - The string to split.
6274
+ * @param delim - The delimiter.
6275
+ * @param n - The maximum number of parts to split the string into.
6276
+ * @returns The resulting array of strings.
6277
+ */
6278
+ export declare function splitN(str: string, delim: string, n: number): string[];
6279
+
6280
+ /**
6281
+ * Splits a FHIR search value on commas.
6282
+ * Respects backslash escape.
6283
+ *
6284
+ * See: https://hl7.org/fhir/r4/search.html#escaping
6285
+ *
6286
+ * @param input - The FHIR search value to split.
6287
+ * @returns The individual search values.
6288
+ */
6289
+ export declare function splitSearchOnComma(input: string): string[];
6290
+
6291
+ export declare type StatsFn = (data: number[]) => number | Quantity;
6292
+
6293
+ /**
6294
+ * Reads data from a Readable stream and returns a Promise that resolves with a Buffer containing all the data.
6295
+ * @param stream - The Readable stream to read from.
6296
+ * @returns A Promise that resolves with a Buffer containing all the data from the Readable stream.
6297
+ */
6298
+ export declare function streamToBuffer(stream: Readable): Promise<Buffer>;
6299
+
6300
+ /**
6301
+ * Returns the FHIR JSON string representation of the input value.
6302
+ *
6303
+ * Removes properties with empty string values.
6304
+ * Removes objects with zero properties.
6305
+ *
6306
+ * Does not modify the input value.
6307
+ * If the input value does not contain any empty properties, then the original value is returned.
6308
+ * Otherwise, a new value is returned with the empty properties removed.
6309
+ *
6310
+ * See: https://www.hl7.org/fhir/json.html
6311
+ *
6312
+ * @param value - The input value.
6313
+ * @param pretty - Optional flag to pretty-print the JSON.
6314
+ * @returns The resulting JSON string.
6315
+ */
6316
+ export declare function stringify(value: any, pretty?: boolean): string;
6317
+
6318
+ /**
6319
+ * Output the string representation of a value, suitable for use as part of a search query.
6320
+ * @param v - The value to format as a string
6321
+ * @returns The stringified value
6322
+ */
6323
+ export declare function stringifyTypedValue(v: TypedValue): string;
6324
+
6325
+ export declare type StringMap = {
6326
+ [key: string]: string;
6327
+ };
6328
+
6329
+ /**
6330
+ * Transforms input values using a FHIR StructureMap.
6331
+ *
6332
+ * See: https://www.hl7.org/fhir/mapping-language.html
6333
+ *
6334
+ * @param structureMap - The StructureMap to transform.
6335
+ * @param input - The input values.
6336
+ * @param transformMaps - Optional collection of imported StructureMaps and ConceptMaps.
6337
+ * @returns The transformed values.
6338
+ */
6339
+ export declare function structureMapTransform(structureMap: StructureMap, input: TypedValue[], transformMaps?: TransformMapCollection): TypedValue[];
6340
+
6341
+ export declare interface SubManagerOptions {
6342
+ ReconnectingWebSocket?: IReconnectingWebSocketCtor;
6343
+ pingIntervalMs?: number;
6344
+ debug?: boolean;
6345
+ debugLogger?: (...args: any[]) => void;
6346
+ }
6347
+
6348
+ /**
6349
+ * An `EventTarget` that emits events when new subscription notifications come in over WebSockets.
6350
+ *
6351
+ * -----
6352
+ *
6353
+ * ### Events emitted:
6354
+ *
6355
+ * - `connect` - A new subscription is connected to the `SubscriptionManager` and `message` events for this subscription can be expected.
6356
+ * - `disconnect` - The specified subscription is no longer being monitored by the `SubscriptionManager`.
6357
+ * - `error` - An error has occurred.
6358
+ * - `message` - A message containing a notification `Bundle` has been received.
6359
+ * - `open` - The WebSocket has been opened.
6360
+ * - `close` - The WebSocket has been closed.
6361
+ * - `heartbeat` - A `heartbeat` message has been received.
6362
+ */
6363
+ export declare class SubscriptionEmitter extends TypedEventTarget<SubscriptionEventMap> {
6364
+ private readonly criteria;
6365
+ constructor(...criteria: string[]);
6366
+ getCriteria(): Set<string>;
6367
+ /**
6368
+ * @internal
6369
+ * @param criteria - The criteria to add to this `SubscriptionEmitter`.
6370
+ */
6371
+ _addCriteria(criteria: string): void;
6372
+ /**
6373
+ * @internal
6374
+ * @param criteria - The criteria to remove from this `SubscriptionEmitter`.
6375
+ */
6376
+ _removeCriteria(criteria: string): void;
6377
+ }
6378
+
6379
+ export declare type SubscriptionEventMap = {
6380
+ connect: {
6381
+ type: 'connect';
6382
+ payload: {
6383
+ subscriptionId: string;
6384
+ };
6385
+ };
6386
+ disconnect: {
6387
+ type: 'disconnect';
6388
+ payload: {
6389
+ subscriptionId: string;
6390
+ };
6391
+ };
6392
+ error: {
6393
+ type: 'error';
6394
+ payload: Error;
6395
+ };
6396
+ message: {
6397
+ type: 'message';
6398
+ payload: Bundle;
6399
+ };
6400
+ open: {
6401
+ type: 'open';
6402
+ };
6403
+ close: {
6404
+ type: 'close';
6405
+ };
6406
+ heartbeat: {
6407
+ type: 'heartbeat';
6408
+ payload: Bundle;
6409
+ };
6410
+ };
6411
+
6412
+ export declare class SubscriptionManager {
6413
+ private readonly medplum;
6414
+ private readonly ws;
6415
+ private masterSubEmitter?;
6416
+ private readonly criteriaEntries;
6417
+ private readonly criteriaEntriesBySubscriptionId;
6418
+ private wsClosed;
6419
+ private pingTimer;
6420
+ private readonly pingIntervalMs;
6421
+ private waitingForPong;
6422
+ private currentProfile;
6423
+ constructor(medplum: MedplumClient, wsUrl: URL | string, options?: SubManagerOptions);
6424
+ private setupListeners;
6425
+ private emitError;
6426
+ private maybeEmitDisconnect;
6427
+ private getTokenForCriteria;
6428
+ private maybeGetCriteriaEntry;
6429
+ private getAllCriteriaEmitters;
6430
+ private addCriteriaEntry;
6431
+ private removeCriteriaEntry;
6432
+ private subscribeToCriteria;
6433
+ private refreshAllSubscriptions;
6434
+ addCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): SubscriptionEmitter;
6435
+ removeCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): void;
6436
+ getWebSocket(): IReconnectingWebSocket;
6437
+ closeWebSocket(): void;
6438
+ reconnectWebSocket(): void;
6439
+ getCriteriaCount(): number;
6440
+ getMasterEmitter(): SubscriptionEmitter;
6441
+ }
6442
+
6443
+ /**
6444
+ * A `FHIRcast` subscription request.
6445
+ *
6446
+ * Can be passed to `MedplumClient.fhircastConnect` or `MedplumClient.fhircastUnsubscribe` to either open a `FHIRcast` connection, or unsubscribe from the subscription.
6447
+ */
6448
+ export declare type SubscriptionRequest = {
6449
+ channelType: 'websocket';
6450
+ mode: 'subscribe' | 'unsubscribe';
6451
+ events: FhircastEventName[];
6452
+ topic: string;
6453
+ endpoint: string;
6454
+ };
6455
+
6456
+ /**
6457
+ * Construct the subset of a resource containing a minimum set of fields. The returned resource is not guaranteed
6458
+ * to contain only the provided properties, and may contain others (e.g. `resourceType` and `id`)
6459
+ *
6460
+ * @param resource - The resource to subset
6461
+ * @param properties - The minimum properties to include in the subset
6462
+ * @returns The modified resource, containing the listed properties and possibly other mandatory ones
6463
+ */
6464
+ export declare function subsetResource<T extends Resource>(resource: T | undefined, properties: string[]): T | undefined;
6465
+
6466
+ /**
6467
+ * Summarizes a group of Observations into a single computed summary value, with the individual values
6468
+ * preserved in `Observation.component.valueSampledData`.
6469
+ *
6470
+ * @param observations - The Observations to summarize.
6471
+ * @param summaryCode - The code for the summarized value.
6472
+ * @param summarizeFn - Function to summarize the data points.
6473
+ * @returns - The summary Observation resource.
6474
+ */
6475
+ export declare function summarizeObservations(observations: Observation[] | Bundle<Observation>, summaryCode: CodeableConcept, summarizeFn: StatsFn): Observation;
6476
+
6477
+ export declare class SymbolAtom implements Atom {
6478
+ readonly name: string;
6479
+ constructor(name: string);
6480
+ eval(context: AtomContext, input: TypedValue[]): TypedValue[];
6481
+ private getVariable;
6482
+ private evalValue;
6483
+ toString(): string;
6484
+ }
6485
+
6486
+ /**
6487
+ * Converts unknown object into a JavaScript boolean.
6488
+ * Note that this is different than the FHIRPath "toBoolean",
6489
+ * which has particular semantics around arrays, empty arrays, and type conversions.
6490
+ * @param obj - Any value or array of values.
6491
+ * @returns The converted boolean value according to FHIRPath rules.
6492
+ */
6493
+ export declare function toJsBoolean(obj: TypedValue[]): boolean;
6494
+
6495
+ export declare interface Token extends Marker {
6496
+ id: string;
6497
+ value: string;
6498
+ }
6499
+
6500
+ export declare class Tokenizer {
6501
+ private readonly str;
6502
+ private readonly keywords;
6503
+ private readonly operators;
6504
+ private readonly dateTimeLiterals;
6505
+ private readonly symbolRegex;
6506
+ private readonly result;
6507
+ private readonly pos;
6508
+ private readonly markStack;
6509
+ constructor(str: string, keywords: string[], operators: string[], options?: TokenizerOptions);
6510
+ tokenize(): Token[];
6511
+ private prevToken;
6512
+ private peekToken;
6513
+ private consumeToken;
6514
+ private consumeWhitespace;
6515
+ private consumeMultiLineComment;
6516
+ private consumeSingleLineComment;
6517
+ private consumeString;
6518
+ private consumeChar;
6519
+ private consumeQuotedSymbol;
6520
+ private consumeDateTime;
6521
+ private consumeNumber;
6522
+ private consumeSymbol;
6523
+ private consumeOperator;
6524
+ private consumeWhile;
6525
+ private curr;
6526
+ private peek;
6527
+ private mark;
6528
+ private reset;
6529
+ private advance;
6530
+ private buildToken;
6531
+ }
6532
+
6533
+ export declare interface TokenizerOptions {
6534
+ dateTimeLiterals?: boolean;
6535
+ symbolRegex?: RegExp;
6536
+ }
6537
+
6538
+ export declare interface TokenResponse {
6539
+ readonly token_type: string;
6540
+ readonly id_token: string;
6541
+ readonly access_token: string;
6542
+ readonly refresh_token: string;
6543
+ readonly expires_in: number;
6544
+ readonly project: Reference<Project>;
6545
+ readonly profile: Reference<ProfileResource>;
6546
+ }
6547
+
6548
+ export declare interface TokensContext {
6549
+ caseInsensitive?: boolean;
6550
+ textSearchSystem?: string;
6551
+ }
6552
+
6553
+ export declare const tooManyRequests: OperationOutcome;
6554
+
6555
+ /**
6556
+ * Tries to convert an unknown input value to a Period object.
6557
+ * @param input - Unknown input value.
6558
+ * @returns A Period object or undefined.
6559
+ */
6560
+ export declare function toPeriod(input: unknown): Period | undefined;
6561
+
6562
+ /**
6563
+ * Returns a "best guess" TypedValue for a given value.
6564
+ * @param value - The unknown value to check.
6565
+ * @returns A "best guess" TypedValue for the given value.
6566
+ */
6567
+ export declare function toTypedValue(value: unknown): TypedValue;
6568
+
6569
+ /**
6570
+ * The TransformMapCollection class is a collection of StructureMap and ConceptMap resources.
6571
+ * It is used to store and retrieve imported StructureMaps and ConceptMaps by URL.
6572
+ */
6573
+ export declare class TransformMapCollection {
6574
+ readonly resources: (StructureMap | ConceptMap)[];
6575
+ constructor(resources?: (StructureMap | ConceptMap)[]);
6576
+ get<K extends ResourceType>(resourceType: K, url: string): ExtractResource<K>[];
6577
+ private matchesUrl;
6578
+ }
6579
+
6580
+ /**
6581
+ * Returns an array with trailing empty elements removed.
6582
+ * For example, [1, 2, 3, null, undefined, ''] becomes [1, 2, 3].
6583
+ * This is useful for FHIR arrays, which by default must maintain the same length,
6584
+ * but while editing we may want to trim trailing empty elements.
6585
+ * @param arr - The input array.
6586
+ * @returns The array with trailing empty elements removed.
6587
+ */
6588
+ export declare function trimTrailingEmptyElements<T>(arr: T[] | undefined): T[] | undefined;
6589
+
6590
+ export declare function tryGetDataType(type: string, profileUrl?: string): InternalTypeSchema | undefined;
6591
+
6592
+ /**
6593
+ * Returns the JWT expiration time in number of milliseconds elapsed since the epoch.
6594
+ * @param token - The JWT token.
6595
+ * @returns The JWT expiration time in number of milliseconds elapsed since the epoch if available, undefined if unknown.
6596
+ */
6597
+ export declare function tryGetJwtExpiration(token: string): number | undefined;
6598
+
6599
+ export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
6600
+
6601
+ export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
6602
+ private readonly emitter;
6603
+ dispatchEvent<TEventType extends keyof TEvents & string>(event: TEvents[TEventType]): void;
6604
+ addEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
6605
+ removeEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
6606
+ removeAllListeners(): void;
6607
+ }
6608
+
6609
+ export declare interface TypedValue {
6610
+ readonly type: string;
6611
+ readonly value: any;
6612
+ }
6613
+
6614
+ /**
6615
+ * Converts a typed value to a string.
6616
+ * @param typedValue - The typed value to convert to a string.
6617
+ * @returns The string representation of the typed value.
6618
+ */
6619
+ export declare function typedValueToString(typedValue: TypedValue | undefined): string;
6620
+
6621
+ export declare type TypedValueWithPath = TypedValue & {
6622
+ path: string;
6623
+ };
6624
+
6625
+ /**
6626
+ * An indexed TypeSchema.
6627
+ *
6628
+ * Example: The IndexedStructureDefinition for "Patient" would include the following TypeSchemas:
6629
+ * 1) Patient
6630
+ * 2) Patient_Contact
6631
+ * 3) Patient_Communication
6632
+ * 4) Patient_Link
6633
+ */
6634
+ export declare interface TypeInfo {
6635
+ searchParams?: Record<string, SearchParameter>;
6636
+ searchParamsDetails?: Record<string, SearchParameterDetails>;
6637
+ }
6638
+
6639
+ export declare type TypeName<T> = T extends string ? 'string' : T extends number ? 'number' : T extends boolean ? 'boolean' : T extends undefined ? 'undefined' : 'object';
6640
+
6641
+ export declare const UCUM = "http://unitsofmeasure.org";
6642
+
6643
+ export declare class UnaryOperatorAtom extends PrefixOperatorAtom {
6644
+ readonly impl: (x: TypedValue[]) => TypedValue[];
6645
+ constructor(operator: string, child: Atom, impl: (x: TypedValue[]) => TypedValue[]);
6646
+ eval(context: AtomContext, input: TypedValue[]): TypedValue[];
6647
+ toString(): string;
6648
+ }
6649
+
6650
+ export declare const unauthorized: OperationOutcome;
6651
+
6652
+ export declare const unauthorizedTokenAudience: OperationOutcome;
6653
+
6654
+ export declare const unauthorizedTokenExpired: OperationOutcome;
6655
+
6656
+ export declare class UnionAtom extends InfixOperatorAtom {
6657
+ constructor(left: Atom, right: Atom);
6658
+ eval(context: AtomContext, input: TypedValue[]): TypedValue[];
6659
+ }
6660
+
6661
+ export declare const VALID_HOSTNAME_REGEX: RegExp;
6662
+
6663
+ /**
6664
+ * Validates that a `SubscriptionRequest`.
6665
+ *
6666
+ * @param subscriptionRequest - The `SubscriptionRequest` to validate.
6667
+ * @returns A `boolean` indicating whether or not the `SubscriptionRequest` is valid.
6668
+ */
6669
+ export declare function validateFhircastSubscriptionRequest(subscriptionRequest: SubscriptionRequest | PendingSubscriptionRequest): boolean;
6670
+
6671
+ export declare function validateResource(resource: Resource, options?: ValidatorOptions): OperationOutcomeIssue[];
6672
+
6673
+ /**
6674
+ * Validates that the given string is a valid FHIR resource type.
6675
+ *
6676
+ * On success, silently returns void.
6677
+ * On failure, throws an OperationOutcomeError.
6678
+ *
6679
+ * @example
6680
+ * ```ts
6681
+ * validateResourceType('Patient'); // nothing
6682
+ * validateResourceType('XYZ'); // throws OperationOutcomeError
6683
+ * ```
6684
+ *
6685
+ * Note that this depends on globalSchema, which is populated by the StructureDefinition loader.
6686
+ *
6687
+ * @example
6688
+ * In a server context, you can load all schema definitions:
6689
+ *
6690
+ * ```ts
6691
+ * import { indexStructureDefinitionBundle } from '@medplum/core';
6692
+ * import { readJson } from '@medplum/definitions';
6693
+ * import { Bundle } from '@medplum/fhirtypes';
6694
+ *
6695
+ * indexStructureDefinitionBundle(readJson('fhir/r4/profiles-resources.json') as Bundle);
6696
+ * ```
6697
+ *
6698
+ * @example
6699
+ * In a client context, you can load the schema definitions using MedplumClient:
6700
+ *
6701
+ * ```ts
6702
+ * import { MedplumClient } from '@medplum/core';
6703
+ *
6704
+ * const medplum = new MedplumClient();
6705
+ * await medplum.requestSchema('Patient');
6706
+ * ```
6707
+ *
6708
+ * @param resourceType - The candidate resource type string.
6709
+ */
6710
+ export declare function validateResourceType(resourceType: string): void;
6711
+
6712
+ export declare function validateTypedValue(typedValue: TypedValue, options?: ValidatorOptions): OperationOutcomeIssue[];
6713
+
6714
+ export declare function validationError(details: string): OperationOutcome;
6715
+
6716
+ export declare const validationRegexes: Record<string, RegExp>;
6717
+
6718
+ export declare interface ValidatorOptions {
6719
+ profile?: StructureDefinition;
6720
+ collect?: {
6721
+ tokens?: Record<string, TypedValueWithPath[]>;
6722
+ };
6723
+ }
6724
+
6725
+ export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
6726
+
6727
+ /**
6728
+ * ValueSet $expand operation parameters.
6729
+ * See {@link https://hl7.org/fhir/r4/valueset-operation-expand.html | FHIR ValueSet $expand Operation Parameters} for full details.
6730
+ */
6731
+ export declare interface ValueSetExpandParams {
6732
+ url?: string;
6733
+ filter?: string;
6734
+ date?: string;
6735
+ offset?: number;
6736
+ count?: number;
6737
+ }
6738
+
6739
+ /**
6740
+ * Checks if a newer version of Medplum is available and logs a warning if so.
6741
+ * @param appName - The name of the app to check the version for.
6742
+ * @param params - An optional list of key-value pairs to be appended to the URL query string.
6743
+ */
6744
+ export declare function warnIfNewerVersionAvailable(appName: string, params?: Record<string, string>): Promise<void>;
6745
+
6746
+ declare type WebSocketEventMap_2 = {
6747
+ close: CloseEvent_2;
6748
+ error: ErrorEvent_2;
6749
+ message: MessageEvent;
6750
+ open: Event;
6751
+ };
6752
+ export { WebSocketEventMap_2 as WebSocketEventMap }
6753
+
6754
+ export declare type WithId<T> = T & {
6755
+ id: string;
6756
+ };
6757
+
6758
+ /**
6759
+ * Returns a word-wrapped string.
6760
+ * Based on: https://stackoverflow.com/a/38709683
6761
+ * @param text - Original input string.
6762
+ * @param maxLength - Width in number of characters.
6763
+ * @returns Array of lines.
6764
+ */
6765
+ export declare function wordWrap(text: string, maxLength: number): string[];
6766
+
6767
+ /**
6768
+ * 6.5.4. xor
6769
+ * Returns true if exactly one of the operands evaluates to true,
6770
+ * false if either both operands evaluate to true or both operands evaluate to false,
6771
+ * and the empty collection otherwise.
6772
+ */
6773
+ export declare class XorAtom extends BooleanInfixOperatorAtom {
6774
+ constructor(left: Atom, right: Atom);
6775
+ eval(context: AtomContext, input: TypedValue[]): TypedValue[];
6776
+ }
6777
+
6778
+ export { }