@medplum/core 0.10.2 → 1.0.1

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.
@@ -8,6 +8,7 @@ export interface SearchRequest {
8
8
  fields?: string[];
9
9
  name?: string;
10
10
  total?: 'none' | 'estimate' | 'accurate';
11
+ revInclude?: string;
11
12
  }
12
13
  export interface Filter {
13
14
  code: string;
@@ -26,7 +26,7 @@ export declare function resolveId(reference: Reference | undefined): string | un
26
26
  * @param resource The FHIR resource.
27
27
  * @returns True if the resource is a "ProfileResource".
28
28
  */
29
- export declare function isProfileResource(resource: Resource): boolean;
29
+ export declare function isProfileResource(resource: Resource): resource is ProfileResource;
30
30
  /**
31
31
  * Returns a display string for the resource.
32
32
  * @param resource The input resource.
@@ -203,6 +203,13 @@ export declare function findObservationReferenceRange(definition: ObservationDef
203
203
  * @returns True if the value is within the range.
204
204
  */
205
205
  export declare function matchesRange(value: number, range: Range, precision?: number): boolean;
206
+ /**
207
+ * Returns the input number rounded to the specified number of digits.
208
+ * @param a The input number.
209
+ * @param precision The precision in number of digits.
210
+ * @returns The number rounded to the specified number of digits.
211
+ */
212
+ export declare function preciseRound(a: number, precision: number): number;
206
213
  /**
207
214
  * Returns true if the two numbers are equal to the given precision.
208
215
  * @param a The first number.
@@ -136,16 +136,21 @@ export interface CreatePdfFunction {
136
136
  [name: string]: CustomTableLayout;
137
137
  } | undefined, fonts?: TFontDictionary | undefined): Promise<any>;
138
138
  }
139
- export interface LoginRequest {
140
- readonly email: string;
141
- readonly password: string;
142
- readonly remember?: boolean;
139
+ export interface BaseLoginRequest {
143
140
  readonly projectId?: string;
144
141
  readonly clientId?: string;
142
+ readonly resourceType?: string;
145
143
  readonly scope?: string;
146
144
  readonly nonce?: string;
147
145
  readonly codeChallenge?: string;
148
146
  readonly codeChallengeMethod?: string;
147
+ readonly googleClientId?: string;
148
+ readonly launch?: string;
149
+ }
150
+ export interface EmailPasswordLoginRequest extends BaseLoginRequest {
151
+ readonly email: string;
152
+ readonly password: string;
153
+ readonly remember?: boolean;
149
154
  }
150
155
  export interface NewUserRequest {
151
156
  readonly firstName: string;
@@ -169,15 +174,9 @@ export interface GoogleCredentialResponse {
169
174
  readonly clientId: string;
170
175
  readonly credential: string;
171
176
  }
172
- export interface GoogleLoginRequest {
177
+ export interface GoogleLoginRequest extends BaseLoginRequest {
173
178
  readonly googleClientId: string;
174
179
  readonly googleCredential: string;
175
- readonly projectId?: string;
176
- readonly clientId?: string;
177
- readonly scope?: string;
178
- readonly nonce?: string;
179
- readonly codeChallenge?: string;
180
- readonly codeChallengeMethod?: string;
181
180
  readonly createUser?: boolean;
182
181
  }
183
182
  export interface LoginAuthenticationResponse {
@@ -316,6 +315,11 @@ export interface MailOptions {
316
315
  * const bundle = await medplum.search('Patient', 'name=Alice');
317
316
  * console.log(bundle.total);
318
317
  * ```
318
+ *
319
+ * <head>
320
+ * <meta name="algolia:pageRank" content="100" />
321
+ * </head>
322
+
319
323
  */
320
324
  export declare class MedplumClient extends EventTarget {
321
325
  #private;
@@ -452,7 +456,7 @@ export declare class MedplumClient extends EventTarget {
452
456
  * @param loginRequest Login request including email and password.
453
457
  * @returns Promise to the authentication response.
454
458
  */
455
- startLogin(loginRequest: LoginRequest): Promise<LoginAuthenticationResponse>;
459
+ startLogin(loginRequest: EmailPasswordLoginRequest): Promise<LoginAuthenticationResponse>;
456
460
  /**
457
461
  * Tries to sign in with Google authentication.
458
462
  * The response parameter is the result of a Google authentication.
@@ -462,7 +466,7 @@ export declare class MedplumClient extends EventTarget {
462
466
  * @returns Promise to the authentication response.
463
467
  */
464
468
  startGoogleLogin(loginRequest: GoogleLoginRequest): Promise<LoginAuthenticationResponse>;
465
- getCodeChallenge(loginRequest: LoginRequest | GoogleLoginRequest): {
469
+ getCodeChallenge(loginRequest: BaseLoginRequest): {
466
470
  codeChallenge?: string;
467
471
  codeChallengeMethod?: string;
468
472
  };
@@ -544,7 +548,9 @@ export declare class MedplumClient extends EventTarget {
544
548
  * See FHIR search for full details: https://www.hl7.org/fhir/search.html
545
549
  *
546
550
  * @category Search
551
+ * @param resourceType The FHIR resource type.
547
552
  * @param query The search query as either a string or a structured search object.
553
+ * @param options Optional fetch options.
548
554
  * @returns Promise to the search result bundle.
549
555
  */
550
556
  search<K extends ResourceType>(resourceType: K, query?: URLSearchParams | string, options?: RequestInit): ReadablePromise<Bundle<ExtractResource<K>>>;
@@ -565,7 +571,9 @@ export declare class MedplumClient extends EventTarget {
565
571
  * See FHIR search for full details: https://www.hl7.org/fhir/search.html
566
572
  *
567
573
  * @category Search
574
+ * @param resourceType The FHIR resource type.
568
575
  * @param query The search query as either a string or a structured search object.
576
+ * @param options Optional fetch options.
569
577
  * @returns Promise to the search result bundle.
570
578
  */
571
579
  searchOne<K extends ResourceType>(resourceType: K, query?: URLSearchParams | string, options?: RequestInit): ReadablePromise<ExtractResource<K> | undefined>;
@@ -586,7 +594,9 @@ export declare class MedplumClient extends EventTarget {
586
594
  * See FHIR search for full details: https://www.hl7.org/fhir/search.html
587
595
  *
588
596
  * @category Search
597
+ * @param resourceType The FHIR resource type.
589
598
  * @param query The search query as either a string or a structured search object.
599
+ * @param options Optional fetch options.
590
600
  * @returns Promise to the search result bundle.
591
601
  */
592
602
  searchResources<K extends ResourceType>(resourceType: K, query?: URLSearchParams | string, options?: RequestInit): ReadablePromise<ExtractResource<K>[]>;
@@ -597,6 +607,7 @@ export declare class MedplumClient extends EventTarget {
597
607
  * @category Search
598
608
  * @param system The ValueSet system url.
599
609
  * @param filter The search string.
610
+ * @param options Optional fetch options.
600
611
  * @returns Promise to expanded ValueSet.
601
612
  */
602
613
  searchValueSet(system: string, filter: string, options?: RequestInit): ReadablePromise<ValueSet>;
@@ -631,6 +642,7 @@ export declare class MedplumClient extends EventTarget {
631
642
  * @category Read
632
643
  * @param resourceType The FHIR resource type.
633
644
  * @param id The resource ID.
645
+ * @param options Optional fetch options.
634
646
  * @returns The resource if available; undefined otherwise.
635
647
  */
636
648
  readResource<K extends ResourceType>(resourceType: K, id: string, options?: RequestInit): ReadablePromise<ExtractResource<K>>;
@@ -651,6 +663,7 @@ export declare class MedplumClient extends EventTarget {
651
663
  *
652
664
  * @category Read
653
665
  * @param reference The FHIR reference object.
666
+ * @param options Optional fetch options.
654
667
  * @returns The resource if available; undefined otherwise.
655
668
  */
656
669
  readReference<T extends Resource>(reference: Reference<T>, options?: RequestInit): ReadablePromise<T>;
@@ -659,7 +672,6 @@ export declare class MedplumClient extends EventTarget {
659
672
  * If the schema is not cached, returns undefined.
660
673
  * It is assumed that a client will call requestSchema before using this method.
661
674
  * @category Schema
662
- * @param resourceType The FHIR resource type.
663
675
  * @returns The schema if immediately available, undefined otherwise.
664
676
  * @deprecated Use globalSchema instead.
665
677
  */
@@ -689,6 +701,7 @@ export declare class MedplumClient extends EventTarget {
689
701
  * @category Read
690
702
  * @param resourceType The FHIR resource type.
691
703
  * @param id The resource ID.
704
+ * @param options Optional fetch options.
692
705
  * @returns Promise to the resource history.
693
706
  */
694
707
  readHistory<K extends ResourceType>(resourceType: K, id: string, options?: RequestInit): ReadablePromise<Bundle<ExtractResource<K>>>;
@@ -707,13 +720,26 @@ export declare class MedplumClient extends EventTarget {
707
720
  * @category Read
708
721
  * @param resourceType The FHIR resource type.
709
722
  * @param id The resource ID.
723
+ * @param vid The version ID.
724
+ * @param options Optional fetch options.
710
725
  * @returns The resource if available; undefined otherwise.
711
726
  */
712
727
  readVersion<K extends ResourceType>(resourceType: K, id: string, vid: string, options?: RequestInit): ReadablePromise<ExtractResource<K>>;
713
728
  /**
729
+ * Executes the Patient "everything" operation for a patient.
730
+ *
731
+ * Example:
732
+ *
733
+ * ```typescript
734
+ * const bundle = await medplum.readPatientEverything('123');
735
+ * console.log(bundle);
736
+ * ```
737
+ *
738
+ * See the FHIR "patient-everything" operation for full details: https://hl7.org/fhir/operation-patient-everything.html
714
739
  *
715
740
  * @category Read
716
741
  * @param id The Patient Id
742
+ * @param options Optional fetch options.
717
743
  * @returns A Bundle of all Resources related to the Patient
718
744
  */
719
745
  readPatientEverything(id: string, options?: RequestInit): ReadablePromise<Bundle>;
@@ -807,7 +833,8 @@ export declare class MedplumClient extends EventTarget {
807
833
  * @param contentType Content type for the binary.
808
834
  * @returns The result of the create operation.
809
835
  */
810
- createBinary(data: string | File | Blob | Uint8Array, filename: string | undefined, contentType: string): Promise<Binary>;
836
+ createBinary(data: string | File | Blob | Uint8Array, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void): Promise<Binary>;
837
+ uploadwithProgress(url: URL, data: string | File | Blob | Uint8Array, contentType: string, onProgress: (e: ProgressEvent) => void): Promise<any>;
811
838
  /**
812
839
  * Creates a PDF as a FHIR `Binary` resource based on pdfmake document definition.
813
840
  *
@@ -912,6 +939,24 @@ export declare class MedplumClient extends EventTarget {
912
939
  * @returns The result of the delete operation.
913
940
  */
914
941
  deleteResource(resourceType: ResourceType, id: string): Promise<any>;
942
+ /**
943
+ * Executes the validate operation with the provided resource.
944
+ *
945
+ * Example:
946
+ *
947
+ * ```typescript
948
+ * const result = await medplum.validateResource({
949
+ * resourceType: 'Patient',
950
+ * name: [{ given: ['Alice'], family: 'Smith' }],
951
+ * });
952
+ * ```
953
+ *
954
+ * See the FHIR "$validate" operation for full details: https://www.hl7.org/fhir/resource-operation-validate.html
955
+ *
956
+ * @param resource The FHIR resource.
957
+ * @returns The validate operation outcome.
958
+ */
959
+ validateResource<T extends Resource>(resource: T): Promise<OperationOutcome>;
915
960
  /**
916
961
  * Executes a batch or transaction of FHIR operations.
917
962
  *
@@ -11,9 +11,8 @@ import { createReference, arrayBufferToBase64 } from './utils.js';
11
11
  // PKCE auth based on:
12
12
  // https://aws.amazon.com/blogs/security/how-to-add-authentication-single-page-web-application-with-amazon-cognito-oauth2-implementation/
13
13
  var _MedplumClient_instances, _MedplumClient_fetch, _MedplumClient_createPdf, _MedplumClient_storage, _MedplumClient_requestCache, _MedplumClient_cacheTime, _MedplumClient_baseUrl, _MedplumClient_clientId, _MedplumClient_authorizeUrl, _MedplumClient_tokenUrl, _MedplumClient_logoutUrl, _MedplumClient_onUnauthenticated, _MedplumClient_accessToken, _MedplumClient_refreshToken, _MedplumClient_refreshPromise, _MedplumClient_profilePromise, _MedplumClient_profile, _MedplumClient_config, _MedplumClient_addLogin, _MedplumClient_refreshProfile, _MedplumClient_getCacheEntry, _MedplumClient_setCacheEntry, _MedplumClient_request, _MedplumClient_addFetchOptionsDefaults, _MedplumClient_setRequestContentType, _MedplumClient_setRequestBody, _MedplumClient_handleUnauthenticated, _MedplumClient_requestAuthorization, _MedplumClient_refresh, _MedplumClient_fetchTokens, _MedplumClient_verifyTokens, _MedplumClient_setupStorageListener;
14
- const MEDPLUM_VERSION = "0.10.2-f713edf5";
14
+ const MEDPLUM_VERSION = "1.0.1-69d972ca";
15
15
  const DEFAULT_BASE_URL = 'https://api.medplum.com/';
16
- const DEFAULT_SCOPE = 'launch/patient openid fhirUser offline_access user/*.*';
17
16
  const DEFAULT_RESOURCE_CACHE_SIZE = 1000;
18
17
  const DEFAULT_CACHE_TIME = 60000; // 60 seconds
19
18
  const JSON_CONTENT_TYPE = 'application/json';
@@ -65,6 +64,11 @@ const PATCH_CONTENT_TYPE = 'application/json-patch+json';
65
64
  * const bundle = await medplum.search('Patient', 'name=Alice');
66
65
  * console.log(bundle.total);
67
66
  * ```
67
+ *
68
+ * <head>
69
+ * <meta name="algolia:pageRank" content="100" />
70
+ * </head>
71
+
68
72
  */
69
73
  class MedplumClient extends EventTarget {
70
74
  constructor(options) {
@@ -317,10 +321,10 @@ class MedplumClient extends EventTarget {
317
321
  * @returns Promise to the authentication response.
318
322
  */
319
323
  startLogin(loginRequest) {
320
- var _a, _b;
324
+ var _a;
321
325
  return __awaiter(this, void 0, void 0, function* () {
322
326
  const { codeChallenge, codeChallengeMethod } = this.getCodeChallenge(loginRequest);
323
- 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,
327
+ 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: loginRequest.scope, codeChallengeMethod,
324
328
  codeChallenge }));
325
329
  });
326
330
  }
@@ -333,10 +337,10 @@ class MedplumClient extends EventTarget {
333
337
  * @returns Promise to the authentication response.
334
338
  */
335
339
  startGoogleLogin(loginRequest) {
336
- var _a, _b;
340
+ var _a;
337
341
  return __awaiter(this, void 0, void 0, function* () {
338
342
  const { codeChallenge, codeChallengeMethod } = this.getCodeChallenge(loginRequest);
339
- 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, codeChallengeMethod,
343
+ 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: loginRequest.scope, codeChallengeMethod,
340
344
  codeChallenge }));
341
345
  });
342
346
  }
@@ -458,7 +462,9 @@ class MedplumClient extends EventTarget {
458
462
  * See FHIR search for full details: https://www.hl7.org/fhir/search.html
459
463
  *
460
464
  * @category Search
465
+ * @param resourceType The FHIR resource type.
461
466
  * @param query The search query as either a string or a structured search object.
467
+ * @param options Optional fetch options.
462
468
  * @returns Promise to the search result bundle.
463
469
  */
464
470
  search(resourceType, query, options = {}) {
@@ -481,7 +487,9 @@ class MedplumClient extends EventTarget {
481
487
  * See FHIR search for full details: https://www.hl7.org/fhir/search.html
482
488
  *
483
489
  * @category Search
490
+ * @param resourceType The FHIR resource type.
484
491
  * @param query The search query as either a string or a structured search object.
492
+ * @param options Optional fetch options.
485
493
  * @returns Promise to the search result bundle.
486
494
  */
487
495
  searchOne(resourceType, query, options = {}) {
@@ -514,7 +522,9 @@ class MedplumClient extends EventTarget {
514
522
  * See FHIR search for full details: https://www.hl7.org/fhir/search.html
515
523
  *
516
524
  * @category Search
525
+ * @param resourceType The FHIR resource type.
517
526
  * @param query The search query as either a string or a structured search object.
527
+ * @param options Optional fetch options.
518
528
  * @returns Promise to the search result bundle.
519
529
  */
520
530
  searchResources(resourceType, query, options = {}) {
@@ -535,6 +545,7 @@ class MedplumClient extends EventTarget {
535
545
  * @category Search
536
546
  * @param system The ValueSet system url.
537
547
  * @param filter The search string.
548
+ * @param options Optional fetch options.
538
549
  * @returns Promise to expanded ValueSet.
539
550
  */
540
551
  searchValueSet(system, filter, options = {}) {
@@ -588,6 +599,7 @@ class MedplumClient extends EventTarget {
588
599
  * @category Read
589
600
  * @param resourceType The FHIR resource type.
590
601
  * @param id The resource ID.
602
+ * @param options Optional fetch options.
591
603
  * @returns The resource if available; undefined otherwise.
592
604
  */
593
605
  readResource(resourceType, id, options = {}) {
@@ -610,6 +622,7 @@ class MedplumClient extends EventTarget {
610
622
  *
611
623
  * @category Read
612
624
  * @param reference The FHIR reference object.
625
+ * @param options Optional fetch options.
613
626
  * @returns The resource if available; undefined otherwise.
614
627
  */
615
628
  readReference(reference, options = {}) {
@@ -628,7 +641,6 @@ class MedplumClient extends EventTarget {
628
641
  * If the schema is not cached, returns undefined.
629
642
  * It is assumed that a client will call requestSchema before using this method.
630
643
  * @category Schema
631
- * @param resourceType The FHIR resource type.
632
644
  * @returns The schema if immediately available, undefined otherwise.
633
645
  * @deprecated Use globalSchema instead.
634
646
  */
@@ -703,6 +715,7 @@ class MedplumClient extends EventTarget {
703
715
  * @category Read
704
716
  * @param resourceType The FHIR resource type.
705
717
  * @param id The resource ID.
718
+ * @param options Optional fetch options.
706
719
  * @returns Promise to the resource history.
707
720
  */
708
721
  readHistory(resourceType, id, options = {}) {
@@ -723,15 +736,28 @@ class MedplumClient extends EventTarget {
723
736
  * @category Read
724
737
  * @param resourceType The FHIR resource type.
725
738
  * @param id The resource ID.
739
+ * @param vid The version ID.
740
+ * @param options Optional fetch options.
726
741
  * @returns The resource if available; undefined otherwise.
727
742
  */
728
743
  readVersion(resourceType, id, vid, options = {}) {
729
744
  return this.get(this.fhirUrl(resourceType, id, '_history', vid), options);
730
745
  }
731
746
  /**
747
+ * Executes the Patient "everything" operation for a patient.
748
+ *
749
+ * Example:
750
+ *
751
+ * ```typescript
752
+ * const bundle = await medplum.readPatientEverything('123');
753
+ * console.log(bundle);
754
+ * ```
755
+ *
756
+ * See the FHIR "patient-everything" operation for full details: https://hl7.org/fhir/operation-patient-everything.html
732
757
  *
733
758
  * @category Read
734
759
  * @param id The Patient Id
760
+ * @param options Optional fetch options.
735
761
  * @returns A Bundle of all Resources related to the Patient
736
762
  */
737
763
  readPatientEverything(id, options = {}) {
@@ -838,12 +864,44 @@ class MedplumClient extends EventTarget {
838
864
  * @param contentType Content type for the binary.
839
865
  * @returns The result of the create operation.
840
866
  */
841
- createBinary(data, filename, contentType) {
867
+ createBinary(data, filename, contentType, onProgress) {
842
868
  const url = this.fhirUrl('Binary');
843
869
  if (filename) {
844
870
  url.searchParams.set('_filename', filename);
845
871
  }
846
- return this.post(url, data, contentType);
872
+ if (onProgress) {
873
+ return this.uploadwithProgress(url, data, contentType, onProgress);
874
+ }
875
+ else {
876
+ return this.post(url, data, contentType);
877
+ }
878
+ }
879
+ uploadwithProgress(url, data, contentType, onProgress) {
880
+ return new Promise((resolve, reject) => {
881
+ const xhr = new XMLHttpRequest();
882
+ xhr.responseType = 'json';
883
+ xhr.onabort = () => reject(new Error('Request aborted'));
884
+ xhr.onerror = () => reject(new Error('Request error'));
885
+ if (onProgress) {
886
+ xhr.upload.onprogress = (e) => onProgress(e);
887
+ xhr.upload.onload = (e) => onProgress(e);
888
+ }
889
+ xhr.onload = () => {
890
+ if (xhr.status >= 200 && xhr.status < 300) {
891
+ resolve(xhr.response);
892
+ }
893
+ else {
894
+ reject(new Error(xhr.statusText));
895
+ }
896
+ };
897
+ xhr.open('POST', url);
898
+ xhr.withCredentials = true;
899
+ xhr.setRequestHeader('Authorization', 'Bearer ' + __classPrivateFieldGet(this, _MedplumClient_accessToken, "f"));
900
+ xhr.setRequestHeader('Cache-Control', 'no-cache, no-store, max-age=0');
901
+ xhr.setRequestHeader('Content-Type', contentType);
902
+ xhr.setRequestHeader('X-Medplum', 'extended');
903
+ xhr.send(data);
904
+ });
847
905
  }
848
906
  /**
849
907
  * Creates a PDF as a FHIR `Binary` resource based on pdfmake document definition.
@@ -999,6 +1057,26 @@ class MedplumClient extends EventTarget {
999
1057
  this.invalidateSearches(resourceType);
1000
1058
  return this.delete(this.fhirUrl(resourceType, id));
1001
1059
  }
1060
+ /**
1061
+ * Executes the validate operation with the provided resource.
1062
+ *
1063
+ * Example:
1064
+ *
1065
+ * ```typescript
1066
+ * const result = await medplum.validateResource({
1067
+ * resourceType: 'Patient',
1068
+ * name: [{ given: ['Alice'], family: 'Smith' }],
1069
+ * });
1070
+ * ```
1071
+ *
1072
+ * See the FHIR "$validate" operation for full details: https://www.hl7.org/fhir/resource-operation-validate.html
1073
+ *
1074
+ * @param resource The FHIR resource.
1075
+ * @returns The validate operation outcome.
1076
+ */
1077
+ validateResource(resource) {
1078
+ return this.post(this.fhirUrl(resource.resourceType, '$validate'), resource);
1079
+ }
1002
1080
  /**
1003
1081
  * Executes a batch or transaction of FHIR operations.
1004
1082
  *
@@ -1406,7 +1484,6 @@ _MedplumClient_fetch = new WeakMap(), _MedplumClient_createPdf = new WeakMap(),
1406
1484
  url.searchParams.set('state', sessionStorage.getItem('pkceState'));
1407
1485
  url.searchParams.set('client_id', __classPrivateFieldGet(this, _MedplumClient_clientId, "f"));
1408
1486
  url.searchParams.set('redirect_uri', getBaseUrl());
1409
- url.searchParams.set('scope', DEFAULT_SCOPE);
1410
1487
  url.searchParams.set('code_challenge_method', 'S256');
1411
1488
  url.searchParams.set('code_challenge', sessionStorage.getItem('codeChallenge'));
1412
1489
  window.location.assign(url.toString());