@medplum/core 5.1.27 → 5.1.28

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.
@@ -22,6 +22,7 @@ import type { Encounter } from '@medplum/fhirtypes';
22
22
  import type { Extension } from '@medplum/fhirtypes';
23
23
  import type { ExtensionValue } from '@medplum/fhirtypes';
24
24
  import type { ExtractResource } from '@medplum/fhirtypes';
25
+ import type { HealthcareService } from '@medplum/fhirtypes';
25
26
  import type { HumanName } from '@medplum/fhirtypes';
26
27
  import type { Identifier } from '@medplum/fhirtypes';
27
28
  import type { ImagingStudy } from '@medplum/fhirtypes';
@@ -56,6 +57,7 @@ import type { RelatedPerson } from '@medplum/fhirtypes';
56
57
  import type { Resource } from '@medplum/fhirtypes';
57
58
  import type { ResourceType } from '@medplum/fhirtypes';
58
59
  import type { SampledData } from '@medplum/fhirtypes';
60
+ import type { Schedule } from '@medplum/fhirtypes';
59
61
  import type { SearchParameter } from '@medplum/fhirtypes';
60
62
  import type { StructureDefinition } from '@medplum/fhirtypes';
61
63
  import type { StructureMap } from '@medplum/fhirtypes';
@@ -431,6 +433,24 @@ export { assert_2 as assert }
431
433
 
432
434
  export declare function assertContextVersionOptional(event: string): asserts event is FhircastEventVersionOptional;
433
435
 
436
+ /**
437
+ * Checks that a value has type `never`. Useful for ensuring exhaustive
438
+ * matches.
439
+ *
440
+ * @example
441
+ * ```typescript
442
+ * type MyUnion = 'a' | 'b' | 'c'
443
+ * function f(arg: MyUnion) {
444
+ * if (arg === 'a') { return 1; }
445
+ * if (arg === 'b') { return 2; }
446
+ * assertNever(arg); // Type error: 'c' is unhandled
447
+ * }
448
+ * ```
449
+ *
450
+ * @param value - The value that should never be present
451
+ */
452
+ export declare function assertNever(value: never): never;
453
+
434
454
  /**
435
455
  * Asserts that the operation completed successfully and that the resource is defined.
436
456
  * @param outcome - The operation outcome.
@@ -954,6 +974,7 @@ export declare function contentTooLarge(text: string): OperationOutcome;
954
974
  export declare const ContentType: {
955
975
  readonly CSS: "text/css";
956
976
  readonly DICOM: "application/dicom";
977
+ readonly DICOM_JSON: "application/dicom+json";
957
978
  readonly EVENT_STREAM: "text/event-stream";
958
979
  readonly FAVICON: "image/vnd.microsoft.icon";
959
980
  readonly FHIR_JSON: "application/fhir+json";
@@ -1254,6 +1275,10 @@ export declare type DataTypesMap = {
1254
1275
  [type: string]: InternalTypeSchema;
1255
1276
  };
1256
1277
 
1278
+ export declare type DayOfWeek = (typeof DAYS_OF_WEEK)[number];
1279
+
1280
+ export declare const DAYS_OF_WEEK: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
1281
+
1257
1282
  /**
1258
1283
  * Decodes a base64 string.
1259
1284
  * Handles both browser and Node environments.
@@ -1630,6 +1655,13 @@ export declare const ExternalSecretSystems: {
1630
1655
  */
1631
1656
  export declare function extractAccountReferences(meta: Meta | undefined): Reference[] | undefined;
1632
1657
 
