@medplum/core 2.0.21 → 2.0.22
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 +380 -288
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/esm/client.mjs +132 -102
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/crypto.mjs +3 -1
- package/dist/esm/crypto.mjs.map +1 -1
- package/dist/esm/fhirpath/functions.mjs +179 -129
- package/dist/esm/fhirpath/functions.mjs.map +1 -1
- package/dist/esm/format.mjs +6 -4
- package/dist/esm/format.mjs.map +1 -1
- package/dist/esm/hl7.mjs +1 -1
- package/dist/esm/hl7.mjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/jwt.mjs +4 -2
- package/dist/esm/jwt.mjs.map +1 -1
- package/dist/esm/schema.mjs +4 -10
- package/dist/esm/schema.mjs.map +1 -1
- package/dist/esm/search/details.mjs +0 -1
- package/dist/esm/search/details.mjs.map +1 -1
- package/dist/esm/search/match.mjs +1 -0
- package/dist/esm/search/match.mjs.map +1 -1
- package/dist/esm/search/search.mjs +1 -1
- package/dist/esm/search/search.mjs.map +1 -1
- package/dist/esm/storage.mjs +8 -0
- package/dist/esm/storage.mjs.map +1 -1
- package/dist/esm/types.mjs +1 -0
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/utils.mjs +8 -7
- package/dist/esm/utils.mjs.map +1 -1
- package/dist/types/client.d.ts +74 -64
- package/dist/types/crypto.d.ts +3 -1
- package/dist/types/hl7.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/jwt.d.ts +2 -1
- package/dist/types/schema.d.ts +4 -10
- package/dist/types/search/details.d.ts +0 -1
- package/dist/types/search/search.d.ts +1 -1
- package/dist/types/storage.d.ts +8 -0
- package/dist/types/typeschema/types.d.ts +0 -1
- package/dist/types/utils.d.ts +4 -4
- package/package.json +1 -1
package/dist/types/client.d.ts
CHANGED
|
@@ -392,7 +392,6 @@ export declare enum OAuthTokenType {
|
|
|
392
392
|
* <head>
|
|
393
393
|
* <meta name="algolia:pageRank" content="100" />
|
|
394
394
|
* </head>
|
|
395
|
-
|
|
396
395
|
*/
|
|
397
396
|
export declare class MedplumClient extends EventTarget {
|
|
398
397
|
private readonly fetch;
|
|
@@ -461,7 +460,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
461
460
|
* This is a lower level method for custom requests.
|
|
462
461
|
* For common operations, we recommend using higher level methods
|
|
463
462
|
* such as `readResource()`, `search()`, etc.
|
|
464
|
-
*
|
|
465
463
|
* @category HTTP
|
|
466
464
|
* @param url The target URL.
|
|
467
465
|
* @param options Optional fetch options.
|
|
@@ -474,7 +472,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
474
472
|
* This is a lower level method for custom requests.
|
|
475
473
|
* For common operations, we recommend using higher level methods
|
|
476
474
|
* such as `createResource()`.
|
|
477
|
-
*
|
|
478
475
|
* @category HTTP
|
|
479
476
|
* @param url The target URL.
|
|
480
477
|
* @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
|
|
@@ -489,7 +486,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
489
486
|
* This is a lower level method for custom requests.
|
|
490
487
|
* For common operations, we recommend using higher level methods
|
|
491
488
|
* such as `updateResource()`.
|
|
492
|
-
*
|
|
493
489
|
* @category HTTP
|
|
494
490
|
* @param url The target URL.
|
|
495
491
|
* @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
|
|
@@ -504,7 +500,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
504
500
|
* This is a lower level method for custom requests.
|
|
505
501
|
* For common operations, we recommend using higher level methods
|
|
506
502
|
* such as `patchResource()`.
|
|
507
|
-
*
|
|
508
503
|
* @category HTTP
|
|
509
504
|
* @param url The target URL.
|
|
510
505
|
* @param operations Array of JSONPatch operations.
|
|
@@ -519,7 +514,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
519
514
|
* This is a lower level method for custom requests.
|
|
520
515
|
* For common operations, we recommend using higher level methods
|
|
521
516
|
* such as `deleteResource()`.
|
|
522
|
-
*
|
|
523
517
|
* @category HTTP
|
|
524
518
|
* @param url The target URL.
|
|
525
519
|
* @param options Optional fetch options.
|
|
@@ -532,46 +526,48 @@ export declare class MedplumClient extends EventTarget {
|
|
|
532
526
|
* This method is part of the two different user registration flows:
|
|
533
527
|
* 1) New Practitioner and new Project
|
|
534
528
|
* 2) New Patient registration
|
|
535
|
-
*
|
|
536
529
|
* @category Authentication
|
|
537
530
|
* @param newUserRequest Register request including email and password.
|
|
531
|
+
* @param options Optional fetch options.
|
|
538
532
|
* @returns Promise to the authentication response.
|
|
539
533
|
*/
|
|
540
|
-
startNewUser(newUserRequest: NewUserRequest): Promise<LoginAuthenticationResponse>;
|
|
534
|
+
startNewUser(newUserRequest: NewUserRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
541
535
|
/**
|
|
542
536
|
* Initiates a new project flow.
|
|
543
537
|
*
|
|
544
538
|
* This requires a partial login from `startNewUser` or `startNewGoogleUser`.
|
|
545
|
-
*
|
|
546
539
|
* @param newProjectRequest Register request including email and password.
|
|
540
|
+
* @param options Optional fetch options.
|
|
547
541
|
* @returns Promise to the authentication response.
|
|
548
542
|
*/
|
|
549
|
-
startNewProject(newProjectRequest: NewProjectRequest): Promise<LoginAuthenticationResponse>;
|
|
543
|
+
startNewProject(newProjectRequest: NewProjectRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
550
544
|
/**
|
|
551
545
|
* Initiates a new patient flow.
|
|
552
546
|
*
|
|
553
547
|
* This requires a partial login from `startNewUser` or `startNewGoogleUser`.
|
|
554
|
-
*
|
|
555
548
|
* @param newPatientRequest Register request including email and password.
|
|
549
|
+
* @param options Optional fetch options.
|
|
556
550
|
* @returns Promise to the authentication response.
|
|
557
551
|
*/
|
|
558
|
-
startNewPatient(newPatientRequest: NewPatientRequest): Promise<LoginAuthenticationResponse>;
|
|
552
|
+
startNewPatient(newPatientRequest: NewPatientRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
559
553
|
/**
|
|
560
554
|
* Initiates a user login flow.
|
|
561
555
|
* @category Authentication
|
|
562
556
|
* @param loginRequest Login request including email and password.
|
|
557
|
+
* @param options Optional fetch options.
|
|
563
558
|
* @returns Promise to the authentication response.
|
|
564
559
|
*/
|
|
565
|
-
startLogin(loginRequest: EmailPasswordLoginRequest): Promise<LoginAuthenticationResponse>;
|
|
560
|
+
startLogin(loginRequest: EmailPasswordLoginRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
566
561
|
/**
|
|
567
562
|
* Tries to sign in with Google authentication.
|
|
568
563
|
* The response parameter is the result of a Google authentication.
|
|
569
564
|
* See: https://developers.google.com/identity/gsi/web/guides/handle-credential-responses-js-functions
|
|
570
565
|
* @category Authentication
|
|
571
566
|
* @param loginRequest Login request including Google credential response.
|
|
567
|
+
* @param options Optional fetch options.
|
|
572
568
|
* @returns Promise to the authentication response.
|
|
573
569
|
*/
|
|
574
|
-
startGoogleLogin(loginRequest: GoogleLoginRequest): Promise<LoginAuthenticationResponse>;
|
|
570
|
+
startGoogleLogin(loginRequest: GoogleLoginRequest, options?: RequestInit): Promise<LoginAuthenticationResponse>;
|
|
575
571
|
/**
|
|
576
572
|
* Returns the PKCE code challenge and method.
|
|
577
573
|
* If the login request already includes a code challenge, it is returned.
|
|
@@ -593,6 +589,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
593
589
|
* This may result in navigating away to the sign in page.
|
|
594
590
|
* @category Authentication
|
|
595
591
|
* @param loginParams Optional login parameters.
|
|
592
|
+
* @returns The user profile resource if available.
|
|
596
593
|
*/
|
|
597
594
|
signInWithRedirect(loginParams?: Partial<BaseLoginRequest>): Promise<ProfileResource | void>;
|
|
598
595
|
/**
|
|
@@ -614,6 +611,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
614
611
|
* Exchange an external access token for a Medplum access token.
|
|
615
612
|
* @param token The access token that was generated by the external identity provider.
|
|
616
613
|
* @param clientId The ID of the `ClientApplication` in your Medplum project that will be making the exchange request.
|
|
614
|
+
* @returns The user profile resource.
|
|
617
615
|
* @category Authentication
|
|
618
616
|
*/
|
|
619
617
|
exchangeExternalAccessToken(token: string, clientId?: string): Promise<ProfileResource>;
|
|
@@ -685,7 +683,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
685
683
|
* ```
|
|
686
684
|
*
|
|
687
685
|
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
688
|
-
*
|
|
689
686
|
* @category Search
|
|
690
687
|
* @param resourceType The FHIR resource type.
|
|
691
688
|
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
@@ -708,7 +705,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
708
705
|
* The return value is the resource, if available; otherwise, undefined.
|
|
709
706
|
*
|
|
710
707
|
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
711
|
-
*
|
|
712
708
|
* @category Search
|
|
713
709
|
* @param resourceType The FHIR resource type.
|
|
714
710
|
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
@@ -731,7 +727,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
731
727
|
* The return value is an array of resources.
|
|
732
728
|
*
|
|
733
729
|
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
734
|
-
*
|
|
735
730
|
* @category Search
|
|
736
731
|
* @param resourceType The FHIR resource type.
|
|
737
732
|
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
@@ -753,18 +748,16 @@ export declare class MedplumClient extends EventTarget {
|
|
|
753
748
|
* }
|
|
754
749
|
* }
|
|
755
750
|
* ```
|
|
756
|
-
*
|
|
757
751
|
* @category Search
|
|
758
752
|
* @param resourceType The FHIR resource type.
|
|
759
753
|
* @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
|
|
760
754
|
* @param options Optional fetch options.
|
|
761
|
-
* @
|
|
755
|
+
* @yields An async generator, where each result is an array of resources for each page.
|
|
762
756
|
*/
|
|
763
757
|
searchResourcePages<K extends ResourceType>(resourceType: K, query?: QueryTypes, options?: RequestInit): AsyncGenerator<ExtractResource<K>[]>;
|
|
764
758
|
/**
|
|
765
759
|
* Searches a ValueSet resource using the "expand" operation.
|
|
766
760
|
* See: https://www.hl7.org/fhir/operation-valueset-expand.html
|
|
767
|
-
*
|
|
768
761
|
* @category Search
|
|
769
762
|
* @param system The ValueSet system url.
|
|
770
763
|
* @param filter The search string.
|
|
@@ -783,8 +776,7 @@ export declare class MedplumClient extends EventTarget {
|
|
|
783
776
|
/**
|
|
784
777
|
* Returns a cached resource if it is available.
|
|
785
778
|
* @category Caching
|
|
786
|
-
* @param
|
|
787
|
-
* @param id The FHIR resource ID.
|
|
779
|
+
* @param reference The FHIR reference.
|
|
788
780
|
* @returns The resource if it is available in the cache; undefined otherwise.
|
|
789
781
|
*/
|
|
790
782
|
getCachedReference<T extends Resource>(reference: Reference<T>): T | undefined;
|
|
@@ -799,7 +791,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
799
791
|
* ```
|
|
800
792
|
*
|
|
801
793
|
* See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
|
|
802
|
-
*
|
|
803
794
|
* @category Read
|
|
804
795
|
* @param resourceType The FHIR resource type.
|
|
805
796
|
* @param id The resource ID.
|
|
@@ -821,7 +812,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
821
812
|
* ```
|
|
822
813
|
*
|
|
823
814
|
* See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
|
|
824
|
-
*
|
|
825
815
|
* @category Read
|
|
826
816
|
* @param reference The FHIR reference object.
|
|
827
817
|
* @param options Optional fetch options.
|
|
@@ -858,7 +848,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
858
848
|
* ```
|
|
859
849
|
*
|
|
860
850
|
* See the FHIR "history" operation for full details: https://www.hl7.org/fhir/http.html#history
|
|
861
|
-
*
|
|
862
851
|
* @category Read
|
|
863
852
|
* @param resourceType The FHIR resource type.
|
|
864
853
|
* @param id The resource ID.
|
|
@@ -877,7 +866,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
877
866
|
* ```
|
|
878
867
|
*
|
|
879
868
|
* See the FHIR "vread" operation for full details: https://www.hl7.org/fhir/http.html#vread
|
|
880
|
-
*
|
|
881
869
|
* @category Read
|
|
882
870
|
* @param resourceType The FHIR resource type.
|
|
883
871
|
* @param id The resource ID.
|
|
@@ -897,7 +885,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
897
885
|
* ```
|
|
898
886
|
*
|
|
899
887
|
* See the FHIR "patient-everything" operation for full details: https://hl7.org/fhir/operation-patient-everything.html
|
|
900
|
-
*
|
|
901
888
|
* @category Read
|
|
902
889
|
* @param id The Patient Id
|
|
903
890
|
* @param options Optional fetch options.
|
|
@@ -923,12 +910,12 @@ export declare class MedplumClient extends EventTarget {
|
|
|
923
910
|
* ```
|
|
924
911
|
*
|
|
925
912
|
* See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
|
|
926
|
-
*
|
|
927
913
|
* @category Create
|
|
928
914
|
* @param resource The FHIR resource to create.
|
|
915
|
+
* @param options Optional fetch options.
|
|
929
916
|
* @returns The result of the create operation.
|
|
930
917
|
*/
|
|
931
|
-
createResource<T extends Resource>(resource: T): Promise<T>;
|
|
918
|
+
createResource<T extends Resource>(resource: T, options?: RequestInit): Promise<T>;
|
|
932
919
|
/**
|
|
933
920
|
* Conditionally create a new FHIR resource only if some equivalent resource does not already exist on the server.
|
|
934
921
|
*
|
|
@@ -963,13 +950,13 @@ export declare class MedplumClient extends EventTarget {
|
|
|
963
950
|
* The query parameter only contains the search parameters (what would be in the URL following the "?").
|
|
964
951
|
*
|
|
965
952
|
* See the FHIR "conditional create" operation for full details: https://www.hl7.org/fhir/http.html#ccreate
|
|
966
|
-
*
|
|
967
953
|
* @category Create
|
|
968
954
|
* @param resource The FHIR resource to create.
|
|
969
955
|
* @param query The search query for an equivalent resource (should not include resource type or "?").
|
|
956
|
+
* @param options Optional fetch options.
|
|
970
957
|
* @returns The result of the create operation.
|
|
971
958
|
*/
|
|
972
|
-
createResourceIfNoneExist<T extends Resource>(resource: T, query: string): Promise<T>;
|
|
959
|
+
createResourceIfNoneExist<T extends Resource>(resource: T, query: string, options?: RequestInit): Promise<T>;
|
|
973
960
|
/**
|
|
974
961
|
* Creates a FHIR `Binary` resource with the provided data content.
|
|
975
962
|
*
|
|
@@ -987,11 +974,11 @@ export declare class MedplumClient extends EventTarget {
|
|
|
987
974
|
* ```
|
|
988
975
|
*
|
|
989
976
|
* See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
|
|
990
|
-
*
|
|
991
977
|
* @category Create
|
|
992
978
|
* @param data The binary data to upload.
|
|
993
979
|
* @param filename Optional filename for the binary.
|
|
994
980
|
* @param contentType Content type for the binary.
|
|
981
|
+
* @param onProgress Optional callback for progress events.
|
|
995
982
|
* @returns The result of the create operation.
|
|
996
983
|
*/
|
|
997
984
|
createBinary(data: string | File | Blob | Uint8Array, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void): Promise<Binary>;
|
|
@@ -1013,9 +1000,11 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1013
1000
|
* ```
|
|
1014
1001
|
*
|
|
1015
1002
|
* See the pdfmake document definition for full details: https://pdfmake.github.io/docs/0.1/document-definition-object/
|
|
1016
|
-
*
|
|
1017
1003
|
* @category Media
|
|
1018
1004
|
* @param docDefinition The PDF document definition.
|
|
1005
|
+
* @param filename Optional filename for the PDF binary resource.
|
|
1006
|
+
* @param tableLayouts Optional pdfmake custom table layout.
|
|
1007
|
+
* @param fonts Optional pdfmake custom font dictionary.
|
|
1019
1008
|
* @returns The result of the create operation.
|
|
1020
1009
|
*/
|
|
1021
1010
|
createPdf(docDefinition: TDocumentDefinitions, filename?: string, tableLayouts?: {
|
|
@@ -1025,13 +1014,13 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1025
1014
|
* Creates a FHIR `Communication` resource with the provided data content.
|
|
1026
1015
|
*
|
|
1027
1016
|
* This is a convenience method to handle commmon cases where a `Communication` resource is created with a `payload`.
|
|
1028
|
-
*
|
|
1029
1017
|
* @category Create
|
|
1030
1018
|
* @param resource The FHIR resource to comment on.
|
|
1031
1019
|
* @param text The text of the comment.
|
|
1020
|
+
* @param options Optional fetch options.
|
|
1032
1021
|
* @returns The result of the create operation.
|
|
1033
1022
|
*/
|
|
1034
|
-
createComment(resource: Resource, text: string): Promise<Communication>;
|
|
1023
|
+
createComment(resource: Resource, text: string, options?: RequestInit): Promise<Communication>;
|
|
1035
1024
|
/**
|
|
1036
1025
|
* Updates a FHIR resource.
|
|
1037
1026
|
*
|
|
@@ -1052,12 +1041,12 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1052
1041
|
* ```
|
|
1053
1042
|
*
|
|
1054
1043
|
* See the FHIR "update" operation for full details: https://www.hl7.org/fhir/http.html#update
|
|
1055
|
-
*
|
|
1056
1044
|
* @category Write
|
|
1057
1045
|
* @param resource The FHIR resource to update.
|
|
1046
|
+
* @param options Optional fetch options.
|
|
1058
1047
|
* @returns The result of the update operation.
|
|
1059
1048
|
*/
|
|
1060
|
-
updateResource<T extends Resource>(resource: T): Promise<T>;
|
|
1049
|
+
updateResource<T extends Resource>(resource: T, options?: RequestInit): Promise<T>;
|
|
1061
1050
|
/**
|
|
1062
1051
|
* Updates a FHIR resource using JSONPatch operations.
|
|
1063
1052
|
*
|
|
@@ -1075,14 +1064,14 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1075
1064
|
* See the FHIR "update" operation for full details: https://www.hl7.org/fhir/http.html#patch
|
|
1076
1065
|
*
|
|
1077
1066
|
* See the JSONPatch specification for full details: https://tools.ietf.org/html/rfc6902
|
|
1078
|
-
*
|
|
1079
1067
|
* @category Write
|
|
1080
1068
|
* @param resourceType The FHIR resource type.
|
|
1081
1069
|
* @param id The resource ID.
|
|
1082
1070
|
* @param operations The JSONPatch operations.
|
|
1071
|
+
* @param options Optional fetch options.
|
|
1083
1072
|
* @returns The result of the patch operations.
|
|
1084
1073
|
*/
|
|
1085
|
-
patchResource<K extends ResourceType>(resourceType: K, id: string, operations: PatchOperation[]): Promise<ExtractResource<K>>;
|
|
1074
|
+
patchResource<K extends ResourceType>(resourceType: K, id: string, operations: PatchOperation[], options?: RequestInit): Promise<ExtractResource<K>>;
|
|
1086
1075
|
/**
|
|
1087
1076
|
* Deletes a FHIR resource by resource type and ID.
|
|
1088
1077
|
*
|
|
@@ -1093,13 +1082,13 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1093
1082
|
* ```
|
|
1094
1083
|
*
|
|
1095
1084
|
* See the FHIR "delete" operation for full details: https://www.hl7.org/fhir/http.html#delete
|
|
1096
|
-
*
|
|
1097
1085
|
* @category Delete
|
|
1098
1086
|
* @param resourceType The FHIR resource type.
|
|
1099
1087
|
* @param id The resource ID.
|
|
1088
|
+
* @param options Optional fetch options.
|
|
1100
1089
|
* @returns The result of the delete operation.
|
|
1101
1090
|
*/
|
|
1102
|
-
deleteResource(resourceType: ResourceType, id: string): Promise<any>;
|
|
1091
|
+
deleteResource(resourceType: ResourceType, id: string, options?: RequestInit): Promise<any>;
|
|
1103
1092
|
/**
|
|
1104
1093
|
* Executes the validate operation with the provided resource.
|
|
1105
1094
|
*
|
|
@@ -1113,11 +1102,11 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1113
1102
|
* ```
|
|
1114
1103
|
*
|
|
1115
1104
|
* See the FHIR "$validate" operation for full details: https://www.hl7.org/fhir/resource-operation-validate.html
|
|
1116
|
-
*
|
|
1117
1105
|
* @param resource The FHIR resource.
|
|
1106
|
+
* @param options Optional fetch options.
|
|
1118
1107
|
* @returns The validate operation outcome.
|
|
1119
1108
|
*/
|
|
1120
|
-
validateResource<T extends Resource>(resource: T): Promise<OperationOutcome>;
|
|
1109
|
+
validateResource<T extends Resource>(resource: T, options?: RequestInit): Promise<OperationOutcome>;
|
|
1121
1110
|
/**
|
|
1122
1111
|
* Executes a bot by ID.
|
|
1123
1112
|
* @param id The Bot ID.
|
|
@@ -1219,10 +1208,11 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1219
1208
|
*
|
|
1220
1209
|
* See options here: https://nodemailer.com/extras/mailcomposer/
|
|
1221
1210
|
* @category Media
|
|
1222
|
-
* @param
|
|
1211
|
+
* @param email The MailComposer options.
|
|
1212
|
+
* @param options Optional fetch options.
|
|
1223
1213
|
* @returns Promise to the operation outcome.
|
|
1224
1214
|
*/
|
|
1225
|
-
sendEmail(email: MailOptions): Promise<OperationOutcome>;
|
|
1215
|
+
sendEmail(email: MailOptions, options?: RequestInit): Promise<OperationOutcome>;
|
|
1226
1216
|
/**
|
|
1227
1217
|
* Executes a GraphQL query.
|
|
1228
1218
|
*
|
|
@@ -1263,7 +1253,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1263
1253
|
* See the GraphQL documentation for more details: https://graphql.org/learn/
|
|
1264
1254
|
*
|
|
1265
1255
|
* See the FHIR GraphQL documentation for FHIR specific details: https://www.hl7.org/fhir/graphql.html
|
|
1266
|
-
*
|
|
1267
1256
|
* @category Read
|
|
1268
1257
|
* @param query The GraphQL query.
|
|
1269
1258
|
* @param operationName Optional GraphQL operation name.
|
|
@@ -1276,75 +1265,91 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1276
1265
|
*
|
|
1277
1266
|
* Executes the $graph operation on this resource to fetch a Bundle of resources linked to the target resource
|
|
1278
1267
|
* according to a graph definition
|
|
1279
|
-
|
|
1280
1268
|
* @category Read
|
|
1281
1269
|
* @param resourceType The FHIR resource type.
|
|
1282
1270
|
* @param id The resource ID.
|
|
1283
1271
|
* @param graphName `name` parameter of the GraphDefinition
|
|
1272
|
+
* @param options Optional fetch options.
|
|
1284
1273
|
* @returns A Bundle
|
|
1285
1274
|
*/
|
|
1286
|
-
readResourceGraph<K extends ResourceType>(resourceType: K, id: string, graphName: string): ReadablePromise<Bundle<Resource>>;
|
|
1275
|
+
readResourceGraph<K extends ResourceType>(resourceType: K, id: string, graphName: string, options?: RequestInit): ReadablePromise<Bundle<Resource>>;
|
|
1287
1276
|
/**
|
|
1288
1277
|
* @category Authentication
|
|
1289
1278
|
* @returns The Login State
|
|
1290
1279
|
*/
|
|
1291
1280
|
getActiveLogin(): LoginState | undefined;
|
|
1292
1281
|
/**
|
|
1282
|
+
* Sets the active login.
|
|
1283
|
+
* @param login The new active login state.
|
|
1293
1284
|
* @category Authentication
|
|
1294
1285
|
*/
|
|
1295
1286
|
setActiveLogin(login: LoginState): Promise<void>;
|
|
1296
1287
|
/**
|
|
1297
1288
|
* Returns the current access token.
|
|
1289
|
+
* @returns The current access token.
|
|
1298
1290
|
* @category Authentication
|
|
1299
1291
|
*/
|
|
1300
1292
|
getAccessToken(): string | undefined;
|
|
1301
1293
|
/**
|
|
1302
1294
|
* Sets the current access token.
|
|
1295
|
+
* @param accessToken The new access token.
|
|
1303
1296
|
* @category Authentication
|
|
1304
1297
|
*/
|
|
1305
1298
|
setAccessToken(accessToken: string): void;
|
|
1306
1299
|
/**
|
|
1300
|
+
* Returns the list of available logins.
|
|
1301
|
+
* @returns The list of available logins.
|
|
1307
1302
|
* @category Authentication
|
|
1308
1303
|
*/
|
|
1309
1304
|
getLogins(): LoginState[];
|
|
1310
1305
|
private addLogin;
|
|
1311
1306
|
private refreshProfile;
|
|
1312
1307
|
/**
|
|
1308
|
+
* Returns true if the client is waiting for authentication.
|
|
1309
|
+
* @returns True if the client is waiting for authentication.
|
|
1313
1310
|
* @category Authentication
|
|
1314
1311
|
*/
|
|
1315
1312
|
isLoading(): boolean;
|
|
1316
1313
|
/**
|
|
1314
|
+
* Returns the current user profile resource if available.
|
|
1315
|
+
* This method does not wait for loading promises.
|
|
1316
|
+
* @returns The current user profile resource if available.
|
|
1317
1317
|
* @category User Profile
|
|
1318
1318
|
*/
|
|
1319
1319
|
getProfile(): ProfileResource | undefined;
|
|
1320
1320
|
/**
|
|
1321
|
+
* Returns the current user profile resource if available.
|
|
1322
|
+
* This method waits for loading promises.
|
|
1323
|
+
* @returns The current user profile resource if available.
|
|
1321
1324
|
* @category User Profile
|
|
1322
1325
|
*/
|
|
1323
1326
|
getProfileAsync(): Promise<ProfileResource | undefined>;
|
|
1324
1327
|
/**
|
|
1328
|
+
* Returns the current user configuration if available.
|
|
1329
|
+
* @returns The current user configuration if available.
|
|
1325
1330
|
* @category User Profile
|
|
1326
1331
|
*/
|
|
1327
1332
|
getUserConfiguration(): UserConfiguration | undefined;
|
|
1328
1333
|
/**
|
|
1329
1334
|
* Downloads the URL as a blob.
|
|
1330
|
-
*
|
|
1331
1335
|
* @category Read
|
|
1332
1336
|
* @param url The URL to request.
|
|
1337
|
+
* @param options Optional fetch request init options.
|
|
1333
1338
|
* @returns Promise to the response body as a blob.
|
|
1334
1339
|
*/
|
|
1335
1340
|
download(url: URL | string, options?: RequestInit): Promise<Blob>;
|
|
1336
1341
|
/**
|
|
1337
1342
|
* Upload media to the server and create a Media instance for the uploaded content.
|
|
1338
1343
|
* @param contents The contents of the media file, as a string, Uint8Array, File, or Blob.
|
|
1339
|
-
* @param contentType The media type of the content
|
|
1340
|
-
* @param filename The name of the file to be uploaded, or undefined if not applicable
|
|
1341
|
-
* @param additionalFields
|
|
1344
|
+
* @param contentType The media type of the content.
|
|
1345
|
+
* @param filename The name of the file to be uploaded, or undefined if not applicable.
|
|
1346
|
+
* @param additionalFields Additional fields for Media.
|
|
1347
|
+
* @param options Optional fetch options.
|
|
1342
1348
|
* @returns Promise that resolves to the created Media
|
|
1343
1349
|
*/
|
|
1344
|
-
uploadMedia(contents: string | Uint8Array | File | Blob, contentType: string, filename: string | undefined, additionalFields?: Partial<Media
|
|
1350
|
+
uploadMedia(contents: string | Uint8Array | File | Blob, contentType: string, filename: string | undefined, additionalFields?: Partial<Media>, options?: RequestInit): Promise<Media>;
|
|
1345
1351
|
/**
|
|
1346
1352
|
* Performs Bulk Data Export operation request flow. See The FHIR "Bulk Data Export" for full details: https://build.fhir.org/ig/HL7/bulk-data/export.html#bulk-data-export
|
|
1347
|
-
*
|
|
1348
1353
|
* @param exportLevel Optional export level. Defaults to system level export. 'Group/:id' - Group of Patients, 'Patient' - All Patients.
|
|
1349
1354
|
* @param resourceTypes A string of comma-delimited FHIR resource types.
|
|
1350
1355
|
* @param since Resources will be included in the response if their state has changed after the supplied time (e.g. if Resource.meta.lastUpdated is later than the supplied _since time).
|
|
@@ -1379,10 +1384,10 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1379
1384
|
private deleteCacheEntry;
|
|
1380
1385
|
/**
|
|
1381
1386
|
* Makes an HTTP request.
|
|
1382
|
-
* @param
|
|
1383
|
-
* @param
|
|
1384
|
-
* @param
|
|
1385
|
-
* @
|
|
1387
|
+
* @param method The HTTP method (GET, POST, etc).
|
|
1388
|
+
* @param url The target URL.
|
|
1389
|
+
* @param options Optional fetch request init options.
|
|
1390
|
+
* @returns The JSON content body if available.
|
|
1386
1391
|
*/
|
|
1387
1392
|
private request;
|
|
1388
1393
|
private parseResponse;
|
|
@@ -1415,14 +1420,15 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1415
1420
|
* Otherwise, calls unauthenticated callbacks and rejects.
|
|
1416
1421
|
* @param method The HTTP method of the original request.
|
|
1417
1422
|
* @param url The URL of the original request.
|
|
1418
|
-
* @param
|
|
1419
|
-
* @
|
|
1423
|
+
* @param options Optional fetch request init options.
|
|
1424
|
+
* @returns The result of the retry.
|
|
1420
1425
|
*/
|
|
1421
1426
|
private handleUnauthenticated;
|
|
1422
1427
|
/**
|
|
1423
1428
|
* Starts a new PKCE flow.
|
|
1424
1429
|
* These PKCE values are stateful, and must survive redirects and page refreshes.
|
|
1425
1430
|
* @category Authentication
|
|
1431
|
+
* @returns The PKCE code challenge details.
|
|
1426
1432
|
*/
|
|
1427
1433
|
startPkce(): Promise<{
|
|
1428
1434
|
codeChallengeMethod: string;
|
|
@@ -1431,7 +1437,8 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1431
1437
|
/**
|
|
1432
1438
|
* Redirects the user to the login screen for authorization.
|
|
1433
1439
|
* Clears all auth state including local storage and session storage.
|
|
1434
|
-
*
|
|
1440
|
+
* @param loginParams The authorization login parameters.
|
|
1441
|
+
* @see https://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint
|
|
1435
1442
|
*/
|
|
1436
1443
|
private requestAuthorization;
|
|
1437
1444
|
/**
|
|
@@ -1439,12 +1446,14 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1439
1446
|
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenRequest
|
|
1440
1447
|
* @param code The authorization code received by URL parameter.
|
|
1441
1448
|
* @param loginParams Optional login parameters.
|
|
1449
|
+
* @returns The user profile resource.
|
|
1442
1450
|
* @category Authentication
|
|
1443
1451
|
*/
|
|
1444
1452
|
processCode(code: string, loginParams?: Partial<BaseLoginRequest>): Promise<ProfileResource>;
|
|
1445
1453
|
/**
|
|
1446
1454
|
* Tries to refresh the auth tokens.
|
|
1447
|
-
*
|
|
1455
|
+
* @returns The refresh promise if available; otherwise undefined.
|
|
1456
|
+
* @see https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens
|
|
1448
1457
|
*/
|
|
1449
1458
|
private refresh;
|
|
1450
1459
|
/**
|
|
@@ -1472,7 +1481,6 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1472
1481
|
* // Example Search
|
|
1473
1482
|
* await medplum.searchResources('Patient')
|
|
1474
1483
|
* ```
|
|
1475
|
-
*
|
|
1476
1484
|
* @category Authentication
|
|
1477
1485
|
* @param clientId The client ID.
|
|
1478
1486
|
* @param clientSecret The client secret.
|
|
@@ -1489,13 +1497,15 @@ export declare class MedplumClient extends EventTarget {
|
|
|
1489
1497
|
* Makes a POST request to the tokens endpoint.
|
|
1490
1498
|
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint
|
|
1491
1499
|
* @param formBody Token parameters in URL encoded format.
|
|
1500
|
+
* @returns The user profile resource.
|
|
1492
1501
|
*/
|
|
1493
1502
|
private fetchTokens;
|
|
1494
1503
|
/**
|
|
1495
1504
|
* Verifies the tokens received from the auth server.
|
|
1496
1505
|
* Validates the JWT against the JWKS.
|
|
1497
1506
|
* See: https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint
|
|
1498
|
-
* @param tokens
|
|
1507
|
+
* @param tokens The token response.
|
|
1508
|
+
* @returns Promise to complete.
|
|
1499
1509
|
*/
|
|
1500
1510
|
private verifyTokens;
|
|
1501
1511
|
/**
|
package/dist/types/crypto.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns a cryptographically secure random string.
|
|
3
|
+
* @returns A cryptographically secure random string.
|
|
3
4
|
*/
|
|
4
5
|
export declare function getRandomString(): string;
|
|
5
6
|
/**
|
|
6
7
|
* Encrypts a string with SHA256 encryption.
|
|
7
|
-
* @param str
|
|
8
|
+
* @param str The unencrypted input string.
|
|
9
|
+
* @returns The encrypted value in an ArrayBuffer.
|
|
8
10
|
*/
|
|
9
11
|
export declare function encryptSHA256(str: string): Promise<ArrayBuffer>;
|
package/dist/types/hl7.d.ts
CHANGED
|
@@ -142,7 +142,7 @@ interface Hl7DateParseOptions {
|
|
|
142
142
|
* Returns a formatted string representing the date in ISO-8601 format.
|
|
143
143
|
* @param hl7Date Date string.
|
|
144
144
|
* @param options Optional configuration Object
|
|
145
|
-
* @returns
|
|
145
|
+
* @returns The date in ISO-8601 format.
|
|
146
146
|
*/
|
|
147
147
|
export declare function parseHl7Date(hl7Date: string | undefined, options?: Hl7DateParseOptions): string | undefined;
|
|
148
148
|
export {};
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/jwt.d.ts
CHANGED
package/dist/types/schema.d.ts
CHANGED
|
@@ -27,7 +27,6 @@ import { OperationOutcomeIssue, Resource } from '@medplum/fhirtypes';
|
|
|
27
27
|
* const medplum = new MedplumClient();
|
|
28
28
|
* await medplum.requestSchema('Patient');
|
|
29
29
|
* ```
|
|
30
|
-
*
|
|
31
30
|
* @param resourceType The candidate resource type string.
|
|
32
31
|
* @returns True if the resource type is a valid FHIR resource type.
|
|
33
32
|
*/
|
|
@@ -62,9 +61,7 @@ export declare function isResourceType(resourceType: string): boolean;
|
|
|
62
61
|
* const medplum = new MedplumClient();
|
|
63
62
|
* await medplum.requestSchema('Patient');
|
|
64
63
|
* ```
|
|
65
|
-
*
|
|
66
64
|
* @param resourceType The candidate resource type string.
|
|
67
|
-
* @returns True if the resource type is a valid FHIR resource type.
|
|
68
65
|
*/
|
|
69
66
|
export declare function validateResourceType(resourceType: string): void;
|
|
70
67
|
/**
|
|
@@ -97,9 +94,7 @@ export declare function validateResourceType(resourceType: string): void;
|
|
|
97
94
|
* const medplum = new MedplumClient();
|
|
98
95
|
* await medplum.requestSchema('Patient');
|
|
99
96
|
* ```
|
|
100
|
-
*
|
|
101
|
-
* @param resourceType The candidate resource type string.
|
|
102
|
-
* @returns True if the resource type is a valid FHIR resource type.
|
|
97
|
+
* @param resource The candidate resource.
|
|
103
98
|
*/
|
|
104
99
|
export declare function validateResource<T extends Resource>(resource: T): void;
|
|
105
100
|
export declare class FhirSchemaValidator<T extends Resource> {
|
|
@@ -131,10 +126,10 @@ export declare class FhirSchemaValidator<T extends Resource> {
|
|
|
131
126
|
* 2) a JSON property with _ prepended to the name of the element, which, if present, contains the value's id and/or extensions
|
|
132
127
|
*
|
|
133
128
|
* See: https://hl7.org/fhir/json.html#primitive
|
|
134
|
-
*
|
|
135
129
|
* @param path The path to the property
|
|
136
|
-
* @param key
|
|
137
|
-
* @param typedValue
|
|
130
|
+
* @param key The key in the current typed value.
|
|
131
|
+
* @param typedValue The current typed value.
|
|
132
|
+
* @returns True if the primitive element is valid.
|
|
138
133
|
*/
|
|
139
134
|
private checkPrimitiveElement;
|
|
140
135
|
private createIssue;
|
|
@@ -143,7 +138,6 @@ export declare class FhirSchemaValidator<T extends Resource> {
|
|
|
143
138
|
* Recursively checks for null values in an object.
|
|
144
139
|
*
|
|
145
140
|
* Note that "null" is a special value in JSON that is not allowed in FHIR.
|
|
146
|
-
*
|
|
147
141
|
* @param value Input value of any type.
|
|
148
142
|
* @param path Path string to the value for OperationOutcome.
|
|
149
143
|
* @param issues Output list of issues.
|
|
@@ -26,7 +26,6 @@ export interface SearchParameterDetails {
|
|
|
26
26
|
* 1) The "date" type includes "date", "datetime", and "period".
|
|
27
27
|
* 2) The "token" type includes enums and booleans.
|
|
28
28
|
* 3) Arrays/multiple values are not reflected at all.
|
|
29
|
-
*
|
|
30
29
|
* @param resourceType The root resource type.
|
|
31
30
|
* @param searchParam The search parameter.
|
|
32
31
|
* @returns The search parameter type details.
|
|
@@ -79,7 +79,7 @@ export declare function parseSearchDefinition<T extends Resource = Resource>(url
|
|
|
79
79
|
/**
|
|
80
80
|
* Formats a search definition object into a query string.
|
|
81
81
|
* Note: The return value does not include the resource type.
|
|
82
|
-
* @param
|
|
82
|
+
* @param definition The search definition.
|
|
83
83
|
* @returns Formatted URL.
|
|
84
84
|
*/
|
|
85
85
|
export declare function formatSearchQuery(definition: SearchRequest): string;
|