@medplum/core 5.1.30 → 5.1.32

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.
@@ -2545,6 +2545,25 @@ export declare function getExtensionValue(resource: any, ...urls: string[]): Ext
2545
2545
  */
2546
2546
  export declare function getIdentifier(resource: Resource, system: string): string | undefined;
2547
2547
 
2548
+ /**
2549
+ * Returns the resource identifier for the given identifier type.
2550
+ *
2551
+ * Whereas {@link getIdentifier} matches on `Identifier.system`, i.e. who assigned the identifier,
2552
+ * this matches on `Identifier.type`, i.e. what kind of identifier it is. For example,
2553
+ * {@link MRN_IDENTIFIER_TYPE} finds the medical record number no matter which organization issued it.
2554
+ *
2555
+ * Both the system and the code of the type coding must match. Matching on code alone would be
2556
+ * ambiguous, because the same code means different things in different code systems.
2557
+ *
2558
+ * If multiple identifiers exist with the same type, the first one is returned.
2559
+ *
2560
+ * If the type is not found, then returns undefined.
2561
+ * @param resource - The resource to check.
2562
+ * @param type - The identifier type coding, such as {@link MRN_IDENTIFIER_TYPE}.
2563
+ * @returns The identifier value if found; otherwise undefined.
2564
+ */
2565
+ export declare function getIdentifierByType(resource: Resource, type: Coding): string | undefined;
2566
+
2548
2567
  /**
2549
2568
  * Returns an image URL for the resource, if one is available.
2550
2569
  * @param resource - The input resource.
@@ -2649,6 +2668,13 @@ export declare function getQuestionnaireAnswers(response: QuestionnaireResponse)
2649
2668
  */
2650
2669
  export declare function getRandomString(): string;
2651
2670
 
2671
+ /**
2672
+ * Returns the number of milliseconds until a rate limit resets.
2673
+ * @param outcome - The rate limit outcome.
2674
+ * @returns Milliseconds until reset, or undefined if not present.
2675
+ */
2676
+ export declare function getRateLimitReset(outcome: OperationOutcome): number | undefined;
2677
+
2652
2678
  /**
2653
2679
  * Returns a reference string for a resource.
2654
2680
  * @param input - The FHIR resource or reference.
@@ -2811,6 +2837,8 @@ export declare interface GoogleLoginRequest extends BaseLoginRequest {
2811
2837
  */
2812
2838
  export declare function hasSchedulingParameters(resource: Schedule | HealthcareService): boolean;
2813
2839
 
