@medplum/core 4.5.1 → 4.5.2

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