@medplum/core 5.2.3 → 5.2.5

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.
@@ -2489,6 +2489,30 @@ export declare interface GenerateSmartHealthLinkParams {
2489
2489
  includeQrCode?: boolean;
2490
2490
  }
2491
2491
 
2492
+ /**
2493
+ * Generates the contents of a TypeScript definition (`.d.ts`) file for a FHIR type schema,
2494
+ * including its inner (backbone element) types.
2495
+ *
2496
+ * The schema can be a base FHIR type or a profile, as returned by `parseStructureDefinition` or `tryGetProfile`.
2497
+ * @param fhirType - The type schema to generate an interface for.
2498
+ * @param options - Optional generator options.
2499
+ * @returns The TypeScript file contents, or undefined if the type has no elements.
2500
+ */
2501
+ export declare function generateTypeScriptDefinition(fhirType: InternalTypeSchema, options?: TypeScriptGeneratorOptions): string | undefined;
2502
+
2503
+ /**
2504
+ * Generates TypeScript definitions for FHIR StructureDefinitions, such as profiles.
2505
+ *
2506
+ * Returns one `.d.ts` file per StructureDefinition, plus an `index.d.ts` that exports them all.
2507
+ * Types that are not generated, such as base FHIR data types, are imported from `@medplum/fhirtypes` by default.
2508
+ *
2509
+ * The StructureDefinitions must include a `snapshot`, and are indexed as a side effect.
2510
+ * @param structureDefinitions - The StructureDefinitions to generate types for.
2511
+ * @param options - Optional generator options.
2512
+ * @returns A map of file names to TypeScript file contents.
2513
+ */
2514
+ export declare function generateTypeScriptDefinitions(structureDefinitions: StructureDefinition[], options?: TypeScriptGeneratorOptions): Record<string, string>;
2515
+
2492
2516
  export declare function getAllDataTypes(): DataTypesMap;
2493
2517
 
2494
2518
  /**
@@ -6910,6 +6934,8 @@ export declare interface MedplumInfraConfig {
6910
6934
  guardDutyMalwareProtectionEnabled?: boolean;
6911
6935
  /** With guardDutyMalwareProtectionEnabled, scan only via Binary $scan, and only block Binaries with threats found. */
6912
6936
  guardDutyMalwareProtectionOnDemandOnly?: boolean;
6937
+ /** Delete bot inputs written by the server's `storeBotInput` setting (`bot/` prefix) after this many days. */
6938
+ storageBotInputExpirationDays?: number;
6913
6939
  /** @deprecated Use guardDutyMalwareProtectionEnabled instead */
6914
6940
  clamscanEnabled: boolean;
6915
6941
  /** @deprecated Use guardDutyMalwareProtectionEnabled instead */