1658
+ /**
1659
+ * Extracts HealthcareService references from serviceType concepts.
1660
+ * @param serviceType - CodeableConcept values to inspect
1661
+ * @returns HealthcareService references embedded in the concepts
1662
+ */
1663
+ export declare function extractServiceTypeReferences(serviceType: CodeableConcept[] | undefined): Reference<HealthcareService>[];
1664
+
1633
1665
  /**
1634
1666
  * Fetches the version strings for all published Medplum releases.
1635
1667
  * @param appName - The name of the app to fetch the release list for.
@@ -2686,6 +2718,13 @@ export declare interface GoogleLoginRequest extends BaseLoginRequest {
2686
2718
  readonly createUser?: boolean;
2687
2719
  }
2688
2720
 
2721
+ /**
2722
+ * Returns whether a Schedule or HealthcareService has a SchedulingParameters extension.
2723
+ * @param resource - Schedule or HealthcareService to inspect
2724
+ * @returns True if the resource has a SchedulingParameters extension
2725
+ */
2726
+ export declare function hasSchedulingParameters(resource: Schedule | HealthcareService): boolean;
2727
+
2689
2728
  export declare interface Hl7AckOptions {
2690
2729
  ackCode: AckCode;
2691
2730
  errSegment?: Hl7Segment;
@@ -3397,6 +3436,8 @@ export declare function isDateString(input: unknown): input is string;
3397
3436
  */
3398
3437
  export declare function isDateTimeString(input: unknown): input is string;
3399
3438
 
3439
+ export declare function isDayOfWeek(value: string | undefined): value is DayOfWeek;
3440
+
3400
3441
  /**
3401
3442
  * Helper function to narrow a type by excluding undefined/null values.
3402
3443
  * @param value - The value to refine
@@ -7318,6 +7359,16 @@ export declare function parametersToOrderSetSyncResponse(params: Parameters_2):
7318
7359
  */
7319
7360
  export declare function parseFhirPath(input: string): FhirPathAtom;
7320
7361
 
7362
+ /**
7363
+ * Parses a FHIRPath Patch `Parameters` resource into the array of operations consumed by
7364
+ * {@link fhirpathPatchTypedValue}. Each repeating `operation` parameter is decoded from its
7365
+ * `part` entries (`type`, `path`, `name`, `value`, `index`, `source`, `destination`), where
7366
+ * the polymorphic `value[x]` part becomes a {@link TypedValue}.
7367
+ * @param parameters - The FHIRPath Patch Parameters resource.
7368
+ * @returns The parsed FHIRPath Patch operations.
7369
+ */
7370
+ export declare function parseFhirPathPatchParameters(parameters: Parameters_2): FhirPathPatch[];
7371
+
7321
7372
  /**
7322
7373
  * Parses a FHIR _filter parameter expression into an AST.
7323
7374
  * @param input - The FHIR _filter parameter expression.
@@ -8114,6 +8165,12 @@ export declare class ParserBuilder {
8114
8165
  */
8115
8166
  export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
8116
8167
 
8168
+ export declare const SchedulingEncounterCodingURI = "https://medplum.com/fhir/StructureDefinition/SchedulingEncounterCoding";
8169
+
8170
+ export declare const SchedulingParametersURI = "https://medplum.com/fhir/StructureDefinition/SchedulingParameters";
8171
+
8172
+ export declare const SchedulingPlanDefinitionURI = "https://medplum.com/fhir/StructureDefinition/SchedulingPlanDefinition";
8173
+
8117
8174
  export declare interface SearchableToken {
8118
8175
  readonly system: string | undefined;
8119
8176
  readonly value: string | undefined;
@@ -8196,6 +8253,42 @@ export declare class ParserBuilder {
8196
8253
 
8197
8254
  export declare function serverTimeout(msg?: string): OperationOutcome;
8198
8255
 
8256
+ /**
8257
+ * Returns whether any serviceType concept refers to the given HealthcareService.
8258
+ * @param serviceType - CodeableConcept values to inspect
8259
+ * @param service - HealthcareService or reference to match
8260
+ * @returns True if any concept references the service
8261
+ */
8262
+ export declare function serviceTypeIncludesService(serviceType: CodeableConcept[] | undefined, service: WithId<HealthcareService> | (Reference<HealthcareService> & {
8263
+ reference: string;
8264
+ })): boolean;
8265
+
8266
+ /**
8267
+ * Extension URI holding a `Reference<HealthcareService>` on a `serviceType` CodeableConcept.
8268
+ *
8269
+ * In R5/R6, `serviceType` attributes change from `CodeableConcept[]` to
8270
+ * `CodeableReference<HealthcareService>`. We approximate that in R4 with this extension.
8271
+ *
8272
+ * Example: a Schedule whose serviceType refers to a HealthcareService:
8273
+ * ```json
8274
+ * {
8275
+ * "resourceType": "Schedule",
8276
+ * "actor": [{ "reference": "Practitioner/abc" }],
8277
+ * "serviceType": [
8278
+ * {
8279
+ * "extension": [
8280
+ * {
8281
+ * "url": "https://medplum.com/fhir/service-type-reference",
8282
+ * "valueReference": { "reference": "HealthcareService/123" }
8283
+ * }
8284
+ * ]
8285
+ * }
8286
+ * ]
8287
+ * }
8288
+ * ```
8289
+ */
8290
+ export declare const ServiceTypeReferenceURI = "https://medplum.com/fhir/service-type-reference";
8291
+
8199
8292
  /**
8200
8293
  * Sets a code for a given system within a given codeable concept.
8201
8294
  * @param concept - The codeable concept.
@@ -8585,6 +8678,8 @@ export declare class ParserBuilder {
8585
8678
  value: any;
8586
8679
  }
8587
8680
 
8681
+ export declare const TimezoneExtensionURI = "http://hl7.org/fhir/StructureDefinition/timezone";
8682
+
8588
8683
  /**
8589
8684
  * Converts unknown object into a JavaScript boolean.
8590
8685
  * Note that this is different than the FHIRPath "toBoolean",
@@ -8621,6 +8716,19 @@ export declare class ParserBuilder {
8621
8716
  private consumeQuotedSymbol;
8622
8717
  private consumeDateTime;
8623
8718
  private consumeNumber;
8719
+ /**
8720
+ * Consumes an unquoted string value that begins with digits, such as a UUID in a `_filter`
8721
+ * expression, starting over from the beginning of the value.
8722
+ *
8723
+ * The value ends at the first character that cannot be part of a token, per `symbolRegex`. For the
8724
+ * `_filter` tokenizer that is whitespace, ")", and "]", so a value at the end of a nested
8725
+ * expression such as "(_id eq 12345678-1234-4123-8123-123456789abc)" does not swallow the closing
8726
+ * parenthesis.
8727
+ *
8728
+ * @param start - The index of the first character of the value.
8729
+ * @returns The string token.
8730
+ */
8731
+ private consumeUnquotedString;
8624
8732
  private consumeSymbol;
8625
8733
  private consumeOperator;
8626
8734
  private consumeWhile;
@@ -8661,6 +8769,15 @@ export declare class ParserBuilder {
8661
8769
  */
8662
8770
  export declare function toPeriod(input: unknown): Period | undefined;
8663
8771
 
8772
+ /**
8773
+ * Converts a HealthcareService into the CodeableConcept values used by
8774
+ * `Schedule.serviceType` and `Appointment.serviceType`, which encode an R4
8775
+ * approximation of `CodeableReference<HealthcareService>`.
8776
+ * @param service - HealthcareService to represent
8777
+ * @returns CodeableConcept values containing a reference to the service
8778
+ */
8779
+ export declare function toServiceTypeCodeableConcepts(service: WithId<HealthcareService>): CodeableConcept[];
8780
+
8664
8781
  /**
8665
8782
  * Returns a "best guess" TypedValue for a given value.
8666
8783
  * @param value - The unknown value to check.
@@ -22,6 +22,7 @@ import type { Encounter } from '@medplum/fhirtypes';
22
22
  import type { Extension } from '@medplum/fhirtypes';
23
23
  import type { ExtensionValue } from '@medplum/fhirtypes';
24
24
  import type { ExtractResource } from '@medplum/fhirtypes';
25
+ import type { HealthcareService } from '@medplum/fhirtypes';
25
26
  import type { HumanName } from '@medplum/fhirtypes';
26
27
  import type { Identifier } from '@medplum/fhirtypes';
27
28
  import type { ImagingStudy } from '@medplum/fhirtypes';
@@ -56,6 +57,7 @@ import type { RelatedPerson } from '@medplum/fhirtypes';
56
57
  import type { Resource } from '@medplum/fhirtypes';
57
58
  import type { ResourceType } from '@medplum/fhirtypes';
58
59
  import type { SampledData } from '@medplum/fhirtypes';
60
+ import type { Schedule } from '@medplum/fhirtypes';
59
61
  import type { SearchParameter } from '@medplum/fhirtypes';
60
62
  import type { StructureDefinition } from '@medplum/fhirtypes';
61
63
  import type { StructureMap } from '@medplum/fhirtypes';
@@ -431,6 +433,24 @@ export { assert_2 as assert }
431
433
 
432
434
  export declare function assertContextVersionOptional(event: string): asserts event is FhircastEventVersionOptional;
433
435
 
436
+ /**
437
+ * Checks that a value has type `never`. Useful for ensuring exhaustive
438
+ * matches.
439
+ *
440
+ * @example
441
+ * ```typescript
442
+ * type MyUnion = 'a' | 'b' | 'c'
443
+ * function f(arg: MyUnion) {
444
+ * if (arg === 'a') { return 1; }
445
+ * if (arg === 'b') { return 2; }
446
+ * assertNever(arg); // Type error: 'c' is unhandled
447
+ * }
448
+ * ```
449
+ *
450
+ * @param value - The value that should never be present
451
+ */
452
+ export declare function assertNever(value: never): never;
453
+
434
454
  /**
435
455
  * Asserts that the operation completed successfully and that the resource is defined.
436
456
  * @param outcome - The operation outcome.
@@ -954,6 +974,7 @@ export declare function contentTooLarge(text: string): OperationOutcome;
954
974
  export declare const ContentType: {
955
975
  readonly CSS: "text/css";
956
976
  readonly DICOM: "application/dicom";
977
+ readonly DICOM_JSON: "application/dicom+json";
957
978
  readonly EVENT_STREAM: "text/event-stream";
958
979
  readonly FAVICON: "image/vnd.microsoft.icon";
959
980
  readonly FHIR_JSON: "application/fhir+json";
@@ -1254,6 +1275,10 @@ export declare type DataTypesMap = {
1254
1275
  [type: string]: InternalTypeSchema;
1255
1276
  };
1256
1277
 
1278
+ export declare type DayOfWeek = (typeof DAYS_OF_WEEK)[number];
1279
+
1280
+ export declare const DAYS_OF_WEEK: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
1281
+
1257
1282
  /**
1258
1283
  * Decodes a base64 string.
1259
1284
  * Handles both browser and Node environments.
@@ -1630,6 +1655,13 @@ export declare const ExternalSecretSystems: {
1630
1655
  */
1631
1656
  export declare function extractAccountReferences(meta: Meta | undefined): Reference[] | undefined;
1632
1657
 
1658
+ /**
1659
+ * Extracts HealthcareService references from serviceType concepts.
1660
+ * @param serviceType - CodeableConcept values to inspect
1661
+ * @returns HealthcareService references embedded in the concepts
1662
+ */
1663
+ export declare function extractServiceTypeReferences(serviceType: CodeableConcept[] | undefined): Reference<HealthcareService>[];
1664
+
1633
1665
  /**
1634
1666
  * Fetches the version strings for all published Medplum releases.
1635
1667
  * @param appName - The name of the app to fetch the release list for.
@@ -2686,6 +2718,13 @@ export declare interface GoogleLoginRequest extends BaseLoginRequest {
2686
2718
  readonly createUser?: boolean;
2687
2719
  }
2688
2720
 
2721
+ /**
2722
+ * Returns whether a Schedule or HealthcareService has a SchedulingParameters extension.
2723
+ * @param resource - Schedule or HealthcareService to inspect
2724
+ * @returns True if the resource has a SchedulingParameters extension
2725
+ */
2726
+ export declare function hasSchedulingParameters(resource: Schedule | HealthcareService): boolean;
2727
+
2689
2728
  export declare interface Hl7AckOptions {
2690
2729
  ackCode: AckCode;
2691
2730
  errSegment?: Hl7Segment;
@@ -3397,6 +3436,8 @@ export declare function isDateString(input: unknown): input is string;
3397
3436
  */
3398
3437
  export declare function isDateTimeString(input: unknown): input is string;
3399
3438
 
3439
+ export declare function isDayOfWeek(value: string | undefined): value is DayOfWeek;
3440
+
3400
3441
  /**
3401
3442
  * Helper function to narrow a type by excluding undefined/null values.
3402
3443
  * @param value - The value to refine
@@ -7318,6 +7359,16 @@ export declare function parametersToOrderSetSyncResponse(params: Parameters_2):
7318
7359
  */
7319
7360
  export declare function parseFhirPath(input: string): FhirPathAtom;
7320
7361
 
7362
+ /**
7363
+ * Parses a FHIRPath Patch `Parameters` resource into the array of operations consumed by
7364
+ * {@link fhirpathPatchTypedValue}. Each repeating `operation` parameter is decoded from its
7365
+ * `part` entries (`type`, `path`, `name`, `value`, `index`, `source`, `destination`), where
7366
+ * the polymorphic `value[x]` part becomes a {@link TypedValue}.
7367
+ * @param parameters - The FHIRPath Patch Parameters resource.
7368
+ * @returns The parsed FHIRPath Patch operations.
7369
+ */
7370
+ export declare function parseFhirPathPatchParameters(parameters: Parameters_2): FhirPathPatch[];
7371
+
7321
7372
  /**
7322
7373
  * Parses a FHIR _filter parameter expression into an AST.
7323
7374
  * @param input - The FHIR _filter parameter expression.
@@ -8114,6 +8165,12 @@ export declare class ParserBuilder {
8114
8165
  */
8115
8166
  export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
8116
8167
 
8168
+ export declare const SchedulingEncounterCodingURI = "https://medplum.com/fhir/StructureDefinition/SchedulingEncounterCoding";
8169
+
8170
+ export declare const SchedulingParametersURI = "https://medplum.com/fhir/StructureDefinition/SchedulingParameters";
8171
+
8172
+ export declare const SchedulingPlanDefinitionURI = "https://medplum.com/fhir/StructureDefinition/SchedulingPlanDefinition";
8173
+
8117
8174
  export declare interface SearchableToken {
8118
8175
  readonly system: string | undefined;
8119
8176
  readonly value: string | undefined;
@@ -8196,6 +8253,42 @@ export declare class ParserBuilder {
8196
8253
 
8197
8254
  export declare function serverTimeout(msg?: string): OperationOutcome;
8198
8255
 
8256
+ /**
8257
+ * Returns whether any serviceType concept refers to the given HealthcareService.
8258
+ * @param serviceType - CodeableConcept values to inspect
8259
+ * @param service - HealthcareService or reference to match
8260
+ * @returns True if any concept references the service
8261
+ */
8262
+ export declare function serviceTypeIncludesService(serviceType: CodeableConcept[] | undefined, service: WithId<HealthcareService> | (Reference<HealthcareService> & {
8263
+ reference: string;
8264
+ })): boolean;
8265
+
8266
+ /**
8267
+ * Extension URI holding a `Reference<HealthcareService>` on a `serviceType` CodeableConcept.
8268
+ *
8269
+ * In R5/R6, `serviceType` attributes change from `CodeableConcept[]` to
8270
+ * `CodeableReference<HealthcareService>`. We approximate that in R4 with this extension.
8271
+ *
8272
+ * Example: a Schedule whose serviceType refers to a HealthcareService:
8273
+ * ```json
8274
+ * {
8275
+ * "resourceType": "Schedule",
8276
+ * "actor": [{ "reference": "Practitioner/abc" }],
8277
+ * "serviceType": [
8278
+ * {
8279
+ * "extension": [
8280
+ * {
8281
+ * "url": "https://medplum.com/fhir/service-type-reference",
8282
+ * "valueReference": { "reference": "HealthcareService/123" }
8283
+ * }
8284
+ * ]
8285
+ * }
8286
+ * ]
8287
+ * }
8288
+ * ```
8289
+ */
8290
+ export declare const ServiceTypeReferenceURI = "https://medplum.com/fhir/service-type-reference";
8291
+
8199
8292
  /**
8200
8293
  * Sets a code for a given system within a given codeable concept.
8201
8294
  * @param concept - The codeable concept.
@@ -8585,6 +8678,8 @@ export declare class ParserBuilder {
8585
8678
  value: any;
8586
8679
  }
8587
8680
 
8681
+ export declare const TimezoneExtensionURI = "http://hl7.org/fhir/StructureDefinition/timezone";
8682
+
8588
8683
  /**
8589
8684
  * Converts unknown object into a JavaScript boolean.
8590
8685
  * Note that this is different than the FHIRPath "toBoolean",
@@ -8621,6 +8716,19 @@ export declare class ParserBuilder {
8621
8716
  private consumeQuotedSymbol;
8622
8717
  private consumeDateTime;
8623
8718
  private consumeNumber;
8719
+ /**
8720
+ * Consumes an unquoted string value that begins with digits, such as a UUID in a `_filter`
8721
+ * expression, starting over from the beginning of the value.
8722
+ *
8723
+ * The value ends at the first character that cannot be part of a token, per `symbolRegex`. For the
8724
+ * `_filter` tokenizer that is whitespace, ")", and "]", so a value at the end of a nested
8725
+ * expression such as "(_id eq 12345678-1234-4123-8123-123456789abc)" does not swallow the closing
8726
+ * parenthesis.
8727
+ *
8728
+ * @param start - The index of the first character of the value.
8729
+ * @returns The string token.
8730
+ */
8731
+ private consumeUnquotedString;
8624
8732
  private consumeSymbol;
8625
8733
  private consumeOperator;
8626
8734
  private consumeWhile;
@@ -8661,6 +8769,15 @@ export declare class ParserBuilder {
8661
8769
  */
8662
8770
  export declare function toPeriod(input: unknown): Period | undefined;
8663
8771
 
8772
+ /**
8773
+ * Converts a HealthcareService into the CodeableConcept values used by
8774
+ * `Schedule.serviceType` and `Appointment.serviceType`, which encode an R4
8775
+ * approximation of `CodeableReference<HealthcareService>`.
8776
+ * @param service - HealthcareService to represent
8777
+ * @returns CodeableConcept values containing a reference to the service
8778
+ */
8779
+ export declare function toServiceTypeCodeableConcepts(service: WithId<HealthcareService>): CodeableConcept[];
8780
+
8664
8781
  /**
8665
8782
  * Returns a "best guess" TypedValue for a given value.
8666
8783
  * @param value - The unknown value to check.