@medplum/core 2.2.2 → 2.2.4

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.
@@ -425,6 +425,10 @@ export declare type CurrentContext<EventName extends FhircastResourceEventName =
425
425
  context: FhircastEventContext<EventName>[];
426
426
  };
427
427
 
428
+ export declare type DataTypesMap = {
429
+ [type: string]: InternalTypeSchema;
430
+ };
431
+
428
432
  /**
429
433
  * Decodes a base64 string.
430
434
  * Handles both browser and Node environments.
@@ -486,6 +490,7 @@ export declare class DotAtom extends InfixOperatorAtom {
486
490
  export declare interface ElementType {
487
491
  code: string;
488
492
  targetProfile?: string[];
493
+ profile?: string[];
489
494
  }
490
495
 
491
496
  export declare interface EmailPasswordLoginRequest extends BaseLoginRequest {
@@ -1121,7 +1126,7 @@ export declare class FunctionAtom implements Atom {
1121
1126
  */
1122
1127
  export declare function generateId(): string;
1123
1128
 
1124
- export declare function getAllDataTypes(): Record<string, InternalTypeSchema>;
1129
+ export declare function getAllDataTypes(): DataTypesMap;
1125
1130
 
1126
1131
  /**
1127
1132
  * Returns an array of questionnaire answers as a map by link ID.
@@ -1138,7 +1143,7 @@ export declare function getAllQuestionnaireAnswers(response: QuestionnaireRespon
1138
1143
  */
1139
1144
  export declare function getCodeBySystem(concept: CodeableConcept, system: string): string | undefined;
1140
1145
 
1141
- export declare function getDataType(type: string): InternalTypeSchema;
1146
+ export declare function getDataType(type: string, profileUrl?: string): InternalTypeSchema;
1142
1147
 
1143
1148
  /**
1144
1149
  * Returns a Date property as a Date.
@@ -1158,13 +1163,20 @@ export declare function getDisplayString(resource: Resource): string;
1158
1163
 
1159
1164
  /**
1160
1165
  * Returns an element definition by type and property name.
1161
- * Handles content references.
1162
1166
  * @param typeName - The type name.
1163
1167
  * @param propertyName - The property name.
1164
1168
  * @returns The element definition if found.
1165
1169
  */
1166
1170
  export declare function getElementDefinition(typeName: string, propertyName: string): InternalSchemaElement | undefined;
1167
1171
 
1172
+ /**
1173
+ * Returns an element definition from mapping of elements by property name.
1174
+ * @param elements - A mapping of property names to element definitions
1175
+ * @param propertyName - The property name of interest
1176
+ * @returns The element definition if found.
1177
+ */
1178
+ export declare function getElementDefinitionFromElements(elements: InternalTypeSchema['elements'], propertyName: string): InternalSchemaElement | undefined;
1179
+
1168
1180
  /**
1169
1181
  * Returns the type name for an ElementDefinition.
1170
1182
  * @param elementDefinition - The element definition.
@@ -1218,7 +1230,14 @@ export declare function getNestedProperty(value: TypedValue, key: string): (Type
1218
1230
  * @param path - The FHIR element definition path.
1219
1231
  * @returns The best guess of the display name.
1220
1232
  */
1221
- export declare function getPropertyDisplayName(path: string): string;
1233
+ export declare function getPathDisplayName(path: string): string;
1234
+
1235
+ /**
1236
+ * Return s a human friendly display name for a FHIR element property or slice name
1237
+ * @param propertyName - The FHIR element property or slice name
1238
+ * @returns The best guess of the display name.
1239
+ */
1240
+ export declare function getPropertyDisplayName(propertyName: string): string;
1222
1241
 
1223
1242
  /**
1224
1243
  * Returns all questionnaire answers as a map by link ID.
@@ -1291,6 +1310,15 @@ export declare function getStatus(outcome: OperationOutcome): number;
1291
1310
  */
1292
1311
  export declare function getTypedPropertyValue(input: TypedValue, path: string): TypedValue[] | TypedValue | undefined;
1293
1312
 
1313
+ /**
1314
+ * Returns the value of the property and the property type using a type schema.
1315
+ * @param value - The base context (FHIR resource or backbone element).
1316
+ * @param path - The property path.
1317
+ * @param element - The property element definition.
1318
+ * @returns The value of the property and the property type.
1319
+ */
1320
+ export declare function getTypedPropertyValueWithSchema(value: TypedValue['value'], path: string, element: InternalSchemaElement): TypedValue[] | TypedValue | undefined;
1321
+
1294
1322
  /**
1295
1323
  * Global schema singleton.
1296
1324
  */
