@medplum/core 2.0.29 → 2.0.31
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.
- package/dist/cjs/index.cjs +4 -4
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/index.mjs.map +3 -3
- package/dist/types/access.d.ts +35 -1
- package/dist/types/client.d.ts +16 -5
- package/dist/types/config.d.ts +1 -0
- package/dist/types/outcomes.d.ts +4 -0
- package/dist/types/schema.d.ts +0 -1
- package/dist/types/search/search.d.ts +1 -2
- package/dist/types/typeschema/types.d.ts +13 -1
- package/dist/types/utils.d.ts +8 -1
- package/package.json +1 -1
package/dist/types/access.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessPolicy, Resource, ResourceType } from '@medplum/fhirtypes';
|
|
1
|
+
import { AccessPolicy, AccessPolicyResource, Resource, ResourceType } from '@medplum/fhirtypes';
|
|
2
2
|
/**
|
|
3
3
|
* Public resource types are in the "public" project.
|
|
4
4
|
* They are available to all users.
|
|
@@ -14,6 +14,31 @@ export declare const protectedResourceTypes: string[];
|
|
|
14
14
|
* accessible to project administrators.
|
|
15
15
|
*/
|
|
16
16
|
export declare const projectAdminResourceTypes: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Interactions with a resource that can be controlled via an access policy.
|
|
19
|
+
*
|
|
20
|
+
* Codes taken from http://hl7.org/fhir/codesystem-restful-interaction.html
|
|
21
|
+
*/
|
|
22
|
+
export declare enum AccessPolicyInteraction {
|
|
23
|
+
READ = "read",
|
|
24
|
+
VREAD = "vread",
|
|
25
|
+
UPDATE = "update",
|
|
26
|
+
PATCH = "patch",
|
|
27
|
+
DELETE = "delete",
|
|
28
|
+
HISTORY = "history",
|
|
29
|
+
HISTORY_INSTANCE = "history-instance",
|
|
30
|
+
HISTORY_TYPE = "history-type",
|
|
31
|
+
HISTORY_SYSTEM = "history-system",
|
|
32
|
+
CREATE = "create",
|
|
33
|
+
SEARCH = "search",
|
|
34
|
+
SEARCH_TYPE = "search-type",
|
|
35
|
+
SEARCH_SYSTEM = "search-system",
|
|
36
|
+
SEARCH_COMPARTMENT = "search-compartment",
|
|
37
|
+
CAPABILITIES = "capabilities",
|
|
38
|
+
TRANSACTION = "transaction",
|
|
39
|
+
BATCH = "batch",
|
|
40
|
+
OPERATION = "operation"
|
|
41
|
+
}
|
|
17
42
|
/**
|
|
18
43
|
* Determines if the current user can read the specified resource type.
|
|
19
44
|
* @param accessPolicy The access policy.
|
|
@@ -44,5 +69,14 @@ export declare function canWriteResource(accessPolicy: AccessPolicy, resource: R
|
|
|
44
69
|
* @param resource The resource.
|
|
45
70
|
* @param readonlyMode True if the resource is being read.
|
|
46
71
|
* @returns True if the resource matches the access policy.
|
|
72
|
+
* @deprecated Use satisfiedAccessPolicy() instead.
|
|
47
73
|
*/
|
|
48
74
|
export declare function matchesAccessPolicy(accessPolicy: AccessPolicy, resource: Resource, readonlyMode: boolean): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Checks that there is an access policy permitting the given resource interaction, returning the matching policy object.
|
|
77
|
+
* @param resource The resource being acted upon.
|
|
78
|
+
* @param interaction The interaction being performed on the resource.
|
|
79
|
+
* @param accessPolicy The relevant access policy for the current user.
|
|
80
|
+
* @returns The satisfied access policy, or undefined if the access policy does not permit the given interaction.
|
|
81
|
+
*/
|
|
82
|
+
export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
|
package/dist/types/client.d.ts
CHANGED
|
@@ -301,6 +301,10 @@ export interface PatchOperation {
|
|
|
301
301
|
readonly path: string;
|
|
302
302
|
readonly value?: any;
|
|
303
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* Source for a FHIR Binary.
|
|
306
|
+
*/
|
|
307
|
+
export type BinarySource = string | File | Blob | Uint8Array;
|
|
304
308
|
/**
|
|
305
309
|
* Email address definition.
|
|
306
310
|
* Compatible with nodemailer Mail.Address.
|
|
@@ -1029,7 +1033,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1029
1033
|
* @param onProgress Optional callback for progress events.
|
|
1030
1034
|
* @returns The result of the create operation.
|
|
1031
1035
|
*/
|
|
1032
|
-
createAttachment(data:
|
|
1036
|
+
createAttachment(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void): Promise<Attachment>;
|
|
1033
1037
|
/**
|
|
1034
1038
|
* Creates a FHIR `Binary` resource with the provided data content.
|
|
1035
1039
|
*
|
|
@@ -1054,8 +1058,8 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1054
1058
|
* @param onProgress Optional callback for progress events.
|
|
1055
1059
|
* @returns The result of the create operation.
|
|
1056
1060
|
*/
|
|
1057
|
-
createBinary(data:
|
|
1058
|
-
uploadwithProgress(url: URL, data:
|
|
1061
|
+
createBinary(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void): Promise<Binary>;
|
|
1062
|
+
uploadwithProgress(url: URL, data: BinarySource, contentType: string, onProgress: (e: ProgressEvent) => void): Promise<any>;
|
|
1059
1063
|
/**
|
|
1060
1064
|
* Creates a PDF as a FHIR `Binary` resource based on pdfmake document definition.
|
|
1061
1065
|
*
|
|
@@ -1424,9 +1428,16 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1424
1428
|
*/
|
|
1425
1429
|
getAccessPolicy(): AccessPolicy | undefined;
|
|
1426
1430
|
/**
|
|
1427
|
-
*
|
|
1431
|
+
* Translates/normalizes a URL so that it can be directly used with `MedplumClient.fetch`.
|
|
1432
|
+
* Especially useful for translating `Binary/{id}` URLs to FHIR paths.
|
|
1433
|
+
* @param url A valid URL within the `MedplumClient` context.
|
|
1434
|
+
* @returns URL as a string that can be used with `MedplumClient.fetch`
|
|
1435
|
+
*/
|
|
1436
|
+
normalizeFetchUrl(url: URL | string): string;
|
|
1437
|
+
/**
|
|
1438
|
+
* Downloads the URL as a blob. Can accept binary URLs in the form of `Binary/{id}` as well.
|
|
1428
1439
|
* @category Read
|
|
1429
|
-
* @param url The URL to request.
|
|
1440
|
+
* @param url The URL to request. Can be a standard URL or one in the form of `Binary/{id}`.
|
|
1430
1441
|
* @param options Optional fetch request init options.
|
|
1431
1442
|
* @returns Promise to the response body as a blob.
|
|
1432
1443
|
*/
|
package/dist/types/config.d.ts
CHANGED
package/dist/types/outcomes.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OperationOutcome, OperationOutcomeIssue } from '@medplum/fhirtypes';
|
|
2
|
+
import { Constraint } from './typeschema/types';
|
|
2
3
|
export declare const allOk: OperationOutcome;
|
|
3
4
|
export declare const created: OperationOutcome;
|
|
4
5
|
export declare const notModified: OperationOutcome;
|
|
@@ -51,3 +52,6 @@ export declare function operationOutcomeToString(outcome: OperationOutcome): str
|
|
|
51
52
|
* @returns The string representation of the operation outcome issue.
|
|
52
53
|
*/
|
|
53
54
|
export declare function operationOutcomeIssueToString(issue: OperationOutcomeIssue): string;
|
|
55
|
+
export declare function createStructureIssue(expression: string, details: string): OperationOutcomeIssue;
|
|
56
|
+
export declare function createConstraintIssue(expression: string, constraint: Constraint): OperationOutcomeIssue;
|
|
57
|
+
export declare function createProcessingIssue(expression: string, message: string, err: Error, data?: Record<string, any>): OperationOutcomeIssue;
|
package/dist/types/schema.d.ts
CHANGED
|
@@ -144,4 +144,3 @@ export declare class FhirSchemaValidator<T extends Resource> {
|
|
|
144
144
|
* @param issues Output list of issues.
|
|
145
145
|
*/
|
|
146
146
|
export declare function checkForNull(value: unknown, path: string, issues: OperationOutcomeIssue[]): void;
|
|
147
|
-
export declare function createStructureIssue(expression: string, details: string): OperationOutcomeIssue;
|
|
@@ -11,13 +11,12 @@ export interface SearchRequest<T extends Resource = Resource> {
|
|
|
11
11
|
total?: 'none' | 'estimate' | 'accurate';
|
|
12
12
|
include?: IncludeTarget[];
|
|
13
13
|
revInclude?: IncludeTarget[];
|
|
14
|
+
summary?: 'true' | 'text' | 'data';
|
|
14
15
|
}
|
|
15
16
|
export interface Filter {
|
|
16
17
|
code: string;
|
|
17
18
|
operator: Operator;
|
|
18
19
|
value: string;
|
|
19
|
-
unitSystem?: string;
|
|
20
|
-
unitCode?: string;
|
|
21
20
|
}
|
|
22
21
|
export interface SortRule {
|
|
23
22
|
code: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bundle, StructureDefinition } from '@medplum/fhirtypes';
|
|
1
|
+
import { Bundle, StructureDefinition, Resource } from '@medplum/fhirtypes';
|
|
2
2
|
import { TypedValue } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Internal representation of a non-primitive FHIR type, suitable for use in resource validation
|
|
@@ -8,6 +8,8 @@ export interface InternalTypeSchema {
|
|
|
8
8
|
fields: Record<string, ElementValidator>;
|
|
9
9
|
constraints: Constraint[];
|
|
10
10
|
innerTypes: InternalTypeSchema[];
|
|
11
|
+
summaryProperties?: Set<string>;
|
|
12
|
+
mandatoryProperties?: Set<string>;
|
|
11
13
|
}
|
|
12
14
|
export interface ElementValidator {
|
|
13
15
|
min: number;
|
|
@@ -38,6 +40,7 @@ export interface SlicingRules {
|
|
|
38
40
|
}
|
|
39
41
|
export interface SliceDefinition {
|
|
40
42
|
name: string;
|
|
43
|
+
type?: ElementType[];
|
|
41
44
|
fields: Record<string, ElementValidator>;
|
|
42
45
|
min: number;
|
|
43
46
|
max: number;
|
|
@@ -56,3 +59,12 @@ export interface SliceDiscriminator {
|
|
|
56
59
|
export declare function parseStructureDefinition(sd: StructureDefinition): InternalTypeSchema;
|
|
57
60
|
export declare function loadDataTypes(bundle: Bundle<StructureDefinition>): void;
|
|
58
61
|
export declare function getDataType(type: string): InternalTypeSchema;
|
|
62
|
+
/**
|
|
63
|
+
* Construct the subset of a resource containing a minimum set of fields. The returned resource is not guaranteed
|
|
64
|
+
* to contain only the provided properties, and may contain others (e.g. `resourceType` and `id`)
|
|
65
|
+
*
|
|
66
|
+
* @param resource The resource to subset
|
|
67
|
+
* @param properties The minimum properties to include in the subset
|
|
68
|
+
* @returns The modified resource, containing the listed properties and possibly other mandatory ones
|
|
69
|
+
*/
|
|
70
|
+
export declare function subsetResource<T extends Resource>(resource: T | undefined, properties: string[]): T | undefined;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeableConcept, Extension, ObservationDefinition, ObservationDefinitionQualifiedInterval, Patient, Practitioner, QuestionnaireResponse, QuestionnaireResponseItemAnswer, Range, Reference, RelatedPerson, Resource } from '@medplum/fhirtypes';
|
|
1
|
+
import { CodeableConcept, Extension, ObservationDefinition, ObservationDefinitionQualifiedInterval, Patient, Practitioner, QuestionnaireResponse, QuestionnaireResponseItemAnswer, Range, Reference, RelatedPerson, Resource, ResourceType } from '@medplum/fhirtypes';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
@@ -28,6 +28,13 @@ export declare function getReferenceString(resource: Resource): string;
|
|
|
28
28
|
* @returns The ID portion of a reference.
|
|
29
29
|
*/
|
|
30
30
|
export declare function resolveId(reference: Reference | undefined): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Parses a reference and returns a tuple of [ResourceType, ID].
|
|
33
|
+
* @param reference A reference to a FHIR resource.
|
|
34
|
+
* @returns A tuple containing the `ResourceType` and the ID of the resource or `undefined` when `undefined` or an invalid reference is passed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseReference(reference: Reference): [ResourceType, string] | undefined;
|
|
37
|
+
export declare function parseReference(reference: undefined): undefined;
|
|
31
38
|
/**
|
|
32
39
|
* Returns true if the resource is a "ProfileResource".
|
|
33
40
|
* @param resource The FHIR resource.
|