@medplum/core 0.9.21 → 0.9.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.
@@ -307,20 +307,24 @@ export declare class MedplumClient extends EventTarget {
307
307
  * Returns the current base URL for all API requests.
308
308
  * By default, this is set to `https://api.medplum.com/`.
309
309
  * This can be overridden by setting the `baseUrl` option when creating the client.
310
+ * @category HTTP
310
311
  * @returns The current base URL for all API requests.
311
312
  */
312
313
  getBaseUrl(): string;
313
314
  /**
314
315
  * Clears all auth state including local storage and session storage.
316
+ * @category Authentication
315
317
  */
316
318
  clear(): void;
317
319
  /**
318
320
  * Invalidates any cached values or cached requests for the given URL.
321
+ * @category Caching
319
322
  * @param url The URL to invalidate.
320
323
  */
321
324
  invalidateUrl(url: URL | string): void;
322
325
  /**
323
326
  * Invalidates all cached search results or cached requests for the given resourceType.
327
+ * @category Caching
324
328
  * @param resourceType The resource type to invalidate.
325
329
  */
326
330
  invalidateSearches<K extends ResourceType>(resourceType: K): void;
@@ -331,6 +335,7 @@ export declare class MedplumClient extends EventTarget {
331
335
  * For common operations, we recommend using higher level methods
332
336
  * such as `readResource()`, `search()`, etc.
333
337
  *
338
+ * @category HTTP
334
339
  * @param url The target URL.
335
340
  * @param options Optional fetch options.
336
341
  * @returns Promise to the response content.
@@ -343,6 +348,7 @@ export declare class MedplumClient extends EventTarget {
343
348
  * For common operations, we recommend using higher level methods
344
349
  * such as `createResource()`.
345
350
  *
351
+ * @category HTTP
346
352
  * @param url The target URL.
347
353
  * @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
348
354
  * @param contentType The content type to be included in the "Content-Type" header.
@@ -357,6 +363,7 @@ export declare class MedplumClient extends EventTarget {
357
363
  * For common operations, we recommend using higher level methods
358
364
  * such as `updateResource()`.
359
365
  *
366
+ * @category HTTP
360
367
  * @param url The target URL.
361
368
  * @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
362
369
  * @param contentType The content type to be included in the "Content-Type" header.
@@ -371,6 +378,7 @@ export declare class MedplumClient extends EventTarget {
371
378
  * For common operations, we recommend using higher level methods
372
379
  * such as `patchResource()`.
373
380
  *
381
+ * @category HTTP
374
382
  * @param url The target URL.
375
383
  * @param operations Array of JSONPatch operations.
376
384
  * @param options Optional fetch options.
@@ -380,10 +388,12 @@ export declare class MedplumClient extends EventTarget {
380
388
  /**
381
389
  * Makes an HTTP DELETE request to the specified URL.
382
390
  *
391
+ *
383
392
  * This is a lower level method for custom requests.
384
393
  * For common operations, we recommend using higher level methods
385
394
  * such as `deleteResource()`.
386
395
  *
396
+ * @category HTTP
387
397
  * @param url The target URL.
388
398
  * @param options Optional fetch options.
389
399
  * @returns Promise to the response content.
@@ -391,12 +401,14 @@ export declare class MedplumClient extends EventTarget {
391
401
  delete(url: URL | string, options?: RequestInit): Promise<any>;
392
402
  /**
393
403
  * Tries to register a new user.
404
+ * @category Authentication
394
405
  * @param request The registration request.
395
406
  * @returns Promise to the authentication response.
396
407
  */
397
408
  register(request: RegisterRequest): Promise<void>;
398
409
  /**
399
410
  * Initiates a user login flow.
411
+ * @category Authentication
400
412
  * @param loginRequest Login request including email and password.
401
413
  * @returns Promise to the authentication response.
402
414
  */
@@ -405,6 +417,7 @@ export declare class MedplumClient extends EventTarget {
405
417
  * Tries to sign in with Google authentication.
406
418
  * The response parameter is the result of a Google authentication.
407
419
  * See: https://developers.google.com/identity/gsi/web/guides/handle-credential-responses-js-functions
420
+ * @category Authentication
408
421
  * @param loginRequest Login request including Google credential response.
409
422
  * @returns Promise to the authentication response.
410
423
  */
@@ -412,28 +425,34 @@ export declare class MedplumClient extends EventTarget {
412
425
  /**
413
426
  * Signs out locally.
414
427
  * Does not invalidate tokens with the server.
428
+ * @category Authentication
415
429
  */
416
430
  signOut(): Promise<void>;
417
431
  /**
418
432
  * Tries to sign in the user.
419
433
  * Returns true if the user is signed in.
420
434
  * This may result in navigating away to the sign in page.
435
+ * @category Authentication
421
436
  */
422
437
  signInWithRedirect(): Promise<ProfileResource | void> | undefined;
423
438
  /**
424
439
  * Tries to sign out the user.
425
440
  * See: https://docs.aws.amazon.com/cognito/latest/developerguide/logout-endpoint.html
441
+ * @category Authentication
426
442
  */
427
443
  signOutWithRedirect(): void;
428
444
  /**
429
445
  * Builds a FHIR URL from a collection of URL path components.
430
446
  * For example, `buildUrl('/Patient', '123')` returns `fhir/R4/Patient/123`.
447
+ * @category HTTP
431
448
  * @param path The path component of the URL.
432
449
  * @returns The well-formed FHIR URL.
433
450
  */
434
451
  fhirUrl(...path: string[]): URL;
435
452
  /**
436
453
  * Builds a FHIR search URL from a search query or structured query object.
454
+ * @category HTTP
455
+ * @category Search
437
456
  * @param query The FHIR search query or structured query object.
438
457
  * @returns The well-formed FHIR URL.
439
458
  */
@@ -475,6 +494,7 @@ export declare class MedplumClient extends EventTarget {
475
494
  *
476
495
  * See FHIR search for full details: https://www.hl7.org/fhir/search.html
477
496
  *
497
+ * @category Search
478
498
  * @param query The search query as either a string or a structured search object.
479
499
  * @returns Promise to the search result bundle.
480
500
  */
@@ -495,6 +515,7 @@ export declare class MedplumClient extends EventTarget {
495
515
  *
496
516
  * See FHIR search for full details: https://www.hl7.org/fhir/search.html
497
517
  *
518
+ * @category Search
498
519
  * @param query The search query as either a string or a structured search object.
499
520
  * @returns Promise to the search result bundle.
500
521
  */
@@ -515,6 +536,7 @@ export declare class MedplumClient extends EventTarget {
515
536
  *
516
537
  * See FHIR search for full details: https://www.hl7.org/fhir/search.html
517
538
  *
539
+ * @category Search
518
540
  * @param query The search query as either a string or a structured search object.
519
541
  * @returns Promise to the search result bundle.
520
542
  */
@@ -522,6 +544,8 @@ export declare class MedplumClient extends EventTarget {
522
544
  /**
523
545
  * Searches a ValueSet resource using the "expand" operation.
524
546
  * See: https://www.hl7.org/fhir/operation-valueset-expand.html
547
+ *
548
+ * @category Search
525
549
  * @param system The ValueSet system url.
526
550
  * @param filter The search string.
527
551
  * @returns Promise to expanded ValueSet.
@@ -529,6 +553,7 @@ export declare class MedplumClient extends EventTarget {
529
553
  searchValueSet(system: string, filter: string, options?: RequestInit): ReadablePromise<ValueSet>;
530
554
  /**
531
555
  * Returns a cached resource if it is available.
556
+ * @category Caching
532
557
  * @param resourceType The FHIR resource type.
533
558
  * @param id The FHIR resource ID.
534
559
  * @returns The resource if it is available in the cache; undefined otherwise.
@@ -536,6 +561,7 @@ export declare class MedplumClient extends EventTarget {
536
561
  getCached<K extends ResourceType>(resourceType: K, id: string): ExtractResource<K> | undefined;
537
562
  /**
538
563
  * Returns a cached resource if it is available.
564
+ * @category Caching
539
565
  * @param resourceType The FHIR resource type.
540
566
  * @param id The FHIR resource ID.
541
567
  * @returns The resource if it is available in the cache; undefined otherwise.
@@ -553,6 +579,7 @@ export declare class MedplumClient extends EventTarget {
553
579
  *
554
580
  * See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
555
581
  *
582
+ * @category Caching
556
583
  * @param resourceType The FHIR resource type.
557
584
  * @param id The resource ID.
558
585
  * @returns The resource if available; undefined otherwise.
@@ -573,6 +600,7 @@ export declare class MedplumClient extends EventTarget {
573
600
  *
574
601
  * See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
575
602
  *
603
+ * @category Read
576
604
  * @param reference The FHIR reference object.
577
605
  * @returns The resource if available; undefined otherwise.
578
606
  */
@@ -581,6 +609,7 @@ export declare class MedplumClient extends EventTarget {
581
609
  * Returns a cached schema for a resource type.
582
610
  * If the schema is not cached, returns undefined.
583
611
  * It is assumed that a client will call requestSchema before using this method.
612
+ * @category Schema
584
613
  * @param resourceType The FHIR resource type.
585
614
  * @returns The schema if immediately available, undefined otherwise.
586
615
  * @deprecated Use globalSchema instead.
@@ -589,6 +618,7 @@ export declare class MedplumClient extends EventTarget {
589
618
  /**
590
619
  * Requests the schema for a resource type.
591
620
  * If the schema is already cached, the promise is resolved immediately.
621
+ * @category Schema
592
622
  * @param resourceType The FHIR resource type.
593
623
  * @returns Promise to a schema with the requested resource type.
594
624
  */
@@ -607,6 +637,7 @@ export declare class MedplumClient extends EventTarget {
607
637
  *
608
638
  * See the FHIR "history" operation for full details: https://www.hl7.org/fhir/http.html#history
609
639
  *
640
+ * @category Read
610
641
  * @param resourceType The FHIR resource type.
611
642
  * @param id The resource ID.
612
643
  * @returns Promise to the resource history.
@@ -624,11 +655,18 @@ export declare class MedplumClient extends EventTarget {
624
655
  *
625
656
  * See the FHIR "vread" operation for full details: https://www.hl7.org/fhir/http.html#vread
626
657
  *
658
+ * @category Read
627
659
  * @param resourceType The FHIR resource type.
628
660
  * @param id The resource ID.
629
661
  * @returns The resource if available; undefined otherwise.
630
662
  */
631
663
  readVersion<K extends ResourceType>(resourceType: K, id: string, vid: string): ReadablePromise<ExtractResource<K>>;
664
+ /**
665
+ *
666
+ * @category Read
667
+ * @param id The Patient Id
668
+ * @returns A Bundle of all Resources related to the Patient
669
+ */
632
670
  readPatientEverything(id: string): ReadablePromise<Bundle>;
633
671
  /**
634
672
  * Creates a new FHIR resource.
@@ -650,6 +688,7 @@ export declare class MedplumClient extends EventTarget {
650
688
  *
651
689
  * See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
652
690
  *
691
+ * @category Create
653
692
  * @param resource The FHIR resource to create.
654
693
  * @returns The result of the create operation.
655
694
  */
@@ -688,6 +727,7 @@ export declare class MedplumClient extends EventTarget {
688
727
  *
689
728
  * See the FHIR "conditional create" operation for full details: https://www.hl7.org/fhir/http.html#ccreate
690
729
  *
730
+ * @category Create
691
731
  * @param resource The FHIR resource to create.
692
732
  * @param query The search query for an equivalent resource.
693
733
  * @returns The result of the create operation.
@@ -711,6 +751,7 @@ export declare class MedplumClient extends EventTarget {
711
751
  *
712
752
  * See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
713
753
  *
754
+ * @category Create
714
755
  * @param data The binary data to upload.
715
756
  * @param filename Optional filename for the binary.
716
757
  * @param contentType Content type for the binary.
@@ -735,6 +776,7 @@ export declare class MedplumClient extends EventTarget {
735
776
  *
736
777
  * See the pdfmake document definition for full details: https://pdfmake.github.io/docs/0.1/document-definition-object/
737
778
  *
779
+ * @category Media
738
780
  * @param docDefinition The PDF document definition.
739
781
  * @returns The result of the create operation.
740
782
  */
@@ -746,6 +788,7 @@ export declare class MedplumClient extends EventTarget {
746
788
  *
747
789
  * This is a convenience method to handle commmon cases where a `Communication` resource is created with a `payload`.
748
790
  *
791
+ * @category Create
749
792
  * @param resource The FHIR resource to comment on.
750
793
  * @param text The text of the comment.
751
794
  * @returns The result of the create operation.
@@ -772,6 +815,7 @@ export declare class MedplumClient extends EventTarget {
772
815
  *
773
816
  * See the FHIR "update" operation for full details: https://www.hl7.org/fhir/http.html#update
774
817
  *
818
+ * @category Write
775
819
  * @param resource The FHIR resource to update.
776
820
  * @returns The result of the update operation.
777
821
  */
@@ -794,6 +838,7 @@ export declare class MedplumClient extends EventTarget {
794
838
  *
795
839
  * See the JSONPatch specification for full details: https://tools.ietf.org/html/rfc6902
796
840
  *
841
+ * @category Write
797
842
  * @param resourceType The FHIR resource type.
798
843
  * @param id The resource ID.
799
844
  * @param operations The JSONPatch operations.
@@ -811,6 +856,7 @@ export declare class MedplumClient extends EventTarget {
811
856
  *
812
857
  * See the FHIR "delete" operation for full details: https://www.hl7.org/fhir/http.html#delete
813
858
  *
859
+ * @category Delete
814
860
  * @param resourceType The FHIR resource type.
815
861
  * @param id The resource ID.
816
862
  * @returns The result of the delete operation.
@@ -859,7 +905,7 @@ export declare class MedplumClient extends EventTarget {
859
905
  * ```
860
906
  *
861
907
  * See The FHIR "batch/transaction" section for full details: https://hl7.org/fhir/http.html#transaction
862
- *
908
+ * @category Batch
863
909
  * @param bundle The FHIR batch/transaction bundle.
864
910
  * @returns The FHIR batch/transaction response bundle.
865
911
  */
@@ -897,7 +943,7 @@ export declare class MedplumClient extends EventTarget {
897
943
  * ```
898
944
  *
899
945
  * See options here: https://nodemailer.com/extras/mailcomposer/
900
- *
946
+ * @category Media
901
947
  * @param options The MailComposer options.
902
948
  * @returns Promise to the operation outcome.
903
949
  */
@@ -943,6 +989,7 @@ export declare class MedplumClient extends EventTarget {
943
989
  *
944
990
  * See the FHIR GraphQL documentation for FHIR specific details: https://www.hl7.org/fhir/graphql.html
945
991
  *
992
+ * @category Read
946
993
  * @param query The GraphQL query.
947
994
  * @param operationName Optional GraphQL operation name.
948
995
  * @param variables Optional GraphQL variables.
@@ -950,17 +997,47 @@ export declare class MedplumClient extends EventTarget {
950
997
  * @returns The GraphQL result.
951
998
  */
952
999
  graphql(query: string, operationName?: string | null, variables?: any, options?: RequestInit): Promise<any>;
1000
+ /**
1001
+ * @category Authentication
1002
+ * @returns The Login State
1003
+ */
953
1004
  getActiveLogin(): LoginState | undefined;
1005
+ /**
1006
+ * @category Authentication
1007
+ */
954
1008
  setActiveLogin(login: LoginState): Promise<void>;
1009
+ /**
1010
+ * @category Authentication
1011
+ */
955
1012
  getAccessToken(): string | undefined;
1013
+ /**
1014
+ * @category Authentication
1015
+ */
956
1016
  setAccessToken(accessToken: string): void;
1017
+ /**
1018
+ * @category Authentication
1019
+ */
957
1020
  getLogins(): LoginState[];
1021
+ /**
1022
+ * @category Authentication
1023
+ */
958
1024
  isLoading(): boolean;
1025
+ /**
1026
+ * @category User Profile
1027
+ */
959
1028
  getProfile(): ProfileResource | undefined;
1029
+ /**
1030
+ * @category User Profile
1031
+ */
960
1032
  getProfileAsync(): Promise<ProfileResource | undefined>;
1033
+ /**
1034
+ * @category User Profile
1035
+ */
961
1036
  getUserConfiguration(): UserConfiguration | undefined;
962
1037
  /**
963
1038
  * Downloads the URL as a blob.
1039
+ *
1040
+ * @category Read
964
1041
  * @param url The URL to request.
965
1042
  * @returns Promise to the response body as a blob.
966
1043
  */
@@ -974,6 +1051,7 @@ export declare class MedplumClient extends EventTarget {
974
1051
  /**
975
1052
  * Starts a new OAuth2 client credentials flow.
976
1053
  * See: https://datatracker.ietf.org/doc/html/rfc6749#section-4.4
1054
+ * @category Authentication
977
1055
  * @param clientId The client ID.
978
1056
  * @param clientSecret The client secret.
979
1057
  * @returns Promise that resolves to the client profile.
@@ -1,4 +1,7 @@
1
1
  import { CodeableConcept, ObservationDefinition, ObservationDefinitionQualifiedInterval, Patient, Practitioner, QuestionnaireResponse, QuestionnaireResponseItemAnswer, Range, Reference, RelatedPerson, Resource } from '@medplum/fhirtypes';
2
+ /**
3
+ * @internal
4
+ */
2
5
  export declare type ProfileResource = Patient | Practitioner | RelatedPerson;
3
6
  /**
4
7
  * Creates a reference resource.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medplum/core",
3
- "version": "0.9.21",
3
+ "version": "0.9.22",
4
4
  "description": "Medplum TS/JS Library",
5
5
  "author": "Medplum <hello@medplum.com>",
6
6
  "license": "Apache-2.0",
@@ -17,8 +17,8 @@
17
17
  "test": "jest"
18
18
  },
19
19
  "devDependencies": {
20
- "@medplum/definitions": "0.9.21",
21
- "@medplum/fhirtypes": "0.9.21"
20
+ "@medplum/definitions": "0.9.22",
21
+ "@medplum/fhirtypes": "0.9.22"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "pdfmake": "0.2.5"