@medplum/core 2.0.20 → 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.
Files changed (47) hide show
  1. package/dist/cjs/index.cjs +448 -289
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.min.cjs +1 -1
  4. package/dist/esm/client.mjs +199 -101
  5. package/dist/esm/client.mjs.map +1 -1
  6. package/dist/esm/crypto.mjs +3 -1
  7. package/dist/esm/crypto.mjs.map +1 -1
  8. package/dist/esm/fhirpath/functions.mjs +179 -129
  9. package/dist/esm/fhirpath/functions.mjs.map +1 -1
  10. package/dist/esm/format.mjs +6 -4
  11. package/dist/esm/format.mjs.map +1 -1
  12. package/dist/esm/hl7.mjs +1 -1
  13. package/dist/esm/hl7.mjs.map +1 -1
  14. package/dist/esm/index.min.mjs +1 -1
  15. package/dist/esm/index.mjs +1 -0
  16. package/dist/esm/index.mjs.map +1 -1
  17. package/dist/esm/jwt.mjs +4 -2
  18. package/dist/esm/jwt.mjs.map +1 -1
  19. package/dist/esm/schema.mjs +4 -10
  20. package/dist/esm/schema.mjs.map +1 -1
  21. package/dist/esm/search/details.mjs +0 -1
  22. package/dist/esm/search/details.mjs.map +1 -1
  23. package/dist/esm/search/match.mjs +1 -0
  24. package/dist/esm/search/match.mjs.map +1 -1
  25. package/dist/esm/search/search.mjs +2 -2
  26. package/dist/esm/search/search.mjs.map +1 -1
  27. package/dist/esm/sftp.mjs +0 -1
  28. package/dist/esm/sftp.mjs.map +1 -1
  29. package/dist/esm/storage.mjs +8 -0
  30. package/dist/esm/storage.mjs.map +1 -1
  31. package/dist/esm/types.mjs +1 -0
  32. package/dist/esm/types.mjs.map +1 -1
  33. package/dist/esm/utils.mjs +8 -7
  34. package/dist/esm/utils.mjs.map +1 -1
  35. package/dist/types/client.d.ts +89 -65
  36. package/dist/types/config.d.ts +7 -3
  37. package/dist/types/crypto.d.ts +3 -1
  38. package/dist/types/hl7.d.ts +1 -1
  39. package/dist/types/index.d.ts +1 -0
  40. package/dist/types/jwt.d.ts +2 -1
  41. package/dist/types/schema.d.ts +4 -10
  42. package/dist/types/search/details.d.ts +0 -1
  43. package/dist/types/search/search.d.ts +1 -1
  44. package/dist/types/storage.d.ts +8 -0
  45. package/dist/types/typeschema/types.d.ts +55 -0
  46. package/dist/types/utils.d.ts +4 -4
  47. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { AccessPolicy, Binary, Bundle, Communication, ExtractResource, Identifier, Media, OperationOutcome, Project, ProjectMembership, ProjectSecret, Reference, Resource, ResourceType, UserConfiguration, ValueSet } from '@medplum/fhirtypes';
1
+ import { AccessPolicy, Binary, BulkDataExport, Bundle, Communication, ExtractResource, Identifier, Media, OperationOutcome, Project, ProjectMembership, ProjectSecret, Reference, Resource, ResourceType, UserConfiguration, ValueSet } from '@medplum/fhirtypes';
2
2
  /** @ts-ignore */
3
3
  import type { CustomTableLayout, TDocumentDefinitions, TFontDictionary } from 'pdfmake/interfaces';
4
4
  import { EventTarget } from './eventtarget';