@@ -1624,7 +1652,12 @@ export declare function indexSearchParameter(searchParam: SearchParameter): void
1624
1652
  */
1625
1653
  export declare function indexSearchParameterBundle(bundle: Bundle<SearchParameter>): void;
1626
1654
 
1627
- export declare function indexStructureDefinitionBundle(bundle: StructureDefinition[] | Bundle): void;
1655
+ /**
1656
+ * Parses and indexes structure definitions
1657
+ * @param bundle - Bundle or array of structure definitions to be parsed and indexed
1658
+ * @param profileUrl - (optional) URL of the profile the SDs are related to
1659
+ */
1660
+ export declare function indexStructureDefinitionBundle(bundle: StructureDefinition[] | Bundle, profileUrl?: string | undefined): void;
1628
1661
 
1629
1662
  export declare abstract class InfixOperatorAtom implements Atom {
1630
1663
  readonly operator: string;
@@ -1640,9 +1673,9 @@ export declare interface InfixParselet {
1640
1673
  parse?(parser: Parser, left: Atom, token: Token): Atom;
1641
1674
  }
1642
1675
 
1643
- export declare function inflateBaseSchema(base: BaseSchema): Record<string, InternalTypeSchema>;
1676
+ export declare function inflateBaseSchema(base: BaseSchema): DataTypesMap;
1644
1677
 
1645
- export declare function inflateElement(partial: Partial<InternalSchemaElement>): InternalSchemaElement;
1678
+ export declare function inflateElement(path: string, partial: Partial<InternalSchemaElement>): InternalSchemaElement;
1646
1679
 
1647
1680
  export declare function initFhirPathParserBuilder(): ParserBuilder;
1648
1681
 
@@ -1665,8 +1698,10 @@ export declare interface InternalSchemaElement {
1665
1698
  */
1666
1699
  export declare interface InternalTypeSchema {
1667
1700
  name: string;
1701
+ title?: string;
1668
1702
  url?: string;
1669
1703
  kind?: string;
1704
+ type?: string;
1670
1705
  description?: string;
1671
1706
  elements: Record<string, InternalSchemaElement>;
1672
1707
  constraints?: Constraint[];
@@ -1762,6 +1797,8 @@ export declare function isOperationOutcome(value: unknown): value is OperationOu
1762
1797
  */
1763
1798
  export declare function isPeriod(input: unknown): input is Period;
1764
1799
 
1800
+ export declare function isProfileLoaded(profileUrl: string): boolean;
1801
+
1765
1802
  /**
1766
1803
  * Returns true if the resource is a "ProfileResource".
1767
1804
  * @param resource - The FHIR resource.
@@ -1845,7 +1882,7 @@ export declare class LiteralAtom implements Atom {
1845
1882
  toString(): string;
1846
1883
  }
1847
1884
 
1848
- export declare function loadDataType(sd: StructureDefinition): void;
1885
+ export declare function loadDataType(sd: StructureDefinition, profileUrl?: string | undefined): void;
1849
1886
 
1850
1887
  export declare interface LoginAuthenticationResponse {
1851
1888
  readonly login: string;
@@ -1972,6 +2009,8 @@ export declare interface Marker {
1972
2009
  column: number;
1973
2010
  }
1974
2011
 
2012
+ export declare function matchDiscriminant(value: TypedValue | TypedValue[] | undefined, discriminator: SliceDiscriminator, slice: SliceDefinition, elements?: Record<string, InternalSchemaElement>): boolean;
2013
+
1975
2014
  /**
1976
2015
  * Returns true if the resource satisfies the current access policy.
1977
2016
  * @param accessPolicy - The access policy.
@@ -2537,6 +2576,14 @@ export declare class MedplumClient extends EventTarget_2 {
2537
2576
  * @returns Promise to a schema with the requested resource type.
2538
2577
  */
2539
2578
  requestSchema(resourceType: string): Promise<void>;
2579
+ /**
2580
+ * Requests the schema for a profile.
2581
+ * If the schema is already cached, the promise is resolved immediately.
2582
+ * @category Schema
2583
+ * @param profileUrl - The FHIR URL of the profile
2584
+ * @returns Promise to a schema with the requested profile.
2585
+ */
2586
+ requestProfileSchema(profileUrl: string): Promise<void>;
2540
2587
  /**
2541
2588
  * Reads resource history by resource type and ID.
2542
2589
  *
@@ -3600,6 +3647,7 @@ export declare interface MedplumInfraConfig {
3600
3647
  clamscanLoggingBucket: string;
3601
3648
  clamscanLoggingPrefix: string;
3602
3649
  skipDns?: boolean;
3650
+ hostedZoneName?: string;
3603
3651
  additionalContainers?: {
3604
3652
  name: string;
3605
3653
  image: string;
@@ -3659,6 +3707,7 @@ export declare interface MedplumSourceInfraConfig {
3659
3707
  clamscanLoggingBucket: ValueOrExternalSecret<string>;
3660
3708
  clamscanLoggingPrefix: ValueOrExternalSecret<string>;
3661
3709
  skipDns?: ValueOrExternalSecret<boolean>;
3710
+ hostedZoneName?: ValueOrExternalSecret<string>;
3662
3711
  additionalContainers?: {
3663
3712
  name: ValueOrExternalSecret<string>;
3664
3713
  image: ValueOrExternalSecret<string>;
@@ -4416,6 +4465,8 @@ export declare const sleep: (ms: number) => Promise<void>;
4416
4465
 
4417
4466
  export declare interface SliceDefinition {
4418
4467
  name: string;
4468
+ path: string;
4469
+ definition?: string;
4419
4470
  type?: ElementType[];
4420
4471
  elements: Record<string, InternalSchemaElement>;
4421
4472
  min: number;
@@ -4570,7 +4621,9 @@ export declare const tooManyRequests: OperationOutcome;
4570
4621
  */
4571
4622
  export declare function toTypedValue(value: unknown): TypedValue;
4572
4623
 
4573
- export declare function tryGetDataType(type: string): InternalTypeSchema | undefined;
4624
+ export declare function tryGetDataType(type: string, profileUrl?: string): InternalTypeSchema | undefined;
4625
+
4626
+ export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
4574
4627
 
4575
4628
  export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
4576
4629
  private emitter;
@@ -425,6 +425,10 @@ export declare type CurrentContext<EventName extends FhircastResourceEventName =
425
425
  context: FhircastEventContext<EventName>[];
426
426
  };
427
427
 
428
+ export declare type DataTypesMap = {
429
+ [type: string]: InternalTypeSchema;
430
+ };
431
+
428
432
  /**
429
433
  * Decodes a base64 string.
430
434
  * Handles both browser and Node environments.
@@ -486,6 +490,7 @@ export declare class DotAtom extends InfixOperatorAtom {
486
490
  export declare interface ElementType {
487
491
  code: string;
488
492
  targetProfile?: string[];
493
+ profile?: string[];
489
494
  }
490
495
 
491
496
  export declare interface EmailPasswordLoginRequest extends BaseLoginRequest {
@@ -1121,7 +1126,7 @@ export declare class FunctionAtom implements Atom {
1121
1126
  */
1122
1127
  export declare function generateId(): string;
1123
1128
 
1124
- export declare function getAllDataTypes(): Record<string, InternalTypeSchema>;
1129
+ export declare function getAllDataTypes(): DataTypesMap;
1125
1130
 
1126
1131
  /**
1127
1132
  * Returns an array of questionnaire answers as a map by link ID.
@@ -1138,7 +1143,7 @@ export declare function getAllQuestionnaireAnswers(response: QuestionnaireRespon
1138
1143
  */
1139
1144
  export declare function getCodeBySystem(concept: CodeableConcept, system: string): string | undefined;
1140
1145
 
1141
- export declare function getDataType(type: string): InternalTypeSchema;
1146
+ export declare function getDataType(type: string, profileUrl?: string): InternalTypeSchema;
1142
1147
 
1143
1148
  /**
1144
1149
  * Returns a Date property as a Date.
@@ -1158,13 +1163,20 @@ export declare function getDisplayString(resource: Resource): string;
1158
1163
 
1159
1164
  /**
1160
1165
  * Returns an element definition by type and property name.
1161
- * Handles content references.
1162
1166
  * @param typeName - The type name.
1163
1167
  * @param propertyName - The property name.
1164
1168
  * @returns The element definition if found.
1165
1169
  */
1166
1170
  export declare function getElementDefinition(typeName: string, propertyName: string): InternalSchemaElement | undefined;
1167
1171
 
1172
+ /**
1173
+ * Returns an element definition from mapping of elements by property name.
1174
+ * @param elements - A mapping of property names to element definitions
1175
+ * @param propertyName - The property name of interest
1176
+ * @returns The element definition if found.
1177
+ */
1178
+ export declare function getElementDefinitionFromElements(elements: InternalTypeSchema['elements'], propertyName: string): InternalSchemaElement | undefined;
1179
+
1168
1180
  /**
1169
1181
  * Returns the type name for an ElementDefinition.
1170
1182
  * @param elementDefinition - The element definition.
@@ -1218,7 +1230,14 @@ export declare function getNestedProperty(value: TypedValue, key: string): (Type
1218
1230
  * @param path - The FHIR element definition path.
1219
1231
  * @returns The best guess of the display name.
1220
1232
  */
1221
- export declare function getPropertyDisplayName(path: string): string;
1233
+ export declare function getPathDisplayName(path: string): string;
1234
+
1235
+ /**
1236
+ * Return s a human friendly display name for a FHIR element property or slice name
1237
+ * @param propertyName - The FHIR element property or slice name
1238
+ * @returns The best guess of the display name.
1239
+ */
1240
+ export declare function getPropertyDisplayName(propertyName: string): string;
1222
1241
 
1223
1242
  /**
1224
1243
  * Returns all questionnaire answers as a map by link ID.
@@ -1291,6 +1310,15 @@ export declare function getStatus(outcome: OperationOutcome): number;
1291
1310
  */
1292
1311
  export declare function getTypedPropertyValue(input: TypedValue, path: string): TypedValue[] | TypedValue | undefined;
1293
1312
 
1313
+ /**
1314
+ * Returns the value of the property and the property type using a type schema.
1315
+ * @param value - The base context (FHIR resource or backbone element).
1316
+ * @param path - The property path.
1317
+ * @param element - The property element definition.
1318
+ * @returns The value of the property and the property type.
1319
+ */
1320
+ export declare function getTypedPropertyValueWithSchema(value: TypedValue['value'], path: string, element: InternalSchemaElement): TypedValue[] | TypedValue | undefined;
1321
+
1294
1322
  /**
1295
1323
  * Global schema singleton.
1296
1324
  */
@@ -1624,7 +1652,12 @@ export declare function indexSearchParameter(searchParam: SearchParameter): void
1624
1652
  */
1625
1653
  export declare function indexSearchParameterBundle(bundle: Bundle<SearchParameter>): void;
1626
1654
 
1627
- export declare function indexStructureDefinitionBundle(bundle: StructureDefinition[] | Bundle): void;
1655
+ /**
1656
+ * Parses and indexes structure definitions
1657
+ * @param bundle - Bundle or array of structure definitions to be parsed and indexed
1658
+ * @param profileUrl - (optional) URL of the profile the SDs are related to
1659
+ */
1660
+ export declare function indexStructureDefinitionBundle(bundle: StructureDefinition[] | Bundle, profileUrl?: string | undefined): void;
1628
1661
 
1629
1662
  export declare abstract class InfixOperatorAtom implements Atom {
1630
1663
  readonly operator: string;
@@ -1640,9 +1673,9 @@ export declare interface InfixParselet {
1640
1673
  parse?(parser: Parser, left: Atom, token: Token): Atom;
1641
1674
  }
1642
1675
 
1643
- export declare function inflateBaseSchema(base: BaseSchema): Record<string, InternalTypeSchema>;
1676
+ export declare function inflateBaseSchema(base: BaseSchema): DataTypesMap;
1644
1677
 
1645
- export declare function inflateElement(partial: Partial<InternalSchemaElement>): InternalSchemaElement;
1678
+ export declare function inflateElement(path: string, partial: Partial<InternalSchemaElement>): InternalSchemaElement;
1646
1679
 
1647
1680
  export declare function initFhirPathParserBuilder(): ParserBuilder;
1648
1681
 
@@ -1665,8 +1698,10 @@ export declare interface InternalSchemaElement {
1665
1698
  */
1666
1699
  export declare interface InternalTypeSchema {
1667
1700
  name: string;
1701
+ title?: string;
1668
1702
  url?: string;
1669
1703
  kind?: string;
1704
+ type?: string;
1670
1705
  description?: string;
1671
1706
  elements: Record<string, InternalSchemaElement>;
1672
1707
  constraints?: Constraint[];
@@ -1762,6 +1797,8 @@ export declare function isOperationOutcome(value: unknown): value is OperationOu
1762
1797
  */
1763
1798
  export declare function isPeriod(input: unknown): input is Period;
1764
1799
 
1800
+ export declare function isProfileLoaded(profileUrl: string): boolean;
1801
+
1765
1802
  /**
1766
1803
  * Returns true if the resource is a "ProfileResource".
1767
1804
  * @param resource - The FHIR resource.
@@ -1845,7 +1882,7 @@ export declare class LiteralAtom implements Atom {
1845
1882
  toString(): string;
1846
1883
  }
1847
1884
 
1848
- export declare function loadDataType(sd: StructureDefinition): void;
1885
+ export declare function loadDataType(sd: StructureDefinition, profileUrl?: string | undefined): void;
1849
1886
 
1850
1887
  export declare interface LoginAuthenticationResponse {
1851
1888
  readonly login: string;
@@ -1972,6 +2009,8 @@ export declare interface Marker {
1972
2009
  column: number;
1973
2010
  }
1974
2011
 
2012
+ export declare function matchDiscriminant(value: TypedValue | TypedValue[] | undefined, discriminator: SliceDiscriminator, slice: SliceDefinition, elements?: Record<string, InternalSchemaElement>): boolean;
2013
+
1975
2014
  /**
1976
2015
  * Returns true if the resource satisfies the current access policy.
1977
2016
  * @param accessPolicy - The access policy.
@@ -2537,6 +2576,14 @@ export declare class MedplumClient extends EventTarget_2 {
2537
2576
  * @returns Promise to a schema with the requested resource type.
2538
2577
  */
2539
2578
  requestSchema(resourceType: string): Promise<void>;
2579
+ /**
2580
+ * Requests the schema for a profile.
2581
+ * If the schema is already cached, the promise is resolved immediately.
2582
+ * @category Schema
2583
+ * @param profileUrl - The FHIR URL of the profile
2584
+ * @returns Promise to a schema with the requested profile.
2585
+ */
2586
+ requestProfileSchema(profileUrl: string): Promise<void>;
2540
2587
  /**
2541
2588
  * Reads resource history by resource type and ID.
2542
2589
  *
@@ -3600,6 +3647,7 @@ export declare interface MedplumInfraConfig {
3600
3647
  clamscanLoggingBucket: string;
3601
3648
  clamscanLoggingPrefix: string;
3602
3649
  skipDns?: boolean;
3650
+ hostedZoneName?: string;
3603
3651
  additionalContainers?: {
3604
3652
  name: string;
3605
3653
  image: string;
@@ -3659,6 +3707,7 @@ export declare interface MedplumSourceInfraConfig {
3659
3707
  clamscanLoggingBucket: ValueOrExternalSecret<string>;
3660
3708
  clamscanLoggingPrefix: ValueOrExternalSecret<string>;
3661
3709
  skipDns?: ValueOrExternalSecret<boolean>;
3710
+ hostedZoneName?: ValueOrExternalSecret<string>;
3662
3711
  additionalContainers?: {
3663
3712
  name: ValueOrExternalSecret<string>;
3664
3713
  image: ValueOrExternalSecret<string>;
@@ -4416,6 +4465,8 @@ export declare const sleep: (ms: number) => Promise<void>;
4416
4465
 
4417
4466
  export declare interface SliceDefinition {
4418
4467
  name: string;
4468
+ path: string;
4469
+ definition?: string;
4419
4470
  type?: ElementType[];
4420
4471
  elements: Record<string, InternalSchemaElement>;
4421
4472
  min: number;
@@ -4570,7 +4621,9 @@ export declare const tooManyRequests: OperationOutcome;
4570
4621
  */
4571
4622
  export declare function toTypedValue(value: unknown): TypedValue;
4572
4623
 
4573
- export declare function tryGetDataType(type: string): InternalTypeSchema | undefined;
4624
+ export declare function tryGetDataType(type: string, profileUrl?: string): InternalTypeSchema | undefined;
4625
+
4626
+ export declare function tryGetProfile(profileUrl: string): InternalTypeSchema | undefined;
4574
4627
 
4575
4628
  export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
4576
4629
  private emitter;