@medplum/core 2.1.9 → 2.1.10

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.
Files changed (50) hide show
  1. package/api-extractor.json +3 -0
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/esm/index.mjs +1 -1
  5. package/dist/esm/index.mjs.map +1 -1
  6. package/dist/types.d.ts +4181 -0
  7. package/package.json +4 -4
  8. package/dist/types/access.d.ts +0 -77
  9. package/dist/types/base-schema.d.ts +0 -7
  10. package/dist/types/base64.d.ts +0 -14
  11. package/dist/types/bundle.d.ts +0 -32
  12. package/dist/types/cache.d.ts +0 -36
  13. package/dist/types/client.d.ts +0 -1728
  14. package/dist/types/config.d.ts +0 -127
  15. package/dist/types/constants.d.ts +0 -6
  16. package/dist/types/contenttype.d.ts +0 -18
  17. package/dist/types/crypto.d.ts +0 -19
  18. package/dist/types/eventtarget.d.ts +0 -18
  19. package/dist/types/fhircast/index.d.ts +0 -115
  20. package/dist/types/fhircast/test-utils.d.ts +0 -2
  21. package/dist/types/fhirlexer/parse.d.ts +0 -55
  22. package/dist/types/fhirlexer/tokenize.d.ts +0 -45
  23. package/dist/types/fhirmapper/parse.d.ts +0 -7
  24. package/dist/types/fhirmapper/tokenize.d.ts +0 -2
  25. package/dist/types/fhirpath/atoms.d.ts +0 -139
  26. package/dist/types/fhirpath/date.d.ts +0 -1
  27. package/dist/types/fhirpath/functions.d.ts +0 -4
  28. package/dist/types/fhirpath/parse.d.ts +0 -65
  29. package/dist/types/fhirpath/tokenize.d.ts +0 -4
  30. package/dist/types/fhirpath/utils.d.ts +0 -96
  31. package/dist/types/filter/parse.d.ts +0 -7
  32. package/dist/types/filter/tokenize.d.ts +0 -2
  33. package/dist/types/filter/types.d.ts +0 -32
  34. package/dist/types/format.d.ts +0 -120
  35. package/dist/types/hl7.d.ts +0 -242
  36. package/dist/types/index.d.ts +0 -34
  37. package/dist/types/jwt.d.ts +0 -18
  38. package/dist/types/outcomes.d.ts +0 -58
  39. package/dist/types/readablepromise.d.ts +0 -51
  40. package/dist/types/schema.d.ts +0 -43
  41. package/dist/types/search/details.d.ts +0 -37
  42. package/dist/types/search/match.d.ts +0 -9
  43. package/dist/types/search/search.d.ts +0 -102
  44. package/dist/types/sftp.d.ts +0 -9
  45. package/dist/types/storage.d.ts +0 -55
  46. package/dist/types/types.d.ts +0 -203
  47. package/dist/types/typeschema/crawler.d.ts +0 -12
  48. package/dist/types/typeschema/types.d.ts +0 -92
  49. package/dist/types/typeschema/validation.d.ts +0 -25
  50. package/dist/types/utils.d.ts +0 -326