@@ -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
- * @returns An async generator, where each result is an array of resources for each page.
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 resourceType The FHIR resource type.
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.
@@ -1181,9 +1170,10 @@ export declare class MedplumClient extends EventTarget {
1181
1170
  * See The FHIR "batch/transaction" section for full details: https://hl7.org/fhir/http.html#transaction
1182
1171
  * @category Batch
1183
1172
  * @param bundle The FHIR batch/transaction bundle.
1173
+ * @param options Optional fetch options.
1184
1174
  * @returns The FHIR batch/transaction response bundle.
1185
1175
  */
1186
- executeBatch(bundle: Bundle): Promise<Bundle>;
1176
+ executeBatch(bundle: Bundle, options?: RequestInit): Promise<Bundle>;
1187
1177
  /**
1188
1178
  * Sends an email using the Medplum Email API.
1189
1179
  *
@@ -1218,10 +1208,11 @@ export declare class MedplumClient extends EventTarget {
1218
1208
  *
1219
1209
  * See options here: https://nodemailer.com/extras/mailcomposer/
1220
1210
  * @category Media
1221
- * @param options The MailComposer options.
1211
+ * @param email The MailComposer options.
1212
+ * @param options Optional fetch options.
1222
1213
  * @returns Promise to the operation outcome.
1223
1214
  */
1224
- sendEmail(email: MailOptions): Promise<OperationOutcome>;
1215
+ sendEmail(email: MailOptions, options?: RequestInit): Promise<OperationOutcome>;
1225
1216
  /**
1226
1217
  * Executes a GraphQL query.
1227
1218
  *
@@ -1262,7 +1253,6 @@ export declare class MedplumClient extends EventTarget {
1262
1253
  * See the GraphQL documentation for more details: https://graphql.org/learn/
1263
1254
  *
1264
1255
  * See the FHIR GraphQL documentation for FHIR specific details: https://www.hl7.org/fhir/graphql.html
1265
- *
1266
1256
  * @category Read
1267
1257
  * @param query The GraphQL query.
1268
1258
  * @param operationName Optional GraphQL operation name.
@@ -1275,72 +1265,98 @@ export declare class MedplumClient extends EventTarget {
1275
1265
  *
1276
1266
  * Executes the $graph operation on this resource to fetch a Bundle of resources linked to the target resource
1277
1267
  * according to a graph definition
1278
-
1279
1268
  * @category Read
1280
1269
  * @param resourceType The FHIR resource type.
1281
1270
  * @param id The resource ID.
1282
1271
  * @param graphName `name` parameter of the GraphDefinition
1272
+ * @param options Optional fetch options.
1283
1273
  * @returns A Bundle
1284
1274
  */
1285
- 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>>;
1286
1276
  /**
1287
1277
  * @category Authentication
1288
1278
  * @returns The Login State
1289
1279
  */
1290
1280
  getActiveLogin(): LoginState | undefined;
1291
1281
  /**
1282
+ * Sets the active login.
1283
+ * @param login The new active login state.
1292
1284
  * @category Authentication
1293
1285
  */
1294
1286
  setActiveLogin(login: LoginState): Promise<void>;
1295
1287
  /**
1296
1288
  * Returns the current access token.
1289
+ * @returns The current access token.
1297
1290
  * @category Authentication
1298
1291
  */
1299
1292
  getAccessToken(): string | undefined;
1300
1293
  /**
1301
1294
  * Sets the current access token.
1295
+ * @param accessToken The new access token.
1302
1296
  * @category Authentication
1303
1297
  */
1304
1298
  setAccessToken(accessToken: string): void;
1305
1299
  /**
1300
+ * Returns the list of available logins.
1301
+ * @returns The list of available logins.
1306
1302
  * @category Authentication
1307
1303
  */
1308
1304
  getLogins(): LoginState[];
1309
1305
  private addLogin;
1310
1306
  private refreshProfile;
1311
1307
  /**
1308
+ * Returns true if the client is waiting for authentication.
1309
+ * @returns True if the client is waiting for authentication.
1312
1310
  * @category Authentication
1313
1311
  */
1314
1312
  isLoading(): boolean;
1315
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.
1316
1317
  * @category User Profile
1317
1318
  */
1318
1319
  getProfile(): ProfileResource | undefined;
1319
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.
1320
1324
  * @category User Profile
1321
1325
  */
1322
1326
  getProfileAsync(): Promise<ProfileResource | undefined>;
1323
1327
  /**
1328
+ * Returns the current user configuration if available.
1329
+ * @returns The current user configuration if available.
1324
1330
  * @category User Profile
1325
1331
  */
1326
1332
  getUserConfiguration(): UserConfiguration | undefined;
1327
1333
  /**
1328
1334
  * Downloads the URL as a blob.
1329
- *
1330
1335
  * @category Read
1331
1336
  * @param url The URL to request.
1337
+ * @param options Optional fetch request init options.
1332
1338
  * @returns Promise to the response body as a blob.
1333
1339
  */
1334
1340
  download(url: URL | string, options?: RequestInit): Promise<Blob>;
1335
1341
  /**
1336
1342
  * Upload media to the server and create a Media instance for the uploaded content.
1337
1343
  * @param contents The contents of the media file, as a string, Uint8Array, File, or Blob.
1338
- * @param contentType The media type of the content
1339
- * @param filename The name of the file to be uploaded, or undefined if not applicable
1340
- * @param additionalFields Additional fields for Media
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.
1341
1348
  * @returns Promise that resolves to the created Media
1342
1349
  */
1343
- uploadMedia(contents: string | Uint8Array | File | Blob, contentType: string, filename: string | undefined, additionalFields?: Partial<Media>): Promise<Media>;
1350
+ uploadMedia(contents: string | Uint8Array | File | Blob, contentType: string, filename: string | undefined, additionalFields?: Partial<Media>, options?: RequestInit): Promise<Media>;
1351
+ /**
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
1353
+ * @param exportLevel Optional export level. Defaults to system level export. 'Group/:id' - Group of Patients, 'Patient' - All Patients.
1354
+ * @param resourceTypes A string of comma-delimited FHIR resource types.
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).
1356
+ * @param options Optional fetch options.
1357
+ * @returns Bulk Data Response containing links to Bulk Data files. See "Response - Complete Status" for full details: https://build.fhir.org/ig/HL7/bulk-data/export.html#response---complete-status
1358
+ */
1359
+ bulkExport(exportLevel?: string, resourceTypes?: string, since?: string, options?: RequestInit): Promise<Partial<BulkDataExport>>;
1344
1360
  /**
1345
1361
  * Returns the cache entry if available and not expired.
1346
1362
  * @param key The cache key to retrieve.
@@ -1368,13 +1384,15 @@ export declare class MedplumClient extends EventTarget {
1368
1384
  private deleteCacheEntry;
1369
1385
  /**
1370
1386
  * Makes an HTTP request.
1371
- * @param {string} method
1372
- * @param {string} url
1373
- * @param {string=} contentType
1374
- * @param {Object=} body
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.
1375
1391
  */
1376
1392
  private request;
1393
+ private parseResponse;
1377
1394
  private fetchWithRetry;
1395
+ private pollStatus;
1378
1396
  /**
1379
1397
  * Executes a batch of requests that were automatically batched together.
1380
1398
  */
@@ -1402,14 +1420,15 @@ export declare class MedplumClient extends EventTarget {
1402
1420
  * Otherwise, calls unauthenticated callbacks and rejects.
1403
1421
  * @param method The HTTP method of the original request.
1404
1422
  * @param url The URL of the original request.
1405
- * @param contentType The content type of the original request.
1406
- * @param body The body of the original request.
1423
+ * @param options Optional fetch request init options.
1424
+ * @returns The result of the retry.
1407
1425
  */
1408
1426
  private handleUnauthenticated;
1409
1427
  /**
1410
1428
  * Starts a new PKCE flow.
1411
1429
  * These PKCE values are stateful, and must survive redirects and page refreshes.
1412
1430
  * @category Authentication
1431
+ * @returns The PKCE code challenge details.
1413
1432
  */
1414
1433
  startPkce(): Promise<{
1415
1434
  codeChallengeMethod: string;
@@ -1418,7 +1437,8 @@ export declare class MedplumClient extends EventTarget {
1418
1437
  /**
1419
1438
  * Redirects the user to the login screen for authorization.
1420
1439
  * Clears all auth state including local storage and session storage.
1421
- * See: https://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint
1440
+ * @param loginParams The authorization login parameters.
1441
+ * @see https://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint
1422
1442
  */
1423
1443
  private requestAuthorization;
1424
1444
  /**
@@ -1426,12 +1446,14 @@ export declare class MedplumClient extends EventTarget {
1426
1446
  * See: https://openid.net/specs/openid-connect-core-1_0.html#TokenRequest
1427
1447
  * @param code The authorization code received by URL parameter.
1428
1448
  * @param loginParams Optional login parameters.
1449
+ * @returns The user profile resource.
1429
1450
  * @category Authentication
1430
1451
  */
1431
1452
  processCode(code: string, loginParams?: Partial<BaseLoginRequest>): Promise<ProfileResource>;
1432
1453
  /**
1433
1454
  * Tries to refresh the auth tokens.
1434
- * See: https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens
1455
+ * @returns The refresh promise if available; otherwise undefined.
1456
+ * @see https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens
1435
1457
  */
1436
1458
  private refresh;
1437
1459
  /**
@@ -1459,7 +1481,6 @@ export declare class MedplumClient extends EventTarget {
1459
1481
  * // Example Search
1460
1482
  * await medplum.searchResources('Patient')
1461
1483
  * ```
1462
- *
1463
1484
  * @category Authentication
1464
1485
  * @param clientId The client ID.
1465
1486
  * @param clientSecret The client secret.
@@ -1476,13 +1497,15 @@ export declare class MedplumClient extends EventTarget {
1476
1497
  * Makes a POST request to the tokens endpoint.
1477
1498
  * See: https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint
1478
1499
  * @param formBody Token parameters in URL encoded format.
1500
+ * @returns The user profile resource.
1479
1501
  */
1480
1502
  private fetchTokens;
1481
1503
  /**
1482
1504
  * Verifies the tokens received from the auth server.
1483
1505
  * Validates the JWT against the JWKS.
1484
1506
  * See: https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint
1485
- * @param tokens
1507
+ * @param tokens The token response.
1508
+ * @returns Promise to complete.
1486
1509
  */
1487
1510
  private verifyTokens;
1488
1511
  /**
@@ -1490,4 +1513,5 @@ export declare class MedplumClient extends EventTarget {
1490
1513
  * This synchronizes state across browser windows and browser tabs.
1491
1514
  */
1492
1515
  private setupStorageListener;
1516
+ private retryCatch;
1493
1517
  }
@@ -12,21 +12,25 @@ export interface MedplumInfraConfig {
12
12
  appDomainName: string;
13
13
  appSslCertArn: string;
14
14
  appApiProxy?: boolean;
15
+ appLoggingBucket?: string;
16
+ appLoggingPrefix?: string;
15
17
  storageBucketName: string;
16
18
  storageDomainName: string;
17
19
  storageSslCertArn: string;
18
20
  storagePublicKey: string;
21
+ storageLoggingBucket?: string;
22
+ storageLoggingPrefix?: string;
19
23
  maxAzs: number;
20
24
  rdsInstances: number;
21
25
  rdsInstanceType: string;
22
26
  rdsSecretsArn?: string;
27
+ cacheNodeType?: string;
23
28
  desiredServerCount: number;
24
29
  serverImage: string;
25
30
  serverMemory: number;
26
31
  serverCpu: number;
27
- loadBalancerLoggingEnabled: boolean;
28
- loadBalancerLoggingBucket: string;
29
- loadBalancerLoggingPrefix: string;
32
+ loadBalancerLoggingBucket?: string;
33
+ loadBalancerLoggingPrefix?: string;
30
34
  clamscanEnabled: boolean;
31
35
  clamscanLoggingBucket: string;
32
36
  clamscanLoggingPrefix: string;
@@ -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>;
@@ -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 {};
@@ -1,3 +1,4 @@
1
+ export * from './base64';
1
2
  export * from './bundle';
2
3
  export * from './cache';
3
4
  export * from './client';
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Parses the JWT payload.
3
- * @param token JWT token
3
+ * @param token JWT token.
4
+ * @returns Collection of key value claims in the JWT payload.
4
5
  */
5
6
  export declare function parseJWTPayload(token: string): Record<string, number | string>;