@medplum/core 0.9.19 → 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.
- package/dist/cjs/index.js +136 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/esm/index.js +136 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/types/client.d.ts +139 -3
- package/dist/types/utils.d.ts +3 -0
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -6184,6 +6184,7 @@ class MedplumClient extends EventTarget {
|
|
|
6184
6184
|
* Returns the current base URL for all API requests.
|
|
6185
6185
|
* By default, this is set to `https://api.medplum.com/`.
|
|
6186
6186
|
* This can be overridden by setting the `baseUrl` option when creating the client.
|
|
6187
|
+
* @category HTTP
|
|
6187
6188
|
* @returns The current base URL for all API requests.
|
|
6188
6189
|
*/
|
|
6189
6190
|
getBaseUrl() {
|
|
@@ -6191,6 +6192,7 @@ class MedplumClient extends EventTarget {
|
|
|
6191
6192
|
}
|
|
6192
6193
|
/**
|
|
6193
6194
|
* Clears all auth state including local storage and session storage.
|
|
6195
|
+
* @category Authentication
|
|
6194
6196
|
*/
|
|
6195
6197
|
clear() {
|
|
6196
6198
|
__classPrivateFieldGet(this, _MedplumClient_storage, "f").clear();
|
|
@@ -6203,6 +6205,7 @@ class MedplumClient extends EventTarget {
|
|
|
6203
6205
|
}
|
|
6204
6206
|
/**
|
|
6205
6207
|
* Invalidates any cached values or cached requests for the given URL.
|
|
6208
|
+
* @category Caching
|
|
6206
6209
|
* @param url The URL to invalidate.
|
|
6207
6210
|
*/
|
|
6208
6211
|
invalidateUrl(url) {
|
|
@@ -6211,6 +6214,7 @@ class MedplumClient extends EventTarget {
|
|
|
6211
6214
|
}
|
|
6212
6215
|
/**
|
|
6213
6216
|
* Invalidates all cached search results or cached requests for the given resourceType.
|
|
6217
|
+
* @category Caching
|
|
6214
6218
|
* @param resourceType The resource type to invalidate.
|
|
6215
6219
|
*/
|
|
6216
6220
|
invalidateSearches(resourceType) {
|
|
@@ -6228,6 +6232,7 @@ class MedplumClient extends EventTarget {
|
|
|
6228
6232
|
* For common operations, we recommend using higher level methods
|
|
6229
6233
|
* such as `readResource()`, `search()`, etc.
|
|
6230
6234
|
*
|
|
6235
|
+
* @category HTTP
|
|
6231
6236
|
* @param url The target URL.
|
|
6232
6237
|
* @param options Optional fetch options.
|
|
6233
6238
|
* @returns Promise to the response content.
|
|
@@ -6249,6 +6254,7 @@ class MedplumClient extends EventTarget {
|
|
|
6249
6254
|
* For common operations, we recommend using higher level methods
|
|
6250
6255
|
* such as `createResource()`.
|
|
6251
6256
|
*
|
|
6257
|
+
* @category HTTP
|
|
6252
6258
|
* @param url The target URL.
|
|
6253
6259
|
* @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
|
|
6254
6260
|
* @param contentType The content type to be included in the "Content-Type" header.
|
|
@@ -6273,6 +6279,7 @@ class MedplumClient extends EventTarget {
|
|
|
6273
6279
|
* For common operations, we recommend using higher level methods
|
|
6274
6280
|
* such as `updateResource()`.
|
|
6275
6281
|
*
|
|
6282
|
+
* @category HTTP
|
|
6276
6283
|
* @param url The target URL.
|
|
6277
6284
|
* @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
|
|
6278
6285
|
* @param contentType The content type to be included in the "Content-Type" header.
|
|
@@ -6297,6 +6304,7 @@ class MedplumClient extends EventTarget {
|
|
|
6297
6304
|
* For common operations, we recommend using higher level methods
|
|
6298
6305
|
* such as `patchResource()`.
|
|
6299
6306
|
*
|
|
6307
|
+
* @category HTTP
|
|
6300
6308
|
* @param url The target URL.
|
|
6301
6309
|
* @param operations Array of JSONPatch operations.
|
|
6302
6310
|
* @param options Optional fetch options.
|
|
@@ -6312,10 +6320,12 @@ class MedplumClient extends EventTarget {
|
|
|
6312
6320
|
/**
|
|
6313
6321
|
* Makes an HTTP DELETE request to the specified URL.
|
|
6314
6322
|
*
|
|
6323
|
+
*
|
|
6315
6324
|
* This is a lower level method for custom requests.
|
|
6316
6325
|
* For common operations, we recommend using higher level methods
|
|
6317
6326
|
* such as `deleteResource()`.
|
|
6318
6327
|
*
|
|
6328
|
+
* @category HTTP
|
|
6319
6329
|
* @param url The target URL.
|
|
6320
6330
|
* @param options Optional fetch options.
|
|
6321
6331
|
* @returns Promise to the response content.
|
|
@@ -6327,6 +6337,7 @@ class MedplumClient extends EventTarget {
|
|
|
6327
6337
|
}
|
|
6328
6338
|
/**
|
|
6329
6339
|
* Tries to register a new user.
|
|
6340
|
+
* @category Authentication
|
|
6330
6341
|
* @param request The registration request.
|
|
6331
6342
|
* @returns Promise to the authentication response.
|
|
6332
6343
|
*/
|
|
@@ -6338,31 +6349,36 @@ class MedplumClient extends EventTarget {
|
|
|
6338
6349
|
}
|
|
6339
6350
|
/**
|
|
6340
6351
|
* Initiates a user login flow.
|
|
6352
|
+
* @category Authentication
|
|
6341
6353
|
* @param loginRequest Login request including email and password.
|
|
6342
6354
|
* @returns Promise to the authentication response.
|
|
6343
6355
|
*/
|
|
6344
6356
|
startLogin(loginRequest) {
|
|
6357
|
+
var _a, _b;
|
|
6345
6358
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6346
6359
|
yield __classPrivateFieldGet(this, _MedplumClient_instances, "m", _MedplumClient_startPkce).call(this);
|
|
6347
|
-
return this.post('auth/login', Object.assign(Object.assign({}, loginRequest), { clientId: __classPrivateFieldGet(this, _MedplumClient_clientId, "f"), scope: DEFAULT_SCOPE, codeChallengeMethod: 'S256', codeChallenge: __classPrivateFieldGet(this, _MedplumClient_storage, "f").getString('codeChallenge') }));
|
|
6360
|
+
return this.post('auth/login', Object.assign(Object.assign({}, loginRequest), { clientId: (_a = loginRequest.clientId) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _MedplumClient_clientId, "f"), scope: (_b = loginRequest.scope) !== null && _b !== void 0 ? _b : DEFAULT_SCOPE, codeChallengeMethod: 'S256', codeChallenge: __classPrivateFieldGet(this, _MedplumClient_storage, "f").getString('codeChallenge') }));
|
|
6348
6361
|
});
|
|
6349
6362
|
}
|
|
6350
6363
|
/**
|
|
6351
6364
|
* Tries to sign in with Google authentication.
|
|
6352
6365
|
* The response parameter is the result of a Google authentication.
|
|
6353
6366
|
* See: https://developers.google.com/identity/gsi/web/guides/handle-credential-responses-js-functions
|
|
6354
|
-
* @
|
|
6367
|
+
* @category Authentication
|
|
6368
|
+
* @param loginRequest Login request including Google credential response.
|
|
6355
6369
|
* @returns Promise to the authentication response.
|
|
6356
6370
|
*/
|
|
6357
|
-
startGoogleLogin(
|
|
6371
|
+
startGoogleLogin(loginRequest) {
|
|
6372
|
+
var _a, _b;
|
|
6358
6373
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6359
6374
|
yield __classPrivateFieldGet(this, _MedplumClient_instances, "m", _MedplumClient_startPkce).call(this);
|
|
6360
|
-
return this.post('auth/google',
|
|
6375
|
+
return this.post('auth/google', Object.assign(Object.assign({}, loginRequest), { clientId: (_a = loginRequest.clientId) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _MedplumClient_clientId, "f"), scope: (_b = loginRequest.scope) !== null && _b !== void 0 ? _b : DEFAULT_SCOPE }));
|
|
6361
6376
|
});
|
|
6362
6377
|
}
|
|
6363
6378
|
/**
|
|
6364
6379
|
* Signs out locally.
|
|
6365
6380
|
* Does not invalidate tokens with the server.
|
|
6381
|
+
* @category Authentication
|
|
6366
6382
|
*/
|
|
6367
6383
|
signOut() {
|
|
6368
6384
|
this.clear();
|
|
@@ -6372,6 +6388,7 @@ class MedplumClient extends EventTarget {
|
|
|
6372
6388
|
* Tries to sign in the user.
|
|
6373
6389
|
* Returns true if the user is signed in.
|
|
6374
6390
|
* This may result in navigating away to the sign in page.
|
|
6391
|
+
* @category Authentication
|
|
6375
6392
|
*/
|
|
6376
6393
|
signInWithRedirect() {
|
|
6377
6394
|
const urlParams = new URLSearchParams(window.location.search);
|
|
@@ -6387,6 +6404,7 @@ class MedplumClient extends EventTarget {
|
|
|
6387
6404
|
/**
|
|
6388
6405
|
* Tries to sign out the user.
|
|
6389
6406
|
* See: https://docs.aws.amazon.com/cognito/latest/developerguide/logout-endpoint.html
|
|
6407
|
+
* @category Authentication
|
|
6390
6408
|
*/
|
|
6391
6409
|
signOutWithRedirect() {
|
|
6392
6410
|
window.location.assign(__classPrivateFieldGet(this, _MedplumClient_logoutUrl, "f"));
|
|
@@ -6394,6 +6412,7 @@ class MedplumClient extends EventTarget {
|
|
|
6394
6412
|
/**
|
|
6395
6413
|
* Builds a FHIR URL from a collection of URL path components.
|
|
6396
6414
|
* For example, `buildUrl('/Patient', '123')` returns `fhir/R4/Patient/123`.
|
|
6415
|
+
* @category HTTP
|
|
6397
6416
|
* @param path The path component of the URL.
|
|
6398
6417
|
* @returns The well-formed FHIR URL.
|
|
6399
6418
|
*/
|
|
@@ -6402,6 +6421,8 @@ class MedplumClient extends EventTarget {
|
|
|
6402
6421
|
}
|
|
6403
6422
|
/**
|
|
6404
6423
|
* Builds a FHIR search URL from a search query or structured query object.
|
|
6424
|
+
* @category HTTP
|
|
6425
|
+
* @category Search
|
|
6405
6426
|
* @param query The FHIR search query or structured query object.
|
|
6406
6427
|
* @returns The well-formed FHIR URL.
|
|
6407
6428
|
*/
|
|
@@ -6449,6 +6470,7 @@ class MedplumClient extends EventTarget {
|
|
|
6449
6470
|
*
|
|
6450
6471
|
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
6451
6472
|
*
|
|
6473
|
+
* @category Search
|
|
6452
6474
|
* @param query The search query as either a string or a structured search object.
|
|
6453
6475
|
* @returns Promise to the search result bundle.
|
|
6454
6476
|
*/
|
|
@@ -6471,6 +6493,7 @@ class MedplumClient extends EventTarget {
|
|
|
6471
6493
|
*
|
|
6472
6494
|
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
6473
6495
|
*
|
|
6496
|
+
* @category Search
|
|
6474
6497
|
* @param query The search query as either a string or a structured search object.
|
|
6475
6498
|
* @returns Promise to the search result bundle.
|
|
6476
6499
|
*/
|
|
@@ -6503,6 +6526,7 @@ class MedplumClient extends EventTarget {
|
|
|
6503
6526
|
*
|
|
6504
6527
|
* See FHIR search for full details: https://www.hl7.org/fhir/search.html
|
|
6505
6528
|
*
|
|
6529
|
+
* @category Search
|
|
6506
6530
|
* @param query The search query as either a string or a structured search object.
|
|
6507
6531
|
* @returns Promise to the search result bundle.
|
|
6508
6532
|
*/
|
|
@@ -6520,6 +6544,8 @@ class MedplumClient extends EventTarget {
|
|
|
6520
6544
|
/**
|
|
6521
6545
|
* Searches a ValueSet resource using the "expand" operation.
|
|
6522
6546
|
* See: https://www.hl7.org/fhir/operation-valueset-expand.html
|
|
6547
|
+
*
|
|
6548
|
+
* @category Search
|
|
6523
6549
|
* @param system The ValueSet system url.
|
|
6524
6550
|
* @param filter The search string.
|
|
6525
6551
|
* @returns Promise to expanded ValueSet.
|
|
@@ -6532,6 +6558,7 @@ class MedplumClient extends EventTarget {
|
|
|
6532
6558
|
}
|
|
6533
6559
|
/**
|
|
6534
6560
|
* Returns a cached resource if it is available.
|
|
6561
|
+
* @category Caching
|
|
6535
6562
|
* @param resourceType The FHIR resource type.
|
|
6536
6563
|
* @param id The FHIR resource ID.
|
|
6537
6564
|
* @returns The resource if it is available in the cache; undefined otherwise.
|
|
@@ -6543,6 +6570,7 @@ class MedplumClient extends EventTarget {
|
|
|
6543
6570
|
}
|
|
6544
6571
|
/**
|
|
6545
6572
|
* Returns a cached resource if it is available.
|
|
6573
|
+
* @category Caching
|
|
6546
6574
|
* @param resourceType The FHIR resource type.
|
|
6547
6575
|
* @param id The FHIR resource ID.
|
|
6548
6576
|
* @returns The resource if it is available in the cache; undefined otherwise.
|
|
@@ -6570,6 +6598,7 @@ class MedplumClient extends EventTarget {
|
|
|
6570
6598
|
*
|
|
6571
6599
|
* See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
|
|
6572
6600
|
*
|
|
6601
|
+
* @category Caching
|
|
6573
6602
|
* @param resourceType The FHIR resource type.
|
|
6574
6603
|
* @param id The resource ID.
|
|
6575
6604
|
* @returns The resource if available; undefined otherwise.
|
|
@@ -6592,6 +6621,7 @@ class MedplumClient extends EventTarget {
|
|
|
6592
6621
|
*
|
|
6593
6622
|
* See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html#read
|
|
6594
6623
|
*
|
|
6624
|
+
* @category Read
|
|
6595
6625
|
* @param reference The FHIR reference object.
|
|
6596
6626
|
* @returns The resource if available; undefined otherwise.
|
|
6597
6627
|
*/
|
|
@@ -6610,6 +6640,7 @@ class MedplumClient extends EventTarget {
|
|
|
6610
6640
|
* Returns a cached schema for a resource type.
|
|
6611
6641
|
* If the schema is not cached, returns undefined.
|
|
6612
6642
|
* It is assumed that a client will call requestSchema before using this method.
|
|
6643
|
+
* @category Schema
|
|
6613
6644
|
* @param resourceType The FHIR resource type.
|
|
6614
6645
|
* @returns The schema if immediately available, undefined otherwise.
|
|
6615
6646
|
* @deprecated Use globalSchema instead.
|
|
@@ -6620,6 +6651,7 @@ class MedplumClient extends EventTarget {
|
|
|
6620
6651
|
/**
|
|
6621
6652
|
* Requests the schema for a resource type.
|
|
6622
6653
|
* If the schema is already cached, the promise is resolved immediately.
|
|
6654
|
+
* @category Schema
|
|
6623
6655
|
* @param resourceType The FHIR resource type.
|
|
6624
6656
|
* @returns Promise to a schema with the requested resource type.
|
|
6625
6657
|
*/
|
|
@@ -6681,6 +6713,7 @@ class MedplumClient extends EventTarget {
|
|
|
6681
6713
|
*
|
|
6682
6714
|
* See the FHIR "history" operation for full details: https://www.hl7.org/fhir/http.html#history
|
|
6683
6715
|
*
|
|
6716
|
+
* @category Read
|
|
6684
6717
|
* @param resourceType The FHIR resource type.
|
|
6685
6718
|
* @param id The resource ID.
|
|
6686
6719
|
* @returns Promise to the resource history.
|
|
@@ -6700,6 +6733,7 @@ class MedplumClient extends EventTarget {
|
|
|
6700
6733
|
*
|
|
6701
6734
|
* See the FHIR "vread" operation for full details: https://www.hl7.org/fhir/http.html#vread
|
|
6702
6735
|
*
|
|
6736
|
+
* @category Read
|
|
6703
6737
|
* @param resourceType The FHIR resource type.
|
|
6704
6738
|
* @param id The resource ID.
|
|
6705
6739
|
* @returns The resource if available; undefined otherwise.
|
|
@@ -6707,6 +6741,12 @@ class MedplumClient extends EventTarget {
|
|
|
6707
6741
|
readVersion(resourceType, id, vid) {
|
|
6708
6742
|
return this.get(this.fhirUrl(resourceType, id, '_history', vid));
|
|
6709
6743
|
}
|
|
6744
|
+
/**
|
|
6745
|
+
*
|
|
6746
|
+
* @category Read
|
|
6747
|
+
* @param id The Patient Id
|
|
6748
|
+
* @returns A Bundle of all Resources related to the Patient
|
|
6749
|
+
*/
|
|
6710
6750
|
readPatientEverything(id) {
|
|
6711
6751
|
return this.get(this.fhirUrl('Patient', id, '$everything'));
|
|
6712
6752
|
}
|
|
@@ -6730,6 +6770,7 @@ class MedplumClient extends EventTarget {
|
|
|
6730
6770
|
*
|
|
6731
6771
|
* See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
|
|
6732
6772
|
*
|
|
6773
|
+
* @category Create
|
|
6733
6774
|
* @param resource The FHIR resource to create.
|
|
6734
6775
|
* @returns The result of the create operation.
|
|
6735
6776
|
*/
|
|
@@ -6774,6 +6815,7 @@ class MedplumClient extends EventTarget {
|
|
|
6774
6815
|
*
|
|
6775
6816
|
* See the FHIR "conditional create" operation for full details: https://www.hl7.org/fhir/http.html#ccreate
|
|
6776
6817
|
*
|
|
6818
|
+
* @category Create
|
|
6777
6819
|
* @param resource The FHIR resource to create.
|
|
6778
6820
|
* @param query The search query for an equivalent resource.
|
|
6779
6821
|
* @returns The result of the create operation.
|
|
@@ -6802,6 +6844,7 @@ class MedplumClient extends EventTarget {
|
|
|
6802
6844
|
*
|
|
6803
6845
|
* See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
|
|
6804
6846
|
*
|
|
6847
|
+
* @category Create
|
|
6805
6848
|
* @param data The binary data to upload.
|
|
6806
6849
|
* @param filename Optional filename for the binary.
|
|
6807
6850
|
* @param contentType Content type for the binary.
|
|
@@ -6832,6 +6875,7 @@ class MedplumClient extends EventTarget {
|
|
|
6832
6875
|
*
|
|
6833
6876
|
* See the pdfmake document definition for full details: https://pdfmake.github.io/docs/0.1/document-definition-object/
|
|
6834
6877
|
*
|
|
6878
|
+
* @category Media
|
|
6835
6879
|
* @param docDefinition The PDF document definition.
|
|
6836
6880
|
* @returns The result of the create operation.
|
|
6837
6881
|
*/
|
|
@@ -6849,6 +6893,7 @@ class MedplumClient extends EventTarget {
|
|
|
6849
6893
|
*
|
|
6850
6894
|
* This is a convenience method to handle commmon cases where a `Communication` resource is created with a `payload`.
|
|
6851
6895
|
*
|
|
6896
|
+
* @category Create
|
|
6852
6897
|
* @param resource The FHIR resource to comment on.
|
|
6853
6898
|
* @param text The text of the comment.
|
|
6854
6899
|
* @returns The result of the create operation.
|
|
@@ -6899,6 +6944,7 @@ class MedplumClient extends EventTarget {
|
|
|
6899
6944
|
*
|
|
6900
6945
|
* See the FHIR "update" operation for full details: https://www.hl7.org/fhir/http.html#update
|
|
6901
6946
|
*
|
|
6947
|
+
* @category Write
|
|
6902
6948
|
* @param resource The FHIR resource to update.
|
|
6903
6949
|
* @returns The result of the update operation.
|
|
6904
6950
|
*/
|
|
@@ -6930,6 +6976,7 @@ class MedplumClient extends EventTarget {
|
|
|
6930
6976
|
*
|
|
6931
6977
|
* See the JSONPatch specification for full details: https://tools.ietf.org/html/rfc6902
|
|
6932
6978
|
*
|
|
6979
|
+
* @category Write
|
|
6933
6980
|
* @param resourceType The FHIR resource type.
|
|
6934
6981
|
* @param id The resource ID.
|
|
6935
6982
|
* @param operations The JSONPatch operations.
|
|
@@ -6950,6 +6997,7 @@ class MedplumClient extends EventTarget {
|
|
|
6950
6997
|
*
|
|
6951
6998
|
* See the FHIR "delete" operation for full details: https://www.hl7.org/fhir/http.html#delete
|
|
6952
6999
|
*
|
|
7000
|
+
* @category Delete
|
|
6953
7001
|
* @param resourceType The FHIR resource type.
|
|
6954
7002
|
* @param id The resource ID.
|
|
6955
7003
|
* @returns The result of the delete operation.
|
|
@@ -6958,6 +7006,56 @@ class MedplumClient extends EventTarget {
|
|
|
6958
7006
|
this.invalidateSearches(resourceType);
|
|
6959
7007
|
return this.delete(this.fhirUrl(resourceType, id));
|
|
6960
7008
|
}
|
|
7009
|
+
/**
|
|
7010
|
+
* Executes a batch or transaction of FHIR operations.
|
|
7011
|
+
*
|
|
7012
|
+
* Example:
|
|
7013
|
+
*
|
|
7014
|
+
* ```typescript
|
|
7015
|
+
* await medplum.executeBatch({
|
|
7016
|
+
* "resourceType": "Bundle",
|
|
7017
|
+
* "type": "transaction",
|
|
7018
|
+
* "entry": [
|
|
7019
|
+
* {
|
|
7020
|
+
* "fullUrl": "urn:uuid:61ebe359-bfdc-4613-8bf2-c5e300945f0a",
|
|
7021
|
+
* "resource": {
|
|
7022
|
+
* "resourceType": "Patient",
|
|
7023
|
+
* "name": [{ "use": "official", "given": ["Alice"], "family": "Smith" }],
|
|
7024
|
+
* "gender": "female",
|
|
7025
|
+
* "birthDate": "1974-12-25"
|
|
7026
|
+
* },
|
|
7027
|
+
* "request": {
|
|
7028
|
+
* "method": "POST",
|
|
7029
|
+
* "url": "Patient"
|
|
7030
|
+
* }
|
|
7031
|
+
* },
|
|
7032
|
+
* {
|
|
7033
|
+
* "fullUrl": "urn:uuid:88f151c0-a954-468a-88bd-5ae15c08e059",
|
|
7034
|
+
* "resource": {
|
|
7035
|
+
* "resourceType": "Patient",
|
|
7036
|
+
* "identifier": [{ "system": "http:/example.org/fhir/ids", "value": "234234" }],
|
|
7037
|
+
* "name": [{ "use": "official", "given": ["Bob"], "family": "Jones" }],
|
|
7038
|
+
* "gender": "male",
|
|
7039
|
+
* "birthDate": "1974-12-25"
|
|
7040
|
+
* },
|
|
7041
|
+
* "request": {
|
|
7042
|
+
* "method": "POST",
|
|
7043
|
+
* "url": "Patient",
|
|
7044
|
+
* "ifNoneExist": "identifier=http:/example.org/fhir/ids|234234"
|
|
7045
|
+
* }
|
|
7046
|
+
* }
|
|
7047
|
+
* ]
|
|
7048
|
+
* });
|
|
7049
|
+
* ```
|
|
7050
|
+
*
|
|
7051
|
+
* See The FHIR "batch/transaction" section for full details: https://hl7.org/fhir/http.html#transaction
|
|
7052
|
+
* @category Batch
|
|
7053
|
+
* @param bundle The FHIR batch/transaction bundle.
|
|
7054
|
+
* @returns The FHIR batch/transaction response bundle.
|
|
7055
|
+
*/
|
|
7056
|
+
executeBatch(bundle) {
|
|
7057
|
+
return this.post('fhir/R4', bundle);
|
|
7058
|
+
}
|
|
6961
7059
|
/**
|
|
6962
7060
|
* Sends an email using the Medplum Email API.
|
|
6963
7061
|
*
|
|
@@ -6991,7 +7089,7 @@ class MedplumClient extends EventTarget {
|
|
|
6991
7089
|
* ```
|
|
6992
7090
|
*
|
|
6993
7091
|
* See options here: https://nodemailer.com/extras/mailcomposer/
|
|
6994
|
-
*
|
|
7092
|
+
* @category Media
|
|
6995
7093
|
* @param options The MailComposer options.
|
|
6996
7094
|
* @returns Promise to the operation outcome.
|
|
6997
7095
|
*/
|
|
@@ -7039,6 +7137,7 @@ class MedplumClient extends EventTarget {
|
|
|
7039
7137
|
*
|
|
7040
7138
|
* See the FHIR GraphQL documentation for FHIR specific details: https://www.hl7.org/fhir/graphql.html
|
|
7041
7139
|
*
|
|
7140
|
+
* @category Read
|
|
7042
7141
|
* @param query The GraphQL query.
|
|
7043
7142
|
* @param operationName Optional GraphQL operation name.
|
|
7044
7143
|
* @param variables Optional GraphQL variables.
|
|
@@ -7048,9 +7147,16 @@ class MedplumClient extends EventTarget {
|
|
|
7048
7147
|
graphql(query, operationName, variables, options) {
|
|
7049
7148
|
return this.post(this.fhirUrl('$graphql'), { query, operationName, variables }, JSON_CONTENT_TYPE, options);
|
|
7050
7149
|
}
|
|
7150
|
+
/**
|
|
7151
|
+
* @category Authentication
|
|
7152
|
+
* @returns The Login State
|
|
7153
|
+
*/
|
|
7051
7154
|
getActiveLogin() {
|
|
7052
7155
|
return __classPrivateFieldGet(this, _MedplumClient_storage, "f").getObject('activeLogin');
|
|
7053
7156
|
}
|
|
7157
|
+
/**
|
|
7158
|
+
* @category Authentication
|
|
7159
|
+
*/
|
|
7054
7160
|
setActiveLogin(login) {
|
|
7055
7161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7056
7162
|
__classPrivateFieldSet(this, _MedplumClient_accessToken, login.accessToken, "f");
|
|
@@ -7064,25 +7170,43 @@ class MedplumClient extends EventTarget {
|
|
|
7064
7170
|
yield __classPrivateFieldGet(this, _MedplumClient_instances, "m", _MedplumClient_refreshProfile).call(this);
|
|
7065
7171
|
});
|
|
7066
7172
|
}
|
|
7173
|
+
/**
|
|
7174
|
+
* @category Authentication
|
|
7175
|
+
*/
|
|
7067
7176
|
getAccessToken() {
|
|
7068
7177
|
return __classPrivateFieldGet(this, _MedplumClient_accessToken, "f");
|
|
7069
7178
|
}
|
|
7179
|
+
/**
|
|
7180
|
+
* @category Authentication
|
|
7181
|
+
*/
|
|
7070
7182
|
setAccessToken(accessToken) {
|
|
7071
7183
|
__classPrivateFieldSet(this, _MedplumClient_accessToken, accessToken, "f");
|
|
7072
7184
|
__classPrivateFieldSet(this, _MedplumClient_refreshToken, undefined, "f");
|
|
7073
7185
|
__classPrivateFieldSet(this, _MedplumClient_profile, undefined, "f");
|
|
7074
7186
|
__classPrivateFieldSet(this, _MedplumClient_config, undefined, "f");
|
|
7075
7187
|
}
|
|
7188
|
+
/**
|
|
7189
|
+
* @category Authentication
|
|
7190
|
+
*/
|
|
7076
7191
|
getLogins() {
|
|
7077
7192
|
var _a;
|
|
7078
7193
|
return (_a = __classPrivateFieldGet(this, _MedplumClient_storage, "f").getObject('logins')) !== null && _a !== void 0 ? _a : [];
|
|
7079
7194
|
}
|
|
7195
|
+
/**
|
|
7196
|
+
* @category Authentication
|
|
7197
|
+
*/
|
|
7080
7198
|
isLoading() {
|
|
7081
7199
|
return !!__classPrivateFieldGet(this, _MedplumClient_profilePromise, "f");
|
|
7082
7200
|
}
|
|
7201
|
+
/**
|
|
7202
|
+
* @category User Profile
|
|
7203
|
+
*/
|
|
7083
7204
|
getProfile() {
|
|
7084
7205
|
return __classPrivateFieldGet(this, _MedplumClient_profile, "f");
|
|
7085
7206
|
}
|
|
7207
|
+
/**
|
|
7208
|
+
* @category User Profile
|
|
7209
|
+
*/
|
|
7086
7210
|
getProfileAsync() {
|
|
7087
7211
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7088
7212
|
if (__classPrivateFieldGet(this, _MedplumClient_profilePromise, "f")) {
|
|
@@ -7091,11 +7215,16 @@ class MedplumClient extends EventTarget {
|
|
|
7091
7215
|
return this.getProfile();
|
|
7092
7216
|
});
|
|
7093
7217
|
}
|
|
7218
|
+
/**
|
|
7219
|
+
* @category User Profile
|
|
7220
|
+
*/
|
|
7094
7221
|
getUserConfiguration() {
|
|
7095
7222
|
return __classPrivateFieldGet(this, _MedplumClient_config, "f");
|
|
7096
7223
|
}
|
|
7097
7224
|
/**
|
|
7098
7225
|
* Downloads the URL as a blob.
|
|
7226
|
+
*
|
|
7227
|
+
* @category Read
|
|
7099
7228
|
* @param url The URL to request.
|
|
7100
7229
|
* @returns Promise to the response body as a blob.
|
|
7101
7230
|
*/
|
|
@@ -7136,6 +7265,7 @@ class MedplumClient extends EventTarget {
|
|
|
7136
7265
|
/**
|
|
7137
7266
|
* Starts a new OAuth2 client credentials flow.
|
|
7138
7267
|
* See: https://datatracker.ietf.org/doc/html/rfc6749#section-4.4
|
|
7268
|
+
* @category Authentication
|
|
7139
7269
|
* @param clientId The client ID.
|
|
7140
7270
|
* @param clientSecret The client secret.
|
|
7141
7271
|
* @returns Promise that resolves to the client profile.
|
|
@@ -7343,6 +7473,7 @@ _MedplumClient_fetch = new WeakMap(), _MedplumClient_createPdf = new WeakMap(),
|
|
|
7343
7473
|
};
|
|
7344
7474
|
/**
|
|
7345
7475
|
* Returns the base URL for the current page.
|
|
7476
|
+
* @category HTTP
|
|
7346
7477
|
*/
|
|
7347
7478
|
function getBaseUrl() {
|
|
7348
7479
|
return window.location.protocol + '//' + window.location.host + '/';
|