@@ -1,43 +0,0 @@
1
- import { OperationOutcomeIssue } from '@medplum/fhirtypes';
2
- /**
3
- * Validates that the given string is a valid FHIR resource type.
4
- * On success, silently returns void.
5
- * On failure, throws an OperationOutcomeError.
6
- *
7
- * ```ts
8
- * validateResourceType('Patient'); // nothing
9
- * validateResourceType('XYZ'); // throws OperationOutcomeError
10
- * ```
11
- *
12
- * Note that this depends on globalSchema, which is populated by the StructureDefinition loader.
13
- *
14
- * In a server context, you can load all schema definitions:
15
- *
16
- * ```ts
17
- * import { indexStructureDefinitionBundle } from '@medplum/core';
18
- * import { readJson } from '@medplum/definitions';
19
- * import { Bundle } from '@medplum/fhirtypes';
20
- *
21
- * indexStructureDefinitionBundle(readJson('fhir/r4/profiles-resources.json') as Bundle);
22
- * ```
23
- *
24
- * In a client context, you can load the schema definitions using MedplumClient:
25
- *
26
- * ```ts
27
- * import { MedplumClient } from '@medplum/core';
28
- *
29
- * const medplum = new MedplumClient();
30
- * await medplum.requestSchema('Patient');
31
- * ```
32
- * @param resourceType The candidate resource type string.
33
- */
34
- export declare function validateResourceType(resourceType: string): void;
35
- /**
36
- * Recursively checks for null values in an object.
37
- *
38
- * Note that "null" is a special value in JSON that is not allowed in FHIR.
39
- * @param value Input value of any type.
40
- * @param path Path string to the value for OperationOutcome.
41
- * @param issues Output list of issues.
42
- */
43
- export declare function checkForNull(value: unknown, path: string, issues: OperationOutcomeIssue[]): void;
@@ -1,37 +0,0 @@
1
- import { SearchParameter } from '@medplum/fhirtypes';
2
- import { Atom } from '../fhirlexer/parse';
3
- import { InternalSchemaElement } from '../typeschema/types';
4
- export declare enum SearchParameterType {
5
- BOOLEAN = "BOOLEAN",
6
- NUMBER = "NUMBER",
7
- QUANTITY = "QUANTITY",
8
- TEXT = "TEXT",
9
- REFERENCE = "REFERENCE",
10
- CANONICAL = "CANONICAL",
11
- DATE = "DATE",
12
- DATETIME = "DATETIME",
13
- PERIOD = "PERIOD",
14
- UUID = "UUID"
15
- }
16
- export interface SearchParameterDetails {
17
- readonly columnName: string;
18
- readonly type: SearchParameterType;
19
- readonly elementDefinitions?: InternalSchemaElement[];
20
- readonly array?: boolean;
21
- }
22
- /**
23
- * Returns the type details of a SearchParameter.
24
- *
25
- * The SearchParameter resource has a "type" parameter, but that is missing some critical information.
26
- *
27
- * For example:
28
- * 1) The "date" type includes "date", "datetime", and "period".
29
- * 2) The "token" type includes enums and booleans.
30
- * 3) Arrays/multiple values are not reflected at all.
31
- * @param resourceType The root resource type.
32
- * @param searchParam The search parameter.
33
- * @returns The search parameter type details.
34
- */
35
- export declare function getSearchParameterDetails(resourceType: string, searchParam: SearchParameter): SearchParameterDetails;
36
- export declare function getExpressionsForResourceType(resourceType: string, expression: string): Atom[];
37
- export declare function getExpressionForResourceType(resourceType: string, expression: string): string | undefined;
@@ -1,9 +0,0 @@
1
- import { Resource } from '@medplum/fhirtypes';
2
- import { SearchRequest } from './search';
3
- /**
4
- * Determines if the resource matches the search request.
5
- * @param resource The resource that was created or updated.
6
- * @param searchRequest The subscription criteria as a search request.
7
- * @returns True if the resource satisfies the search request.
8
- */
9
- export declare function matchesSearchRequest(resource: Resource, searchRequest: SearchRequest): boolean;
@@ -1,102 +0,0 @@
1
- import { Resource } from '@medplum/fhirtypes';
2
- import { TypedValue } from '../types';
3
- export declare const DEFAULT_SEARCH_COUNT = 20;
4
- export interface SearchRequest<T extends Resource = Resource> {
5
- readonly resourceType: T['resourceType'];
6
- filters?: Filter[];
7
- sortRules?: SortRule[];
8
- offset?: number;
9
- count?: number;
10
- fields?: string[];
11
- name?: string;
12
- total?: 'none' | 'estimate' | 'accurate';
13
- include?: IncludeTarget[];
14
- revInclude?: IncludeTarget[];
15
- summary?: 'true' | 'text' | 'data';
16
- }
17
- export interface Filter {
18
- code: string;
19
- operator: Operator;
20
- value: string;
21
- }
22
- export interface SortRule {
23
- code: string;
24
- descending?: boolean;
25
- }
26
- export interface IncludeTarget {
27
- resourceType: string;
28
- searchParam: string;
29
- targetType?: string;
30
- modifier?: string;
31
- }
32
- /**
33
- * Search operators.
34
- * These operators represent "modifiers" and "prefixes" in FHIR search.
35
- * See: https://www.hl7.org/fhir/search.html
36
- */
37
- export declare enum Operator {
38
- EQUALS = "eq",
39
- NOT_EQUALS = "ne",
40
- GREATER_THAN = "gt",
41
- LESS_THAN = "lt",
42
- GREATER_THAN_OR_EQUALS = "ge",
43
- LESS_THAN_OR_EQUALS = "le",
44
- STARTS_AFTER = "sa",
45
- ENDS_BEFORE = "eb",
46
- APPROXIMATELY = "ap",
47
- CONTAINS = "contains",
48
- EXACT = "exact",
49
- TEXT = "text",
50
- NOT = "not",
51
- ABOVE = "above",
52
- BELOW = "below",
53
- IN = "in",
54
- NOT_IN = "not-in",
55
- OF_TYPE = "of-type",
56
- MISSING = "missing",
57
- IDENTIFIER = "identifier",
58
- ITERATE = "iterate"
59
- }
60
- /**
61
- * Parses a search URL into a search request.
62
- * @param resourceType The FHIR resource type.
63
- * @param query The collection of query string parameters.
64
- * @returns A parsed SearchRequest.
65
- */
66
- export declare function parseSearchRequest<T extends Resource = Resource>(resourceType: T['resourceType'], query: Record<string, string[] | string | undefined>): SearchRequest<T>;
67
- /**
68
- * Parses a search URL into a search request.
69
- * @param url The search URL.
70
- * @returns A parsed SearchRequest.
71
- */
72
- export declare function parseSearchUrl<T extends Resource = Resource>(url: URL): SearchRequest<T>;
73
- /**
74
- * Parses a URL string into a SearchRequest.
75
- * @param url The URL to parse.
76
- * @returns Parsed search definition.
77
- */
78
- export declare function parseSearchDefinition<T extends Resource = Resource>(url: string): SearchRequest<T>;
79
- /**
80
- * Parses a FHIR criteria string into a SearchRequest.
81
- * FHIR criteria strings are found on resources such as Subscription.
82
- * @param criteria The FHIR criteria string.
83
- * @returns Parsed search definition.
84
- */
85
- export declare function parseCriteriaAsSearchRequest(criteria: string): SearchRequest;
86
- /**
87
- * Parses an extended FHIR search criteria string (i.e. application/x-fhir-query), evaluating
88
- * any embedded FHIRPath subexpressions (e.g. `{{ %patient.id }}`) with the provided variables.
89
- *
90
- * @see https://hl7.org/fhir/fhir-xquery.html
91
- * @param query The X-Fhir-Query string to parse
92
- * @param variables Values to pass into embedded FHIRPath expressions
93
- * @returns The parsed search request
94
- */
95
- export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>): SearchRequest;
96
- /**
97
- * Formats a search definition object into a query string.
98
- * Note: The return value does not include the resource type.
99
- * @param definition The search definition.
100
- * @returns Formatted URL.
101
- */
102
- export declare function formatSearchQuery(definition: SearchRequest): string;
@@ -1,9 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Readable } from 'stream';
4
- /**
5
- * Reads data from a Readable stream and returns a Promise that resolves with a Buffer containing all the data.
6
- * @param stream - The Readable stream to read from.
7
- * @returns A Promise that resolves with a Buffer containing all the data from the Readable stream.
8
- */
9
- export declare function streamToBuffer(stream: Readable): Promise<Buffer>;
@@ -1,55 +0,0 @@
1
- /**
2
- * The ClientStorage class is a utility class for storing strings and objects.
3
- *
4
- * When using MedplumClient in the browser, it will be backed by browser localStorage.
5
- *
6
- * When Using MedplumClient in the server, it will be backed by the MemoryStorage class. For example, the Medplum CLI uses `FileSystemStorage`.
7
- */
8
- export declare class ClientStorage {
9
- private readonly storage;
10
- constructor();
11
- clear(): void;
12
- getString(key: string): string | undefined;
13
- setString(key: string, value: string | undefined): void;
14
- getObject<T>(key: string): T | undefined;
15
- setObject<T>(key: string, value: T): void;
16
- }
17
- /**
18
- * The MemoryStorage class is a minimal in-memory implementation of the Storage interface.
19
- */
20
- export declare class MemoryStorage implements Storage {
21
- private data;
22
- constructor();
23
- /**
24
- * Returns the number of key/value pairs.
25
- * @returns The number of key/value pairs.
26
- */
27
- get length(): number;
28
- /**
29
- * Removes all key/value pairs, if there are any.
30
- */
31
- clear(): void;
32
- /**
33
- * Returns the current value associated with the given key, or null if the given key does not exist.
34
- * @param key The specified storage key.
35
- * @returns The current value associated with the given key, or null if the given key does not exist.
36
- */
37
- getItem(key: string): string | null;
38
- /**
39
- * Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
40
- * @param key The storage key.
41
- * @param value The new value.
42
- */
43
- setItem(key: string, value: string | null): void;
44
- /**
45
- * Removes the key/value pair with the given key, if a key/value pair with the given key exists.
46
- * @param key The storage key.
47
- */
48
- removeItem(key: string): void;
49
- /**
50
- * Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
51
- * @param index The numeric index.
52
- * @returns The nth key.
53
- */
54
- key(index: number): string | null;
55
- }
@@ -1,203 +0,0 @@
1
- import { Bundle, ElementDefinition, Reference, Resource, ResourceType, SearchParameter } from '@medplum/fhirtypes';
2
- import { SearchParameterDetails } from './search/details';
3
- import { InternalSchemaElement, InternalTypeSchema } from './typeschema/types';
4
- export type TypeName<T> = T extends string ? 'string' : T extends number ? 'number' : T extends boolean ? 'boolean' : T extends undefined ? 'undefined' : 'object';
5
- export interface TypedValue {
6
- readonly type: string;
7
- readonly value: any;
8
- }
9
- /**
10
- * List of property types.
11
- * http://www.hl7.org/fhir/valueset-defined-types.html
12
- * The list here includes additions found from StructureDefinition resources.
13
- */
14
- export declare const PropertyType: {
15
- Address: string;
16
- Age: string;
17
- Annotation: string;
18
- Attachment: string;
19
- BackboneElement: string;
20
- CodeableConcept: string;
21
- Coding: string;
22
- ContactDetail: string;
23
- ContactPoint: string;
24
- Contributor: string;
25
- Count: string;
26
- DataRequirement: string;
27
- Distance: string;
28
- Dosage: string;
29
- Duration: string;
30
- Expression: string;
31
- Extension: string;
32
- HumanName: string;
33
- Identifier: string;
34
- MarketingStatus: string;
35
- Meta: string;
36
- Money: string;
37
- Narrative: string;
38
- ParameterDefinition: string;
39
- Period: string;
40
- Population: string;
41
- ProdCharacteristic: string;
42
- ProductShelfLife: string;
43
- Quantity: string;
44
- Range: string;
45
- Ratio: string;
46
- Reference: string;
47
- RelatedArtifact: string;
48
- SampledData: string;
49
- Signature: string;
50
- SubstanceAmount: string;
51
- SystemString: string;
52
- Timing: string;
53
- TriggerDefinition: string;
54
- UsageContext: string;
55
- base64Binary: string;
56
- boolean: string;
57
- canonical: string;
58
- code: string;
59
- date: string;
60
- dateTime: string;
61
- decimal: string;
62
- id: string;
63
- instant: string;
64
- integer: string;
65
- markdown: string;
66
- oid: string;
67
- positiveInt: string;
68
- string: string;
69
- time: string;
70
- unsignedInt: string;
71
- uri: string;
72
- url: string;
73
- uuid: string;
74
- };
75
- /**
76
- * An IndexedStructureDefinition is a lookup-optimized version of a StructureDefinition.
77
- *
78
- * StructureDefinition resources contain schema information for other resource types.
79
- * These schemas can be used to automatically generate user interface elements for
80
- * resources.
81
- *
82
- * However, a StructureDefinition resource is not optimized for realtime lookups. All
83
- * resource types, sub types, and property definitions are stored in a flat array of
84
- * ElementDefinition objects. Therefore, to lookup the schema for a property (i.e., "Patient.name")
85
- * requires a linear scan of all ElementDefinition objects
86
- *
87
- * A StructureDefinition resource contains information about one or more types.
88
- * For example, the "Patient" StructureDefinition includes "Patient", "Patient_Contact",
89
- * "Patient_Communication", and "Patient_Link". This is inefficient.
90
- *
91
- * Instead, we create an indexed version of the StructureDefinition, called IndexedStructureDefinition.
92
- * In an IndexedStructureDefinition, retrieving a property definition is a hashtable lookup.
93
- *
94
- * The hierarchy is:
95
- * IndexedStructureDefinition - top level for one resource type
96
- * TypeSchema - one per resource type and all contained BackboneElements
97
- * PropertySchema - one per property/field
98
- */
99
- export interface IndexedStructureDefinition {
100
- types: {
101
- [resourceType: string]: TypeInfo;
102
- };
103
- }
104
- /**
105
- * An indexed TypeSchema.
106
- *
107
- * Example: The IndexedStructureDefinition for "Patient" would include the following TypeSchemas:
108
- * 1) Patient
109
- * 2) Patient_Contact
110
- * 3) Patient_Communication
111
- * 4) Patient_Link
112
- */
113
- export interface TypeInfo {
114
- searchParams?: {
115
- [code: string]: SearchParameter;
116
- };
117
- searchParamsDetails?: {
118
- [code: string]: SearchParameterDetails;
119
- };
120
- }
121
- /**
122
- * Indexes a bundle of SearchParameter resources for faster lookup.
123
- * @param bundle A FHIR bundle SearchParameter resources.
124
- * @see {@link IndexedStructureDefinition} for more details on indexed StructureDefinitions.
125
- */
126
- export declare function indexSearchParameterBundle(bundle: Bundle<SearchParameter>): void;
127
- /**
128
- * Indexes a SearchParameter resource for fast lookup.
129
- * Indexes by SearchParameter.code, which is the query string parameter name.
130
- * @param searchParam The SearchParameter resource.
131
- * @see {@link IndexedStructureDefinition} for more details on indexed StructureDefinitions.
132
- */
133
- export declare function indexSearchParameter(searchParam: SearchParameter): void;
134
- /**
135
- * Returns the type name for an ElementDefinition.
136
- * @param elementDefinition The element definition.
137
- * @returns The Medplum type name.
138
- */
139
- export declare function getElementDefinitionTypeName(elementDefinition: ElementDefinition): string;
140
- export declare function buildTypeName(components: string[]): string;
141
- /**
142
- * Returns true if the type schema is a non-abstract FHIR resource.
143
- * @param typeSchema The type schema to check.
144
- * @returns True if the type schema is a non-abstract FHIR resource.
145
- */
146
- export declare function isResourceTypeSchema(typeSchema: InternalTypeSchema): boolean;
147
- /**
148
- * Returns an array of all resource types.
149
- * Note that this is based on globalSchema, and will only return resource types that are currently in memory.
150
- * @returns An array of all resource types.
151
- */
152
- export declare function getResourceTypes(): ResourceType[];
153
- /**
154
- * Returns the search parameters for the resource type indexed by search code.
155
- * @param resourceType The resource type.
156
- * @returns The search parameters for the resource type indexed by search code.
157
- */
158
- export declare function getSearchParameters(resourceType: string): Record<string, SearchParameter> | undefined;
159
- /**
160
- * Returns a search parameter for a resource type by search code.
161
- * @param resourceType The FHIR resource type.
162
- * @param code The search parameter code.
163
- * @returns The search parameter if found, otherwise undefined.
164
- */
165
- export declare function getSearchParameter(resourceType: string, code: string): SearchParameter | undefined;
166
- /**
167
- * Returns a human friendly display name for a FHIR element definition path.
168
- * @param path The FHIR element definition path.
169
- * @returns The best guess of the display name.
170
- */
171
- export declare function getPropertyDisplayName(path: string): string;
172
- /**
173
- * Returns an element definition by type and property name.
174
- * Handles content references.
175
- * @param typeName The type name.
176
- * @param propertyName The property name.
177
- * @returns The element definition if found.
178
- */
179
- export declare function getElementDefinition(typeName: string, propertyName: string): InternalSchemaElement | undefined;
180
- /**
181
- * Typeguard to validate that an object is a FHIR resource
182
- * @param value The object to check
183
- * @returns True if the input is of type 'object' and contains property 'resourceType'
184
- */
185
- export declare function isResource(value: unknown): value is Resource;
186
- /**
187
- * Typeguard to validate that an object is a FHIR resource
188
- * @param value The object to check
189
- * @returns True if the input is of type 'object' and contains property 'reference'
190
- */
191
- export declare function isReference(value: unknown): value is Reference & {
192
- reference: string;
193
- };
194
- /**
195
- * Global schema singleton.
196
- */
197
- export declare const globalSchema: IndexedStructureDefinition;
198
- /**
199
- * Output the string representation of a value, suitable for use as part of a search query.
200
- * @param v The value to format as a string
201
- * @returns The stringified value
202
- */
203
- export declare function stringifyTypedValue(v: TypedValue): string;
@@ -1,12 +0,0 @@
1
- import { Resource } from '@medplum/fhirtypes';
2
- import { TypedValue } from '../types';
3
- import { InternalTypeSchema } from './types';
4
- export interface ResourceVisitor {
5
- onEnterObject?: (path: string, value: TypedValue, schema: InternalTypeSchema) => void;
6
- onExitObject?: (path: string, value: TypedValue, schema: InternalTypeSchema) => void;
7
- onEnterResource?: (path: string, value: TypedValue, schema: InternalTypeSchema) => void;
8
- onExitResource?: (path: string, value: TypedValue, schema: InternalTypeSchema) => void;
9
- visitProperty?: (parent: TypedValue, key: string, path: string, propertyValues: (TypedValue | TypedValue[] | undefined)[], schema: InternalTypeSchema) => void;
10
- }
11
- export declare function crawlResource(resource: Resource, visitor: ResourceVisitor, schema?: InternalTypeSchema, initialPath?: string): void;
12
- export declare function getNestedProperty(value: TypedValue, key: string): (TypedValue | TypedValue[] | undefined)[];
@@ -1,92 +0,0 @@
1
- import { Bundle, ElementDefinitionBinding, Resource, StructureDefinition } from '@medplum/fhirtypes';
2
- import { TypedValue } from '../types';
3
- /**
4
- * Internal representation of a non-primitive FHIR type, suitable for use in resource validation
5
- */
6
- export interface InternalTypeSchema {
7
- name: string;
8
- url?: string;
9
- kind?: string;
10
- description?: string;
11
- elements: Record<string, InternalSchemaElement>;
12
- constraints?: Constraint[];
13
- parentType?: InternalTypeSchema;
14
- innerTypes: InternalTypeSchema[];
15
- summaryProperties?: Set<string>;
16
- mandatoryProperties?: Set<string>;
17
- }
18
- export interface InternalSchemaElement {
19
- description: string;
20
- path: string;
21
- min: number;
22
- max: number;
23
- isArray?: boolean;
24
- constraints?: Constraint[];
25
- type: ElementType[];
26
- slicing?: SlicingRules;
27
- fixed?: TypedValue;
28
- pattern?: TypedValue;
29
- binding?: ElementDefinitionBinding;
30
- }
31
- export interface ElementType {
32
- code: string;
33
- targetProfile?: string[];
34
- }
35
- export interface Constraint {
36
- key: string;
37
- severity: 'error' | 'warning';
38
- expression: string;
39
- description: string;
40
- }
41
- export interface SlicingRules {
42
- discriminator: SliceDiscriminator[];
43
- ordered: boolean;
44
- rule?: 'open' | 'closed' | 'openAtEnd';
45
- slices: SliceDefinition[];
46
- }
47
- export interface SliceDefinition {
48
- name: string;
49
- type?: ElementType[];
50
- elements: Record<string, InternalSchemaElement>;
51
- min: number;
52
- max: number;
53
- }
54
- export interface SliceDiscriminator {
55
- path: string;
56
- type: string;
57
- }
58
- /**
59
- * Parses a StructureDefinition resource into an internal schema better suited for
60
- * programmatic validation and usage in internal systems
61
- * @param sd The StructureDefinition resource to parse
62
- * @returns The parsed schema for the given resource type
63
- * @experimental
64
- */
65
- export declare function parseStructureDefinition(sd: StructureDefinition): InternalTypeSchema;
66
- export declare function indexStructureDefinitionBundle(bundle: StructureDefinition[] | Bundle): void;
67
- export declare function loadDataType(sd: StructureDefinition): void;
68
- export declare function getAllDataTypes(): Record<string, InternalTypeSchema>;
69
- export declare function isDataTypeLoaded(type: string): boolean;
70
- export declare function tryGetDataType(type: string): InternalTypeSchema | undefined;
71
- export declare function getDataType(type: string): InternalTypeSchema;
72
- /**
73
- * Returns true if the given string is a valid FHIR resource type.
74
- *
75
- * ```ts
76
- * isResourceType('Patient'); // true
77
- * isResourceType('XYZ'); // false
78
- * ```
79
- *
80
- * @param resourceType The candidate resource type string.
81
- * @returns True if the resource type is a valid FHIR resource type.
82
- */
83
- export declare function isResourceType(resourceType: string): boolean;
84
- /**
85
- * Construct the subset of a resource containing a minimum set of fields. The returned resource is not guaranteed
86
- * to contain only the provided properties, and may contain others (e.g. `resourceType` and `id`)
87
- *
88
- * @param resource The resource to subset
89
- * @param properties The minimum properties to include in the subset
90
- * @returns The modified resource, containing the listed properties and possibly other mandatory ones
91
- */
92
- export declare function subsetResource<T extends Resource>(resource: T | undefined, properties: string[]): T | undefined;
@@ -1,25 +0,0 @@
1
- import { Resource, StructureDefinition } from '@medplum/fhirtypes';
2
- export declare const fhirTypeToJsType: {
3
- readonly base64Binary: "string";
4
- readonly boolean: "boolean";
5
- readonly canonical: "string";
6
- readonly code: "string";
7
- readonly date: "string";
8
- readonly dateTime: "string";
9
- readonly decimal: "number";
10
- readonly id: "string";
11
- readonly instant: "string";
12
- readonly integer: "number";
13
- readonly markdown: "string";
14
- readonly oid: "string";
15
- readonly positiveInt: "number";
16
- readonly string: "string";
17
- readonly time: "string";
18
- readonly unsignedInt: "number";
19
- readonly uri: "string";
20
- readonly url: "string";
21
- readonly uuid: "string";
22
- readonly xhtml: "string";
23
- readonly 'http://hl7.org/fhirpath/System.String': "string";
24
- };
25
- export declare function validateResource(resource: Resource, profile?: StructureDefinition): void;