2840
+ export declare const HL7_V2_0203 = "http://terminology.hl7.org/CodeSystem/v2-0203";
2841
+
2814
2842
  export declare interface Hl7AckOptions {
2815
2843
  ackCode: AckCode;
2816
2844
  errSegment?: Hl7Segment;
@@ -4310,20 +4338,20 @@ export declare interface MedicationOrderDrugInput {
4310
4338
  readonly rxNorm?: string;
4311
4339
  readonly routedMedId?: number;
4312
4340
  /**
4313
- * Vendor formulation key, paired with {@link routedMedId} to order a drug that
4341
+ * Vendor formulation key, paired with {@link MedicationOrderDrugInput.routedMedId} to order a drug that
4314
4342
  * has no dose-level product to resolve an NDC from — OTC / topical /
4315
4343
  * wide-multi-strength generics for which the vendor's dose-format lookup
4316
- * returns nothing. Supply {@link drugName} alongside it, since there is no
4344
+ * returns nothing. Supply {@link MedicationOrderDrugInput.drugName} alongside it, since there is no
4317
4345
  * catalog row to derive a name from.
4318
4346
  */
4319
4347
  readonly gcnSeqno?: number;
4320
- /** Drug name, required for a {@link gcnSeqno}-keyed line (no catalog row to name it). */
4348
+ /** Drug name, required for a {@link MedicationOrderDrugInput.gcnSeqno}-keyed line (no catalog row to name it). */
4321
4349
  readonly drugName?: string;
4322
4350
  /**
4323
- * Dose text for a {@link gcnSeqno}-keyed line, e.g. `"solution"`.
4351
+ * Dose text for a {@link MedicationOrderDrugInput.gcnSeqno}-keyed line, e.g. `"solution"`.
4324
4352
  *
4325
4353
  * 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
4354
+ * from {@link MedicationOrderDrugInput.drugName} — a hand-entered form, say. Passing a full product
4327
4355
  * label duplicates it in the description the vendor renders. When omitted, the
4328
4356
  * vendor derives the dose from the formulation key or falls back to the sig.
4329
4357
  */
@@ -4484,7 +4512,7 @@ export declare interface MedicationSearchParams {
4484
4512
  readonly rxNorm?: string;
4485
4513
  readonly routedMedId?: number;
4486
4514
  /**
4487
- * Vendor formulation keys under {@link routedMedId}, from the name-search hit.
4515
+ * Vendor formulation keys under {@link MedicationSearchParams.routedMedId}, from the name-search hit.
4488
4516
  * Only used when the drug has no dose-level products: each key is resolved to
4489
4517
  * its marketed strength so the caller still gets selectable formulations
4490
4518
  * instead of an empty result. Ignored otherwise.
@@ -5943,6 +5971,12 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
5943
5971
  * Adds default options to the fetch options.
5944
5972
  * @param options - The options to add defaults to.
5945
5973
  */
5974
+ /**
5975
+ * Determines if a URL is internal and should receive authentication credentials.
5976
+ * @param url - The URL to check
5977
+ * @returns True if the URL should receive credentials
5978
+ */
5979
+ private isInternalUrl;
5946
5980
  private addFetchOptionsDefaults;
5947
5981
  /**
5948
5982
  * Sets the "Content-Type" header on fetch options.
@@ -7084,6 +7118,9 @@ export declare interface MoveOperation {
7084
7118
  path: string;
7085
7119
  }
7086
7120
 
7121
+ /** The HL7 v2 Table 0203 coding for a medical record number. */
7122
+ export declare const MRN_IDENTIFIER_TYPE: Coding;
7123
+
7087
7124
  export declare const multipleMatches: OperationOutcome;
7088
7125
 
7089
7126
  export declare const NDC = "http://hl7.org/fhir/sid/ndc";
@@ -7894,6 +7931,8 @@ export declare class ParserBuilder {
7894
7931
  */
7895
7932
  export declare type QueryTypes = URLSearchParams | string[][] | Record<string, string | number | boolean | undefined> | string | undefined;
7896
7933
 
7934
+ export declare const RATE_LIMIT_RESET_EXTENSION_URL = "https://medplum.com/fhir/StructureDefinition/rate-limit-reset";
7935
+
7897
7936
  export declare type RateLimitInfo = {
7898
7937
  /** Name of the rate limiter. */
7899
7938
  name: string;
@@ -8240,8 +8279,9 @@ export declare class ParserBuilder {
8240
8279
  * Conditional methods (`createResourceIfNoneExist`, `upsertResource`) emit
8241
8280
  * even when the server made no change, except on HTTP 304 "Not Modified".
8242
8281
  *
8243
- * @template T - The type of the modified resource. Defaults to `Resource`; narrow it (e.g. via
8244
- * `useResourceModified('Slot', ...)`) to get a typed `resource` payload without extra guards.
8282
+ * The generic type parameter `T` specifies the type of the modified resource.
8283
+ * It defaults to `Resource`; narrow it (e.g. via `useResourceModified('Slot', ...)`)
8284
+ * to get a typed `resource` payload without extra guards.
8245
8285
  */
8246
8286
  export declare interface ResourceModifiedEvent<T extends Resource = Resource> {
8247
8287
  /** The type of the modified resource. */
@@ -8293,6 +8333,8 @@ export declare class ParserBuilder {
8293
8333
 
8294
8334
  export declare const SchedulingPlanDefinitionURI = "https://medplum.com/fhir/StructureDefinition/SchedulingPlanDefinition";
8295
8335
 
8336
+ export declare const SchedulingScheduleColorURI = "https://medplum.com/fhir/StructureDefinition/SchedulingColor";
8337
+
8296
8338
  export declare interface SearchableToken {
8297
8339
  readonly system: string | undefined;
8298
8340
  readonly value: string | undefined;
@@ -8444,6 +8486,13 @@ export declare class ParserBuilder {
8444
8486
  use?: Identifier['use'];
8445
8487
  }
8446
8488
 
8489
+ /**
8490
+ * Adds the rate limit reset delay to an OperationOutcome.
8491
+ * @param outcome - The rate limit outcome.
8492
+ * @param msBeforeNext - Milliseconds until the rate limit resets.
8493
+ */
8494
+ export declare function setRateLimitReset(outcome: OperationOutcome, msBeforeNext: number): void;
8495
+
8447
8496
  /**
8448
8497
  * Immutably sets one scheduling parameter on a Schedule for a HealthcareService, so that calendar keeps
8449
8498
  * it in place of the service-level parameter of the same name. Whatever the Schedule already holds at the
@@ -2545,6 +2545,25 @@ export declare function getExtensionValue(resource: any, ...urls: string[]): Ext
2545
2545
  */
2546
2546
  export declare function getIdentifier(resource: Resource, system: string): string | undefined;
2547
2547
 
2548
+ /**
2549
+ * Returns the resource identifier for the given identifier type.
2550
+ *
2551
+ * Whereas {@link getIdentifier} matches on `Identifier.system`, i.e. who assigned the identifier,
2552
+ * this matches on `Identifier.type`, i.e. what kind of identifier it is. For example,
2553
+ * {@link MRN_IDENTIFIER_TYPE} finds the medical record number no matter which organization issued it.
2554
+ *
2555
+ * Both the system and the code of the type coding must match. Matching on code alone would be
2556
+ * ambiguous, because the same code means different things in different code systems.
2557
+ *
2558
+ * If multiple identifiers exist with the same type, the first one is returned.
2559
+ *
2560
+ * If the type is not found, then returns undefined.
2561
+ * @param resource - The resource to check.
2562
+ * @param type - The identifier type coding, such as {@link MRN_IDENTIFIER_TYPE}.
2563
+ * @returns The identifier value if found; otherwise undefined.
2564
+ */
2565
+ export declare function getIdentifierByType(resource: Resource, type: Coding): string | undefined;
2566
+
2548
2567
  /**
2549
2568
  * Returns an image URL for the resource, if one is available.
2550
2569
  * @param resource - The input resource.
@@ -2649,6 +2668,13 @@ export declare function getQuestionnaireAnswers(response: QuestionnaireResponse)
2649
2668
  */
2650
2669
  export declare function getRandomString(): string;
2651
2670
 
2671
+ /**
2672
+ * Returns the number of milliseconds until a rate limit resets.
2673
+ * @param outcome - The rate limit outcome.
2674
+ * @returns Milliseconds until reset, or undefined if not present.
2675
+ */
2676
+ export declare function getRateLimitReset(outcome: OperationOutcome): number | undefined;
2677
+
2652
2678
  /**
2653
2679
  * Returns a reference string for a resource.
2654
2680
  * @param input - The FHIR resource or reference.
@@ -2811,6 +2837,8 @@ export declare interface GoogleLoginRequest extends BaseLoginRequest {
2811
2837
  */
2812
2838
  export declare function hasSchedulingParameters(resource: Schedule | HealthcareService): boolean;
2813
2839
 
2840
+ export declare const HL7_V2_0203 = "http://terminology.hl7.org/CodeSystem/v2-0203";
2841
+
2814
2842
  export declare interface Hl7AckOptions {
2815
2843
  ackCode: AckCode;
2816
2844
  errSegment?: Hl7Segment;
@@ -4310,20 +4338,20 @@ export declare interface MedicationOrderDrugInput {
4310
4338
  readonly rxNorm?: string;
4311
4339
  readonly routedMedId?: number;
4312
4340
  /**
4313
- * Vendor formulation key, paired with {@link routedMedId} to order a drug that
4341
+ * Vendor formulation key, paired with {@link MedicationOrderDrugInput.routedMedId} to order a drug that
4314
4342
  * has no dose-level product to resolve an NDC from — OTC / topical /
4315
4343
  * wide-multi-strength generics for which the vendor's dose-format lookup
4316
- * returns nothing. Supply {@link drugName} alongside it, since there is no
4344
+ * returns nothing. Supply {@link MedicationOrderDrugInput.drugName} alongside it, since there is no
4317
4345
  * catalog row to derive a name from.
4318
4346
  */
4319
4347
  readonly gcnSeqno?: number;
4320
- /** Drug name, required for a {@link gcnSeqno}-keyed line (no catalog row to name it). */
4348
+ /** Drug name, required for a {@link MedicationOrderDrugInput.gcnSeqno}-keyed line (no catalog row to name it). */
4321
4349
  readonly drugName?: string;
4322
4350
  /**
4323
- * Dose text for a {@link gcnSeqno}-keyed line, e.g. `"solution"`.
4351
+ * Dose text for a {@link MedicationOrderDrugInput.gcnSeqno}-keyed line, e.g. `"solution"`.
4324
4352
  *
4325
4353
  * 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
4354
+ * from {@link MedicationOrderDrugInput.drugName} — a hand-entered form, say. Passing a full product
4327
4355
  * label duplicates it in the description the vendor renders. When omitted, the
4328
4356
  * vendor derives the dose from the formulation key or falls back to the sig.
4329
4357
  */
@@ -4484,7 +4512,7 @@ export declare interface MedicationSearchParams {
4484
4512
  readonly rxNorm?: string;
4485
4513
  readonly routedMedId?: number;
4486
4514
  /**
4487
- * Vendor formulation keys under {@link routedMedId}, from the name-search hit.
4515
+ * Vendor formulation keys under {@link MedicationSearchParams.routedMedId}, from the name-search hit.
4488
4516
  * Only used when the drug has no dose-level products: each key is resolved to
4489
4517
  * its marketed strength so the caller still gets selectable formulations
4490
4518
  * instead of an empty result. Ignored otherwise.
@@ -5943,6 +5971,12 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
5943
5971
  * Adds default options to the fetch options.
5944
5972
  * @param options - The options to add defaults to.
5945
5973
  */
5974
+ /**
5975
+ * Determines if a URL is internal and should receive authentication credentials.
5976
+ * @param url - The URL to check
5977
+ * @returns True if the URL should receive credentials
5978
+ */
5979
+ private isInternalUrl;
5946
5980
  private addFetchOptionsDefaults;
5947
5981
  /**
5948
5982
  * Sets the "Content-Type" header on fetch options.
@@ -7084,6 +7118,9 @@ export declare interface MoveOperation {
7084
7118
  path: string;
7085
7119
  }
7086
7120
 
7121
+ /** The HL7 v2 Table 0203 coding for a medical record number. */
7122
+ export declare const MRN_IDENTIFIER_TYPE: Coding;
7123
+
7087
7124
  export declare const multipleMatches: OperationOutcome;
7088
7125
 
7089
7126
  export declare const NDC = "http://hl7.org/fhir/sid/ndc";
@@ -7894,6 +7931,8 @@ export declare class ParserBuilder {
7894
7931
  */
7895
7932
  export declare type QueryTypes = URLSearchParams | string[][] | Record<string, string | number | boolean | undefined> | string | undefined;
7896
7933
 
7934
+ export declare const RATE_LIMIT_RESET_EXTENSION_URL = "https://medplum.com/fhir/StructureDefinition/rate-limit-reset";
7935
+
7897
7936
  export declare type RateLimitInfo = {
7898
7937
  /** Name of the rate limiter. */
7899
7938
  name: string;
@@ -8240,8 +8279,9 @@ export declare class ParserBuilder {
8240
8279
  * Conditional methods (`createResourceIfNoneExist`, `upsertResource`) emit
8241
8280
  * even when the server made no change, except on HTTP 304 "Not Modified".
8242
8281
  *
8243
- * @template T - The type of the modified resource. Defaults to `Resource`; narrow it (e.g. via
8244
- * `useResourceModified('Slot', ...)`) to get a typed `resource` payload without extra guards.
8282
+ * The generic type parameter `T` specifies the type of the modified resource.
8283
+ * It defaults to `Resource`; narrow it (e.g. via `useResourceModified('Slot', ...)`)
8284
+ * to get a typed `resource` payload without extra guards.
8245
8285
  */
8246
8286
  export declare interface ResourceModifiedEvent<T extends Resource = Resource> {
8247
8287
  /** The type of the modified resource. */
@@ -8293,6 +8333,8 @@ export declare class ParserBuilder {
8293
8333
 
8294
8334
  export declare const SchedulingPlanDefinitionURI = "https://medplum.com/fhir/StructureDefinition/SchedulingPlanDefinition";
8295
8335
 
8336
+ export declare const SchedulingScheduleColorURI = "https://medplum.com/fhir/StructureDefinition/SchedulingColor";
8337
+
8296
8338
  export declare interface SearchableToken {
8297
8339
  readonly system: string | undefined;
8298
8340
  readonly value: string | undefined;
@@ -8444,6 +8486,13 @@ export declare class ParserBuilder {
8444
8486
  use?: Identifier['use'];
8445
8487
  }
8446
8488
 
8489
+ /**
8490
+ * Adds the rate limit reset delay to an OperationOutcome.
8491
+ * @param outcome - The rate limit outcome.
8492
+ * @param msBeforeNext - Milliseconds until the rate limit resets.
8493
+ */
8494
+ export declare function setRateLimitReset(outcome: OperationOutcome, msBeforeNext: number): void;
8495
+
8447
8496
  /**
8448
8497
  * Immutably sets one scheduling parameter on a Schedule for a HealthcareService, so that calendar keeps
8449
8498
  * it in place of the service-level parameter of the same name. Whatever the Schedule already holds at the