@@ -7144,6 +7170,8 @@ export declare interface MedplumSourceInfraConfig {
7144
7170
  guardDutyMalwareProtectionEnabled?: ValueOrExternalSecret<boolean>;
7145
7171
  /** With guardDutyMalwareProtectionEnabled, scan only via Binary $scan, and only block Binaries with threats found. */
7146
7172
  guardDutyMalwareProtectionOnDemandOnly?: ValueOrExternalSecret<boolean>;
7173
+ /** Delete bot inputs written by the server's `storeBotInput` setting (`bot/` prefix) after this many days. */
7174
+ storageBotInputExpirationDays?: ValueOrExternalSecret<number>;
7147
7175
  /** @deprecated Use guardDutyMalwareProtectionEnabled instead */
7148
7176
  clamscanEnabled?: ValueOrExternalSecret<boolean>;
7149
7177
  /** @deprecated Use guardDutyMalwareProtectionEnabled instead */
@@ -7502,6 +7530,12 @@ export declare const OAuthTokenType: {
7502
7530
 
7503
7531
  export declare type OAuthTokenType = (typeof OAuthTokenType)[keyof typeof OAuthTokenType];
7504
7532
 
7533
+ /**
7534
+ * R5's `Appointment.occurrenceChanged`, as the R4 cross-version extension: set (valueBoolean) on an
7535
+ * occurrence of a recurring series that has been rescheduled off the series' pattern.
7536
+ */
7537
+ export declare const OccurrenceChangedExtensionURI = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Appointment.occurrenceChanged";
7538
+
7505
7539
  export declare type Operation = AddOperation | RemoveOperation | ReplaceOperation | MoveOperation | CopyOperation | TestOperation;
7506
7540
 
7507
7541
  export declare class OperationOutcomeError extends Error {
@@ -8592,6 +8626,8 @@ export declare class ParserBuilder {
8592
8626
  */
8593
8627
  export declare const SchedulingBookedByOperationURI = "https://medplum.com/fhir/StructureDefinition/SchedulingBookedByOperation";
8594
8628
 
8629
+ export declare const SchedulingColorURI = "https://medplum.com/fhir/StructureDefinition/SchedulingColor";
8630
+
8595
8631
  /**
8596
8632
  * Converts a SchedulingParameters duration to minutes.
8597
8633
  *
@@ -8603,6 +8639,12 @@ export declare class ParserBuilder {
8603
8639
 
8604
8640
  export declare const SchedulingEncounterCodingURI = "https://medplum.com/fhir/StructureDefinition/SchedulingEncounterCoding";
8605
8641
 
8642
+ /**
8643
+ * This extension holds a `valueUrl` linking to the same `Appointment` in an external
8644
+ * system, such as the scheduling system it is synced with.
8645
+ */
8646
+ export declare const SchedulingExternalUrlURI = "https://medplum.com/fhir/StructureDefinition/SchedulingExternalUrl";
8647
+
8606
8648
  /** Extension on an Appointment recording that medical necessity was confirmed when it was booked. */
8607
8649
  export declare const SchedulingMedicalNecessityURI = "https://medplum.com/fhir/StructureDefinition/SchedulingMedicalNecessity";
8608
8650
 
@@ -8623,6 +8665,7 @@ export declare class ParserBuilder {
8623
8665
 
8624
8666
  export declare type SchedulingRequirement = (typeof SCHEDULING_REQUIREMENT_CODES)[number];
8625
8667
 
8668
+ /** @deprecated Use SchedulingColorURI instead. */
8626
8669
  export declare const SchedulingScheduleColorURI = "https://medplum.com/fhir/StructureDefinition/SchedulingColor";
8627
8670
 
8628
8671
  /** Extension URI marking which `Appointment.supportingInformation` entry is the site. */
@@ -9380,6 +9423,13 @@ export declare class ParserBuilder {
9380
9423
 
9381
9424
  export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
9382
9425
 
9426
+ /**
9427
+ * Parses a reference and returns a tuple of [ResourceType, ID], or undefined if the reference cannot be parsed.
9428
+ * @param reference - A reference to a FHIR resource.
9429
+ * @returns A tuple containing the `ResourceType` and the ID of the resource, or undefined if the reference cannot be parsed.
9430
+ */
9431
+ export declare function tryParseReference<T extends Resource>(reference: Reference<T> | undefined): [T['resourceType'], string] | undefined;
9432
+
9383
9433
  export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
9384
9434
  private readonly emitter;
9385
9435
  dispatchEvent<TEventType extends keyof TEvents>(event: TEvents[TEventType]): void;
@@ -9426,6 +9476,19 @@ export declare class ParserBuilder {
9426
9476
 
9427
9477
  export declare type TypeName<T> = T extends string ? 'string' : T extends number ? 'number' : T extends boolean ? 'boolean' : T extends undefined ? 'undefined' : 'object';
9428
9478
 
9479
+ export declare interface TypeScriptGeneratorOptions {
9480
+ /**
9481
+ * Returns the codes in a ValueSet, used to narrow bound string properties to a union of string literals.
9482
+ * If not provided, or if no codes are returned, bound properties are typed as `string`.
9483
+ */
9484
+ getValueSetValues?: (url: string) => string[] | undefined;
9485
+ /**
9486
+ * Returns the module specifier used to import a referenced type.
9487
+ * Defaults to a sibling file, e.g. `./Patient.d.ts`.
9488
+ */
9489
+ getImportPath?: (typeName: string) => string;
9490
+ }
9491
+
9429
9492
  export declare const UCUM = "http://unitsofmeasure.org";
9430
9493
 
9431
9494
  export declare class UnaryOperatorAtom extends PrefixOperatorAtom {
@@ -2489,6 +2489,30 @@ export declare interface GenerateSmartHealthLinkParams {
2489
2489
  includeQrCode?: boolean;
2490
2490
  }
2491
2491
 
2492
+ /**
2493
+ * Generates the contents of a TypeScript definition (`.d.ts`) file for a FHIR type schema,
2494
+ * including its inner (backbone element) types.
2495
+ *
2496
+ * The schema can be a base FHIR type or a profile, as returned by `parseStructureDefinition` or `tryGetProfile`.
2497
+ * @param fhirType - The type schema to generate an interface for.
2498
+ * @param options - Optional generator options.
2499
+ * @returns The TypeScript file contents, or undefined if the type has no elements.
2500
+ */
2501
+ export declare function generateTypeScriptDefinition(fhirType: InternalTypeSchema, options?: TypeScriptGeneratorOptions): string | undefined;
2502
+
2503
+ /**
2504
+ * Generates TypeScript definitions for FHIR StructureDefinitions, such as profiles.
2505
+ *
2506
+ * Returns one `.d.ts` file per StructureDefinition, plus an `index.d.ts` that exports them all.
2507
+ * Types that are not generated, such as base FHIR data types, are imported from `@medplum/fhirtypes` by default.
2508
+ *
2509
+ * The StructureDefinitions must include a `snapshot`, and are indexed as a side effect.
2510
+ * @param structureDefinitions - The StructureDefinitions to generate types for.
2511
+ * @param options - Optional generator options.
2512
+ * @returns A map of file names to TypeScript file contents.
2513
+ */
2514
+ export declare function generateTypeScriptDefinitions(structureDefinitions: StructureDefinition[], options?: TypeScriptGeneratorOptions): Record<string, string>;
2515
+
2492
2516
  export declare function getAllDataTypes(): DataTypesMap;
2493
2517
 
2494
2518
  /**
@@ -6910,6 +6934,8 @@ export declare interface MedplumInfraConfig {
6910
6934
  guardDutyMalwareProtectionEnabled?: boolean;
6911
6935
  /** With guardDutyMalwareProtectionEnabled, scan only via Binary $scan, and only block Binaries with threats found. */
6912
6936
  guardDutyMalwareProtectionOnDemandOnly?: boolean;
6937
+ /** Delete bot inputs written by the server's `storeBotInput` setting (`bot/` prefix) after this many days. */
6938
+ storageBotInputExpirationDays?: number;
6913
6939
  /** @deprecated Use guardDutyMalwareProtectionEnabled instead */
6914
6940
  clamscanEnabled: boolean;
6915
6941
  /** @deprecated Use guardDutyMalwareProtectionEnabled instead */
@@ -7144,6 +7170,8 @@ export declare interface MedplumSourceInfraConfig {
7144
7170
  guardDutyMalwareProtectionEnabled?: ValueOrExternalSecret<boolean>;
7145
7171
  /** With guardDutyMalwareProtectionEnabled, scan only via Binary $scan, and only block Binaries with threats found. */
7146
7172
  guardDutyMalwareProtectionOnDemandOnly?: ValueOrExternalSecret<boolean>;
7173
+ /** Delete bot inputs written by the server's `storeBotInput` setting (`bot/` prefix) after this many days. */
7174
+ storageBotInputExpirationDays?: ValueOrExternalSecret<number>;
7147
7175
  /** @deprecated Use guardDutyMalwareProtectionEnabled instead */
7148
7176
  clamscanEnabled?: ValueOrExternalSecret<boolean>;
7149
7177
  /** @deprecated Use guardDutyMalwareProtectionEnabled instead */
@@ -7502,6 +7530,12 @@ export declare const OAuthTokenType: {
7502
7530
 
7503
7531
  export declare type OAuthTokenType = (typeof OAuthTokenType)[keyof typeof OAuthTokenType];
7504
7532
 
7533
+ /**
7534
+ * R5's `Appointment.occurrenceChanged`, as the R4 cross-version extension: set (valueBoolean) on an
7535
+ * occurrence of a recurring series that has been rescheduled off the series' pattern.
7536
+ */
7537
+ export declare const OccurrenceChangedExtensionURI = "http://hl7.org/fhir/5.0/StructureDefinition/extension-Appointment.occurrenceChanged";
7538
+
7505
7539
  export declare type Operation = AddOperation | RemoveOperation | ReplaceOperation | MoveOperation | CopyOperation | TestOperation;
7506
7540
 
7507
7541
  export declare class OperationOutcomeError extends Error {
@@ -8592,6 +8626,8 @@ export declare class ParserBuilder {
8592
8626
  */
8593
8627
  export declare const SchedulingBookedByOperationURI = "https://medplum.com/fhir/StructureDefinition/SchedulingBookedByOperation";
8594
8628
 
8629
+ export declare const SchedulingColorURI = "https://medplum.com/fhir/StructureDefinition/SchedulingColor";
8630
+
8595
8631
  /**
8596
8632
  * Converts a SchedulingParameters duration to minutes.
8597
8633
  *
@@ -8603,6 +8639,12 @@ export declare class ParserBuilder {
8603
8639
 
8604
8640
  export declare const SchedulingEncounterCodingURI = "https://medplum.com/fhir/StructureDefinition/SchedulingEncounterCoding";
8605
8641
 
8642
+ /**
8643
+ * This extension holds a `valueUrl` linking to the same `Appointment` in an external
8644
+ * system, such as the scheduling system it is synced with.
8645
+ */
8646
+ export declare const SchedulingExternalUrlURI = "https://medplum.com/fhir/StructureDefinition/SchedulingExternalUrl";
8647
+
8606
8648
  /** Extension on an Appointment recording that medical necessity was confirmed when it was booked. */
8607
8649
  export declare const SchedulingMedicalNecessityURI = "https://medplum.com/fhir/StructureDefinition/SchedulingMedicalNecessity";
8608
8650
 
@@ -8623,6 +8665,7 @@ export declare class ParserBuilder {
8623
8665
 
8624
8666
  export declare type SchedulingRequirement = (typeof SCHEDULING_REQUIREMENT_CODES)[number];
8625
8667
 
8668
+ /** @deprecated Use SchedulingColorURI instead. */
8626
8669
  export declare const SchedulingScheduleColorURI = "https://medplum.com/fhir/StructureDefinition/SchedulingColor";
8627
8670
 
8628
8671
  /** Extension URI marking which `Appointment.supportingInformation` entry is the site. */
@@ -9380,6 +9423,13 @@ export declare class ParserBuilder {
9380
9423
 
9381
9424
  export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
9382
9425
 
9426
+ /**
9427
+ * Parses a reference and returns a tuple of [ResourceType, ID], or undefined if the reference cannot be parsed.
9428
+ * @param reference - A reference to a FHIR resource.
9429
+ * @returns A tuple containing the `ResourceType` and the ID of the resource, or undefined if the reference cannot be parsed.
9430
+ */
9431
+ export declare function tryParseReference<T extends Resource>(reference: Reference<T> | undefined): [T['resourceType'], string] | undefined;
9432
+
9383
9433
  export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
9384
9434
  private readonly emitter;
9385
9435
  dispatchEvent<TEventType extends keyof TEvents>(event: TEvents[TEventType]): void;
@@ -9426,6 +9476,19 @@ export declare class ParserBuilder {
9426
9476
 
9427
9477
  export declare type TypeName<T> = T extends string ? 'string' : T extends number ? 'number' : T extends boolean ? 'boolean' : T extends undefined ? 'undefined' : 'object';
9428
9478
 
9479
+ export declare interface TypeScriptGeneratorOptions {
9480
+ /**
9481
+ * Returns the codes in a ValueSet, used to narrow bound string properties to a union of string literals.
9482
+ * If not provided, or if no codes are returned, bound properties are typed as `string`.
9483
+ */
9484
+ getValueSetValues?: (url: string) => string[] | undefined;
9485
+ /**
9486
+ * Returns the module specifier used to import a referenced type.
9487
+ * Defaults to a sibling file, e.g. `./Patient.d.ts`.
9488
+ */
9489
+ getImportPath?: (typeName: string) => string;
9490
+ }
9491
+
9429
9492
  export declare const UCUM = "http://unitsofmeasure.org";
9430
9493
 
9431
9494
  export declare class UnaryOperatorAtom extends PrefixOperatorAtom {