@medplum/core 5.1.28 → 5.1.30

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.
@@ -16,6 +16,7 @@ import type { CustomTableLayout } from 'pdfmake/interfaces';
16
16
  import type { Device } from '@medplum/fhirtypes';
17
17
  import type { DiagnosticReport } from '@medplum/fhirtypes';
18
18
  import type { DocumentReference } from '@medplum/fhirtypes';
19
+ import type { Duration } from '@medplum/fhirtypes';
19
20
  import type { ElementDefinition } from '@medplum/fhirtypes';
20
21
  import type { ElementDefinitionBinding } from '@medplum/fhirtypes';
21
22
  import type { Encounter } from '@medplum/fhirtypes';
@@ -831,6 +832,17 @@ export declare function checkIfValidMedplumVersion(appName: string, version: str
831
832
  */
832
833
  export declare function clearReleaseCache(): void;
833
834
 
835
+ /**
836
+ * Immutably clears one scheduling parameter a Schedule sets for a HealthcareService, dropping that
837
+ * calendar back to the service-level parameter of the same name. Pairs with `setScheduleParameter`
838
+ * and `getScheduleParameters`.
839
+ * @param schedule - Schedule to update
840
+ * @param service - HealthcareService referenced by the parameters
841
+ * @param url - Url of the SchedulingParameters sub-extension to remove, for example `availability`
842
+ * @returns A cloned Schedule without the matching parameter
843
+ */
844
+ export declare function clearScheduleParameter(schedule: Schedule, service: WithId<HealthcareService>, url: string): Schedule;
845
+
834
846
  /**
835
847
  * Log level for MedplumClient requests and responses.
836
848
  * - 'none': No logging
@@ -925,14 +937,19 @@ export declare function conceptMapTranslate(map: ConceptMap, params: ConceptMapT
925
937
  export declare interface ConceptMapTranslateMatch {
926
938
  equivalence?: string;
927
939
  concept?: Coding;
928
- property?: ConceptMapTranslateMatchAttribute[];
940
+ property?: ConceptMapTranslateMatchProperty[];
929
941
  dependsOn?: ConceptMapTranslateMatchAttribute[];
930
942
  product?: ConceptMapTranslateMatchAttribute[];
931
943
  source?: string;
932
944
  }
933
945
 
934
946
  export declare interface ConceptMapTranslateMatchAttribute {
935
- key: string;
947
+ attribute: string;
948
+ value: TypedValue;
949
+ }
950
+
951
+ export declare interface ConceptMapTranslateMatchProperty {
952
+ uri: string;
936
953
  value: TypedValue;
937
954
  }
938
955
 
@@ -1060,6 +1077,17 @@ export declare interface CopyOperation {
1060
1077
  path: string;
1061
1078
  }
1062
1079
 
1080
+ /**
1081
+ * Counts iterable elements by a key function, returning a sparse map of key to count.
1082
+ * Matches Lodash `countBy` semantics (no zero-fill for missing keys).
1083
+ * @param items - The items to count.
1084
+ * @param keyFn - The function to extract the key from each item.
1085
+ * @returns A map of key to count for keys that appear at least once.
1086
+ */
1087
+ export declare function countBy<T, K extends keyof any>(items: Iterable<T>, keyFn: (value: T) => K): Partial<Record<K, number>>;
1088
+
1089
+ export declare function countWhere<T>(items: Iterable<T>, fn: (value: T) => boolean): number;
1090
+
1063
1091
  export declare const CPT = "http://www.ama-assn.org/go/cpt";
1064
1092
 
1065
1093
  export declare interface CrawlerOptions {
@@ -1632,6 +1660,15 @@ export declare interface ExtendedInternalSchemaElement extends InternalSchemaEle
1632
1660
  readonly?: boolean;
1633
1661
  }
1634
1662
 
1663
+ /**
1664
+ * Anything that can carry FHIR extensions: resources such as `Patient`, data types such as
1665
+ * `CodeableConcept`, and extensions themselves. Structural, so any of those is accepted, while a
1666
+ * type that cannot hold extensions, `Binary` being the notable example, is rejected.
1667
+ */
1668
+ export declare interface Extensible {
1669
+ extension?: Extension[];
1670
+ }
1671
+
1635
1672
  export declare type ExternalSecret<T extends ExternalSecretPrimitive = ExternalSecretPrimitive> = {
1636
1673
  system: ExternalSecretSystem;
1637
1674
  key: string;
@@ -1852,7 +1889,11 @@ export declare type FhircastConnectEvent = {
1852
1889
  * 2. `message` - Contains a `payload` field containing a `FHIRcast` message payload exactly as it comes in over WebSockets.
1853
1890
  * 3. `disconnect` - An event to signal when a WebSocket connection has been closed. Fired as soon as a WebSocket emits `close`.
1854
1891
  *
1855
- * To close the connection, call `connection.disconnect()` and listen to the `disconnect` event to know when the connection has been disconnected.
1892
+ * The underlying socket reconnects on its own, so `disconnect` followed by `connect` is the normal
1893
+ * shape of a dropped connection rather than the end of the session. A subscription endpoint stays
1894
+ * valid for the lease the Hub granted it, so reconnecting resubscribes without a new `hub.subscribe`
1895
+ * request. Two things end a connection for good: calling `connection.disconnect()`, and the Hub
1896
+ * denying the subscription — after either, `connect` will not fire again.
1856
1897
  */
1857
1898
  export declare class FhircastConnection extends TypedEventTarget<FhircastSubscriptionEventMap> {
1858
1899
  readonly subRequest: SubscriptionRequest;
@@ -1860,11 +1901,17 @@ export declare class FhircastConnection extends TypedEventTarget<FhircastSubscri
1860
1901
  /**
1861
1902
  * Creates a new `FhircastConnection`.
1862
1903
  * @param subRequest - The subscription request to initialize the connection from.
1904
+ * @param options - Options for the underlying `ReconnectingWebSocket`.
1863
1905
  */
1864
- constructor(subRequest: SubscriptionRequest);
1906
+ constructor(subRequest: SubscriptionRequest, options?: FhircastConnectionOptions);
1865
1907
  disconnect(): void;
1866
1908
  }
1867
1909
 
1910
+ export declare type FhircastConnectionOptions = Options & {
1911
+ /** An alternate `ReconnectingWebSocket` implementation to open the connection with. */
1912
+ ReconnectingWebSocket?: IReconnectingWebSocketCtor;
1913
+ };
1914
+
1868
1915
  export declare type FhircastContextResourceType<EventName extends FhircastEventName, K extends FhircastEventKeys<EventName>> = (typeof FHIRCAST_EVENT_RESOURCES)[EventName][K] extends {
1869
1916
  resourceType: infer R;
1870
1917
  } ? R : never;
@@ -2466,6 +2513,18 @@ export declare function getExpressionsForResourceType(resourceType: string, expr
2466
2513
  */
2467
2514
  export declare function getExtension(resource: any, ...urls: string[]): Extension | undefined;
2468
2515
 
2516
+ /**
2517
+ * Returns every extension reachable by the given extension URLs.
2518
+ *
2519
+ * Like `getExtension`, but does not stop at the first match: extensions that repeat under one URL are
2520
+ * all returned, at every level. Use it for extensions defined with a cardinality above one, where
2521
+ * `getExtension` would silently read only the first.
2522
+ * @param extensible - The base resource, data type, or extension. Anything that may hold an `extension` array.
2523
+ * @param urlOrUrls - One extension URL, or an array of them where each entry represents descending a level in a nested extension.
2524
+ * @returns Every matching extension, in document order. Empty if none match or no URL is given.
2525
+ */
2526
+ export declare function getExtensions(extensible: Extensible | undefined, urlOrUrls: string | string[]): Extension[];
2527
+
2469
2528
  /**
2470
2529
  * Returns an extension value by extension URLs.
2471
2530
  * @param resource - The base resource.
@@ -2608,6 +2667,30 @@ export declare function getReferenceString(input: Reference | Resource): string
2608
2667
  */
2609
2668
  export declare function getResourceTypes(): ResourceType[];
2610
2669
 
2670
+ /**
2671
+ * Reads one scheduling parameter a Schedule sets for a HealthcareService, taking precedence over the
2672
+ * service-level parameter of the same name. Pairs with `setScheduleParameter` and `clearScheduleParameter`.
2673
+ *
2674
+ * The result is a list rather than a single extension because a Schedule may carry more than one
2675
+ * SchedulingParameters extension matching the service, and because a parameter may legitimately repeat.
2676
+ * @param schedule - Schedule to inspect
2677
+ * @param service - HealthcareService referenced by the parameters
2678
+ * @param url - Url of the SchedulingParameters sub-extension to read, for example `availability`
2679
+ * @returns Every matching sub-extension, in document order
2680
+ */
2681
+ export declare function getScheduleParameters(schedule: Schedule, service: WithId<HealthcareService>, url: string): Extension[];
2682
+
2683
+ /**
2684
+ * Resolves the timezone used by scheduling in server priority order: the Schedule's parameters for the
2685
+ * service, then the service's own parameters, then the actor's standard FHIR timezone extension.
2686
+ * @param service - HealthcareService whose parameters may define a timezone
2687
+ * @param schedule - Schedule whose parameters may define a timezone. Omit to resolve the service's own timezone,
2688
+ * as when the service default hours are being read on their own rather than through a particular calendar.
2689
+ * @param actor - Optional Schedule actor used as a timezone fallback
2690
+ * @returns The resolved IANA timezone identifier, if present
2691
+ */
2692
+ export declare function getSchedulingTimezone(service: WithId<HealthcareService>, schedule?: Schedule, actor?: Resource): string | undefined;
2693
+
2611
2694
  /**
2612
2695
  * Returns a search parameter for a resource type by search code.
2613
2696
  * @param resourceType - The FHIR resource type.
@@ -2720,6 +2803,9 @@ export declare interface GoogleLoginRequest extends BaseLoginRequest {
2720
2803
 
2721
2804
  /**
2722
2805
  * Returns whether a Schedule or HealthcareService has a SchedulingParameters extension.
2806
+ *
2807
+ * Unscoped: on a Schedule, where the extension repeats once per service, this reports that some
2808
+ * service is configured rather than any particular one. Ask `getScheduleParameters` about a service.
2723
2809
  * @param resource - Schedule or HealthcareService to inspect
2724
2810
  * @returns True if the resource has a SchedulingParameters extension
2725
2811
  */
@@ -3668,7 +3754,7 @@ export declare function isStringArray(arr: any[]): arr is string[];
3668
3754
 
3669
3755
  export declare type IssueSeverity = 'error' | 'fatal' | 'warning' | 'information';
3670
3756
 
3671
- export declare type IssueType = 'structure' | 'invariant' | 'processing';
3757
+ export declare type IssueType = 'structure' | 'invariant' | 'processing' | 'required';
3672
3758
 
3673
3759
  /**
3674
3760
  * Returns true if the input value is an object with a string text property.
@@ -4223,6 +4309,25 @@ export declare interface MedicationOrderDrugInput {
4223
4309
  readonly ndc?: string;
4224
4310
  readonly rxNorm?: string;
4225
4311
  readonly routedMedId?: number;
4312
+ /**
4313
+ * Vendor formulation key, paired with {@link routedMedId} to order a drug that
4314
+ * has no dose-level product to resolve an NDC from — OTC / topical /
4315
+ * wide-multi-strength generics for which the vendor's dose-format lookup
4316
+ * returns nothing. Supply {@link drugName} alongside it, since there is no
4317
+ * catalog row to derive a name from.
4318
+ */
4319
+ readonly gcnSeqno?: number;
4320
+ /** Drug name, required for a {@link gcnSeqno}-keyed line (no catalog row to name it). */
4321
+ readonly drugName?: string;
4322
+ /**
4323
+ * Dose text for a {@link gcnSeqno}-keyed line, e.g. `"solution"`.
4324
+ *
4325
+ * Optional, and only worth sending when the caller holds dose text *separate*
4326
+ * from {@link drugName} — a hand-entered form, say. Passing a full product
4327
+ * label duplicates it in the description the vendor renders. When omitted, the
4328
+ * vendor derives the dose from the formulation key or falls back to the sig.
4329
+ */
4330
+ readonly line1?: string;
4226
4331
  readonly quantity: number;
4227
4332
  readonly quantityQualifier?: string;
4228
4333
  readonly refill?: number;
@@ -4378,6 +4483,13 @@ export declare interface MedicationSearchParams {
4378
4483
  readonly ndc?: string;
4379
4484
  readonly rxNorm?: string;
4380
4485
  readonly routedMedId?: number;
4486
+ /**
4487
+ * Vendor formulation keys under {@link routedMedId}, from the name-search hit.
4488
+ * Only used when the drug has no dose-level products: each key is resolved to
4489
+ * its marketed strength so the caller still gets selectable formulations
4490
+ * instead of an empty result. Ignored otherwise.
4491
+ */
4492
+ readonly gcnSeqnos?: number[];
4381
4493
  readonly searchOtc?: boolean;
4382
4494
  readonly searchSupply?: boolean;
4383
4495
  readonly searchBrand?: boolean;
@@ -6068,9 +6180,10 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
6068
6180
  *
6069
6181
  * @category FHIRcast
6070
6182
  * @param subRequest - The `SubscriptionRequest` to use for connecting.
6183
+ * @param options - Options for the underlying `ReconnectingWebSocket`.
6071
6184
  * @returns A `FhircastConnection` which emits lifecycle events for the `FHIRcast` WebSocket connection.
6072
6185
  */
6073
- fhircastConnect(subRequest: SubscriptionRequest): FhircastConnection;
6186
+ fhircastConnect(subRequest: SubscriptionRequest, options?: FhircastConnectionOptions): FhircastConnection;
6074
6187
  /**
6075
6188
  * Publishes a new context to a given topic for a specified event type.
6076
6189
  *
@@ -8165,6 +8278,15 @@ export declare class ParserBuilder {
8165
8278
  */
8166
8279
  export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
8167
8280
 
8281
+ /**
8282
+ * Converts a SchedulingParameters duration to minutes.
8283
+ *
8284
+ * @param duration - The duration to convert.
8285
+ * @returns The length in minutes, or undefined when the duration has no value, a
8286
+ * negative value, or a unit scheduling does not accept.
8287
+ */
8288
+ export declare function schedulingDurationToMinutes(duration: Duration | undefined): number | undefined;
8289
+
8168
8290
  export declare const SchedulingEncounterCodingURI = "https://medplum.com/fhir/StructureDefinition/SchedulingEncounterCoding";
8169
8291
 
8170
8292
  export declare const SchedulingParametersURI = "https://medplum.com/fhir/StructureDefinition/SchedulingParameters";
@@ -8322,6 +8444,23 @@ export declare class ParserBuilder {
8322
8444
  use?: Identifier['use'];
8323
8445
  }
8324
8446
 
8447
+ /**
8448
+ * Immutably sets one scheduling parameter on a Schedule for a HealthcareService, so that calendar keeps
8449
+ * it in place of the service-level parameter of the same name. Whatever the Schedule already holds at the
8450
+ * sub-extension's url is replaced, and the SchedulingParameters extension is created if the Schedule has
8451
+ * none for the service yet.
8452
+ *
8453
+ * Untyped by design, taking any sub-extension of the shape the parameter calls for, for example
8454
+ * `{ url: 'bufferBefore', valueDuration: { value: 10, unit: 'min' } }`. A parameter whose value is a nested
8455
+ * structure rather than a single `value[x]` is worth a typed wrapper over this; `availability` has one in
8456
+ * `@medplum/react-scheduling`. Pairs with `clearScheduleParameter` and `getScheduleParameters`.
8457
+ * @param schedule - Schedule to update
8458
+ * @param service - HealthcareService referenced by the parameters
8459
+ * @param subextension - SchedulingParameters sub-extension to set
8460
+ * @returns A cloned Schedule containing the parameter
8461
+ */
8462
+ export declare function setScheduleParameter(schedule: Schedule, service: WithId<HealthcareService>, subextension: Extension): Schedule;
8463
+
8325
8464
  export declare function singleton(collection: TypedValue[], type?: string): TypedValue | undefined;
8326
8465
 
8327
8466
  export declare function singularize<T>(value: T | T[] | undefined): T | undefined;
@@ -8630,6 +8769,8 @@ export declare class ParserBuilder {
8630
8769
  [index: string]: any;
8631
8770
  }): string[];
8632
8771
 
8772
+ export declare function sumBy<T>(items: Iterable<T>, fn: (value: T) => number): number;
8773
+
8633
8774
  /**
8634
8775
  * Summarizes a group of Observations into a single computed summary value, with the individual values
8635
8776
  * preserved in `Observation.component.valueSampledData`.
@@ -16,6 +16,7 @@ import type { CustomTableLayout } from 'pdfmake/interfaces';
16
16
  import type { Device } from '@medplum/fhirtypes';
17
17
  import type { DiagnosticReport } from '@medplum/fhirtypes';
18
18
  import type { DocumentReference } from '@medplum/fhirtypes';
19
+ import type { Duration } from '@medplum/fhirtypes';
19
20
  import type { ElementDefinition } from '@medplum/fhirtypes';
20
21
  import type { ElementDefinitionBinding } from '@medplum/fhirtypes';
21
22
  import type { Encounter } from '@medplum/fhirtypes';
@@ -831,6 +832,17 @@ export declare function checkIfValidMedplumVersion(appName: string, version: str
831
832
  */
832
833
  export declare function clearReleaseCache(): void;
833
834
 
835
+ /**
836
+ * Immutably clears one scheduling parameter a Schedule sets for a HealthcareService, dropping that
837
+ * calendar back to the service-level parameter of the same name. Pairs with `setScheduleParameter`
838
+ * and `getScheduleParameters`.
839
+ * @param schedule - Schedule to update
840
+ * @param service - HealthcareService referenced by the parameters
841
+ * @param url - Url of the SchedulingParameters sub-extension to remove, for example `availability`
842
+ * @returns A cloned Schedule without the matching parameter
843
+ */
844
+ export declare function clearScheduleParameter(schedule: Schedule, service: WithId<HealthcareService>, url: string): Schedule;
845
+
834
846
  /**
835
847
  * Log level for MedplumClient requests and responses.
836
848
  * - 'none': No logging
@@ -925,14 +937,19 @@ export declare function conceptMapTranslate(map: ConceptMap, params: ConceptMapT
925
937
  export declare interface ConceptMapTranslateMatch {
926
938
  equivalence?: string;
927
939
  concept?: Coding;
928
- property?: ConceptMapTranslateMatchAttribute[];
940
+ property?: ConceptMapTranslateMatchProperty[];
929
941
  dependsOn?: ConceptMapTranslateMatchAttribute[];
930
942
  product?: ConceptMapTranslateMatchAttribute[];
931
943
  source?: string;
932
944
  }
933
945
 
934
946
  export declare interface ConceptMapTranslateMatchAttribute {
935
- key: string;
947
+ attribute: string;
948
+ value: TypedValue;
949
+ }
950
+
951
+ export declare interface ConceptMapTranslateMatchProperty {
952
+ uri: string;
936
953
  value: TypedValue;
937
954
  }
938
955
 
@@ -1060,6 +1077,17 @@ export declare interface CopyOperation {
1060
1077
  path: string;
1061
1078
  }
1062
1079
 
1080
+ /**
1081
+ * Counts iterable elements by a key function, returning a sparse map of key to count.
1082
+ * Matches Lodash `countBy` semantics (no zero-fill for missing keys).
1083
+ * @param items - The items to count.
1084
+ * @param keyFn - The function to extract the key from each item.
1085
+ * @returns A map of key to count for keys that appear at least once.
1086
+ */
1087
+ export declare function countBy<T, K extends keyof any>(items: Iterable<T>, keyFn: (value: T) => K): Partial<Record<K, number>>;
1088
+
1089
+ export declare function countWhere<T>(items: Iterable<T>, fn: (value: T) => boolean): number;
1090
+
1063
1091
  export declare const CPT = "http://www.ama-assn.org/go/cpt";
1064
1092
 
1065
1093
  export declare interface CrawlerOptions {
@@ -1632,6 +1660,15 @@ export declare interface ExtendedInternalSchemaElement extends InternalSchemaEle
1632
1660
  readonly?: boolean;
1633
1661
  }
1634
1662
 
1663
+ /**
1664
+ * Anything that can carry FHIR extensions: resources such as `Patient`, data types such as
1665
+ * `CodeableConcept`, and extensions themselves. Structural, so any of those is accepted, while a
1666
+ * type that cannot hold extensions, `Binary` being the notable example, is rejected.
1667
+ */
1668
+ export declare interface Extensible {
1669
+ extension?: Extension[];
1670
+ }
1671
+
1635
1672
  export declare type ExternalSecret<T extends ExternalSecretPrimitive = ExternalSecretPrimitive> = {
1636
1673
  system: ExternalSecretSystem;
1637
1674
  key: string;
@@ -1852,7 +1889,11 @@ export declare type FhircastConnectEvent = {
1852
1889
  * 2. `message` - Contains a `payload` field containing a `FHIRcast` message payload exactly as it comes in over WebSockets.
1853
1890
  * 3. `disconnect` - An event to signal when a WebSocket connection has been closed. Fired as soon as a WebSocket emits `close`.
1854
1891
  *
1855
- * To close the connection, call `connection.disconnect()` and listen to the `disconnect` event to know when the connection has been disconnected.
1892
+ * The underlying socket reconnects on its own, so `disconnect` followed by `connect` is the normal
1893
+ * shape of a dropped connection rather than the end of the session. A subscription endpoint stays
1894
+ * valid for the lease the Hub granted it, so reconnecting resubscribes without a new `hub.subscribe`
1895
+ * request. Two things end a connection for good: calling `connection.disconnect()`, and the Hub
1896
+ * denying the subscription — after either, `connect` will not fire again.
1856
1897
  */
1857
1898
  export declare class FhircastConnection extends TypedEventTarget<FhircastSubscriptionEventMap> {
1858
1899
  readonly subRequest: SubscriptionRequest;
@@ -1860,11 +1901,17 @@ export declare class FhircastConnection extends TypedEventTarget<FhircastSubscri
1860
1901
  /**
1861
1902
  * Creates a new `FhircastConnection`.
1862
1903
  * @param subRequest - The subscription request to initialize the connection from.
1904
+ * @param options - Options for the underlying `ReconnectingWebSocket`.
1863
1905
  */
1864
- constructor(subRequest: SubscriptionRequest);
1906
+ constructor(subRequest: SubscriptionRequest, options?: FhircastConnectionOptions);
1865
1907
  disconnect(): void;
1866
1908
  }
1867
1909
 
1910
+ export declare type FhircastConnectionOptions = Options & {
1911
+ /** An alternate `ReconnectingWebSocket` implementation to open the connection with. */
1912
+ ReconnectingWebSocket?: IReconnectingWebSocketCtor;
1913
+ };
1914
+
1868
1915
  export declare type FhircastContextResourceType<EventName extends FhircastEventName, K extends FhircastEventKeys<EventName>> = (typeof FHIRCAST_EVENT_RESOURCES)[EventName][K] extends {
1869
1916
  resourceType: infer R;
1870
1917
  } ? R : never;
@@ -2466,6 +2513,18 @@ export declare function getExpressionsForResourceType(resourceType: string, expr
2466
2513
  */
2467
2514
  export declare function getExtension(resource: any, ...urls: string[]): Extension | undefined;
2468
2515
 
2516
+ /**
2517
+ * Returns every extension reachable by the given extension URLs.
2518
+ *
2519
+ * Like `getExtension`, but does not stop at the first match: extensions that repeat under one URL are
2520
+ * all returned, at every level. Use it for extensions defined with a cardinality above one, where
2521
+ * `getExtension` would silently read only the first.
2522
+ * @param extensible - The base resource, data type, or extension. Anything that may hold an `extension` array.
2523
+ * @param urlOrUrls - One extension URL, or an array of them where each entry represents descending a level in a nested extension.
2524
+ * @returns Every matching extension, in document order. Empty if none match or no URL is given.
2525
+ */
2526
+ export declare function getExtensions(extensible: Extensible | undefined, urlOrUrls: string | string[]): Extension[];
2527
+
2469
2528
  /**
2470
2529
  * Returns an extension value by extension URLs.
2471
2530
  * @param resource - The base resource.
@@ -2608,6 +2667,30 @@ export declare function getReferenceString(input: Reference | Resource): string
2608
2667
  */
2609
2668
  export declare function getResourceTypes(): ResourceType[];
2610
2669
 
2670
+ /**
2671
+ * Reads one scheduling parameter a Schedule sets for a HealthcareService, taking precedence over the
2672
+ * service-level parameter of the same name. Pairs with `setScheduleParameter` and `clearScheduleParameter`.
2673
+ *
2674
+ * The result is a list rather than a single extension because a Schedule may carry more than one
2675
+ * SchedulingParameters extension matching the service, and because a parameter may legitimately repeat.
2676
+ * @param schedule - Schedule to inspect
2677
+ * @param service - HealthcareService referenced by the parameters
2678
+ * @param url - Url of the SchedulingParameters sub-extension to read, for example `availability`
2679
+ * @returns Every matching sub-extension, in document order
2680
+ */
2681
+ export declare function getScheduleParameters(schedule: Schedule, service: WithId<HealthcareService>, url: string): Extension[];
2682
+
2683
+ /**
2684
+ * Resolves the timezone used by scheduling in server priority order: the Schedule's parameters for the
2685
+ * service, then the service's own parameters, then the actor's standard FHIR timezone extension.
2686
+ * @param service - HealthcareService whose parameters may define a timezone
2687
+ * @param schedule - Schedule whose parameters may define a timezone. Omit to resolve the service's own timezone,
2688
+ * as when the service default hours are being read on their own rather than through a particular calendar.
2689
+ * @param actor - Optional Schedule actor used as a timezone fallback
2690
+ * @returns The resolved IANA timezone identifier, if present
2691
+ */
2692
+ export declare function getSchedulingTimezone(service: WithId<HealthcareService>, schedule?: Schedule, actor?: Resource): string | undefined;
2693
+
2611
2694
  /**
2612
2695
  * Returns a search parameter for a resource type by search code.
2613
2696
  * @param resourceType - The FHIR resource type.
@@ -2720,6 +2803,9 @@ export declare interface GoogleLoginRequest extends BaseLoginRequest {
2720
2803
 
2721
2804
  /**
2722
2805
  * Returns whether a Schedule or HealthcareService has a SchedulingParameters extension.
2806
+ *
2807
+ * Unscoped: on a Schedule, where the extension repeats once per service, this reports that some
2808
+ * service is configured rather than any particular one. Ask `getScheduleParameters` about a service.
2723
2809
  * @param resource - Schedule or HealthcareService to inspect
2724
2810
  * @returns True if the resource has a SchedulingParameters extension
2725
2811
  */
@@ -3668,7 +3754,7 @@ export declare function isStringArray(arr: any[]): arr is string[];
3668
3754
 
3669
3755
  export declare type IssueSeverity = 'error' | 'fatal' | 'warning' | 'information';
3670
3756
 
3671
- export declare type IssueType = 'structure' | 'invariant' | 'processing';
3757
+ export declare type IssueType = 'structure' | 'invariant' | 'processing' | 'required';
3672
3758
 
3673
3759
  /**
3674
3760
  * Returns true if the input value is an object with a string text property.
@@ -4223,6 +4309,25 @@ export declare interface MedicationOrderDrugInput {
4223
4309
  readonly ndc?: string;
4224
4310
  readonly rxNorm?: string;
4225
4311
  readonly routedMedId?: number;
4312
+ /**
4313
+ * Vendor formulation key, paired with {@link routedMedId} to order a drug that
4314
+ * has no dose-level product to resolve an NDC from — OTC / topical /
4315
+ * wide-multi-strength generics for which the vendor's dose-format lookup
4316
+ * returns nothing. Supply {@link drugName} alongside it, since there is no
4317
+ * catalog row to derive a name from.
4318
+ */
4319
+ readonly gcnSeqno?: number;
4320
+ /** Drug name, required for a {@link gcnSeqno}-keyed line (no catalog row to name it). */
4321
+ readonly drugName?: string;
4322
+ /**
4323
+ * Dose text for a {@link gcnSeqno}-keyed line, e.g. `"solution"`.
4324
+ *
4325
+ * Optional, and only worth sending when the caller holds dose text *separate*
4326
+ * from {@link drugName} — a hand-entered form, say. Passing a full product
4327
+ * label duplicates it in the description the vendor renders. When omitted, the
4328
+ * vendor derives the dose from the formulation key or falls back to the sig.
4329
+ */
4330
+ readonly line1?: string;
4226
4331
  readonly quantity: number;
4227
4332
  readonly quantityQualifier?: string;
4228
4333
  readonly refill?: number;
@@ -4378,6 +4483,13 @@ export declare interface MedicationSearchParams {
4378
4483
  readonly ndc?: string;
4379
4484
  readonly rxNorm?: string;
4380
4485
  readonly routedMedId?: number;
4486
+ /**
4487
+ * Vendor formulation keys under {@link routedMedId}, from the name-search hit.
4488
+ * Only used when the drug has no dose-level products: each key is resolved to
4489
+ * its marketed strength so the caller still gets selectable formulations
4490
+ * instead of an empty result. Ignored otherwise.
4491
+ */
4492
+ readonly gcnSeqnos?: number[];
4381
4493
  readonly searchOtc?: boolean;
4382
4494
  readonly searchSupply?: boolean;
4383
4495
  readonly searchBrand?: boolean;
@@ -6068,9 +6180,10 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
6068
6180
  *
6069
6181
  * @category FHIRcast
6070
6182
  * @param subRequest - The `SubscriptionRequest` to use for connecting.
6183
+ * @param options - Options for the underlying `ReconnectingWebSocket`.
6071
6184
  * @returns A `FhircastConnection` which emits lifecycle events for the `FHIRcast` WebSocket connection.
6072
6185
  */
6073
- fhircastConnect(subRequest: SubscriptionRequest): FhircastConnection;
6186
+ fhircastConnect(subRequest: SubscriptionRequest, options?: FhircastConnectionOptions): FhircastConnection;
6074
6187
  /**
6075
6188
  * Publishes a new context to a given topic for a specified event type.
6076
6189
  *
@@ -8165,6 +8278,15 @@ export declare class ParserBuilder {
8165
8278
  */
8166
8279
  export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
8167
8280
 
8281
+ /**
8282
+ * Converts a SchedulingParameters duration to minutes.
8283
+ *
8284
+ * @param duration - The duration to convert.
8285
+ * @returns The length in minutes, or undefined when the duration has no value, a
8286
+ * negative value, or a unit scheduling does not accept.
8287
+ */
8288
+ export declare function schedulingDurationToMinutes(duration: Duration | undefined): number | undefined;
8289
+
8168
8290
  export declare const SchedulingEncounterCodingURI = "https://medplum.com/fhir/StructureDefinition/SchedulingEncounterCoding";
8169
8291
 
8170
8292
  export declare const SchedulingParametersURI = "https://medplum.com/fhir/StructureDefinition/SchedulingParameters";
@@ -8322,6 +8444,23 @@ export declare class ParserBuilder {
8322
8444
  use?: Identifier['use'];
8323
8445
  }
8324
8446
 
8447
+ /**
8448
+ * Immutably sets one scheduling parameter on a Schedule for a HealthcareService, so that calendar keeps
8449
+ * it in place of the service-level parameter of the same name. Whatever the Schedule already holds at the
8450
+ * sub-extension's url is replaced, and the SchedulingParameters extension is created if the Schedule has
8451
+ * none for the service yet.
8452
+ *
8453
+ * Untyped by design, taking any sub-extension of the shape the parameter calls for, for example
8454
+ * `{ url: 'bufferBefore', valueDuration: { value: 10, unit: 'min' } }`. A parameter whose value is a nested
8455
+ * structure rather than a single `value[x]` is worth a typed wrapper over this; `availability` has one in
8456
+ * `@medplum/react-scheduling`. Pairs with `clearScheduleParameter` and `getScheduleParameters`.
8457
+ * @param schedule - Schedule to update
8458
+ * @param service - HealthcareService referenced by the parameters
8459
+ * @param subextension - SchedulingParameters sub-extension to set
8460
+ * @returns A cloned Schedule containing the parameter
8461
+ */
8462
+ export declare function setScheduleParameter(schedule: Schedule, service: WithId<HealthcareService>, subextension: Extension): Schedule;
8463
+
8325
8464
  export declare function singleton(collection: TypedValue[], type?: string): TypedValue | undefined;
8326
8465
 
8327
8466
  export declare function singularize<T>(value: T | T[] | undefined): T | undefined;
@@ -8630,6 +8769,8 @@ export declare class ParserBuilder {
8630
8769
  [index: string]: any;
8631
8770
  }): string[];
8632
8771
 
8772
+ export declare function sumBy<T>(items: Iterable<T>, fn: (value: T) => number): number;
8773
+
8633
8774
  /**
8634
8775
  * Summarizes a group of Observations into a single computed summary value, with the individual values
8635
8776
  * preserved in `Observation.component.valueSampledData`.