@medplum/core 2.0.2 → 2.0.4

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 (43) hide show
  1. package/README.md +7 -3
  2. package/dist/cjs/client.d.ts +16 -3
  3. package/dist/cjs/index.cjs +785 -438
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.ts +4 -3
  6. package/dist/cjs/index.min.cjs +1 -1
  7. package/dist/cjs/outcomes.d.ts +1 -0
  8. package/dist/cjs/{searchparams.d.ts → search/details.d.ts} +0 -0
  9. package/dist/cjs/{match.d.ts → search/match.d.ts} +0 -0
  10. package/dist/cjs/search/parse.d.ts +17 -0
  11. package/dist/cjs/{search.d.ts → search/search.d.ts} +0 -0
  12. package/dist/cjs/types.d.ts +30 -7
  13. package/dist/esm/base-schema.json.mjs +7 -0
  14. package/dist/esm/base-schema.json.mjs.map +1 -1
  15. package/dist/esm/client.d.ts +16 -3
  16. package/dist/esm/client.mjs +114 -26
  17. package/dist/esm/client.mjs.map +1 -1
  18. package/dist/esm/index.d.ts +4 -3
  19. package/dist/esm/index.min.mjs +1 -1
  20. package/dist/esm/index.mjs +6 -5
  21. package/dist/esm/index.mjs.map +1 -1
  22. package/dist/esm/outcomes.d.ts +1 -0
  23. package/dist/esm/outcomes.mjs +6 -4
  24. package/dist/esm/outcomes.mjs.map +1 -1
  25. package/dist/esm/{searchparams.d.ts → search/details.d.ts} +0 -0
  26. package/dist/esm/{searchparams.mjs → search/details.mjs} +9 -11
  27. package/dist/esm/search/details.mjs.map +1 -0
  28. package/dist/esm/{match.d.ts → search/match.d.ts} +0 -0
  29. package/dist/esm/{match.mjs → search/match.mjs} +7 -7
  30. package/dist/esm/search/match.mjs.map +1 -0
  31. package/dist/esm/search/parse.d.ts +17 -0
  32. package/dist/esm/search/parse.mjs +218 -0
  33. package/dist/esm/search/parse.mjs.map +1 -0
  34. package/dist/esm/{search.d.ts → search/search.d.ts} +0 -0
  35. package/dist/esm/{search.mjs → search/search.mjs} +0 -3
  36. package/dist/esm/search/search.mjs.map +1 -0
  37. package/dist/esm/types.d.ts +30 -7
  38. package/dist/esm/types.mjs +63 -25
  39. package/dist/esm/types.mjs.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/esm/match.mjs.map +0 -1
  42. package/dist/esm/search.mjs.map +0 -1
  43. package/dist/esm/searchparams.mjs.map +0 -1
package/README.md CHANGED
@@ -58,7 +58,7 @@ Before you begin
58
58
  After that, you can use the `startLogin()` method:
59
59
 
60
60
  ```ts
61
- const loginResult = await medplum.startLogin(email, password, remember);
61
+ const loginResult = await medplum.startLogin({ email, password, remember });
62
62
  const profile = await medplum.processCode(loginResult.code);
63
63
  console.log(profile);
64
64
  ```
@@ -76,13 +76,17 @@ medplum.signInWithRedirect().then((user) => console.log(user));
76
76
  Search for any resource using a [FHIR search](https://www.hl7.org/fhir/search.html) string:
77
77
 
78
78
  ```ts
79
- search<T extends Resource>(query: string | SearchRequest, options: RequestInit = {}): ReadablePromise<Bundle<T>>
79
+ search<K extends ResourceType>(
80
+ resourceType: K,
81
+ query?: URLSearchParams | string,
82
+ options: RequestInit = {}
83
+ ): ReadablePromise<Bundle<ExtractResource<K>>>
80
84
  ```
81
85
 
82
86
  Example:
83
87
 
84
88
  ```ts
85
- const bundle = await medplum.search('Patient?given=eve');
89
+ const bundle = await medplum.search('Patient', 'given=eve');
86
90
  bundle.entry.forEach((entry) => console.log(entry.resource));
87
91
  ```
88
92
 
@@ -84,7 +84,7 @@ export interface MedplumClientOptions {
84
84
  *
85
85
  * Default is window.fetch (if available).
86
86
  *
87
- * For nodejs applications, consider the 'node-fetch' package.
87
+ * For Node.js applications, consider the 'node-fetch' package.
88
88
  */
89
89
  fetch?: FetchLike;
90
90
  /**
@@ -105,7 +105,7 @@ export interface MedplumClientOptions {
105
105
  * </script>
106
106
  * ```
107
107
  *
108
- * In nodejs applications:
108
+ * In Node.js applications:
109
109
  *
110
110
  * ```ts
111
111
  * import type { CustomTableLayout, TDocumentDefinitions, TFontDictionary } from 'pdfmake/interfaces';
@@ -282,7 +282,7 @@ export interface MailOptions {
282
282
  /**
283
283
  * The MedplumClient class provides a client for the Medplum FHIR server.
284
284
  *
285
- * The client can be used in the browser, in a NodeJS application, or in a Medplum Bot.
285
+ * The client can be used in the browser, in a Node.js application, or in a Medplum Bot.
286
286
  *
287
287
  * The client provides helpful methods for common operations such as:
288
288
  * 1) Authenticating
@@ -517,8 +517,19 @@ export declare class MedplumClient extends EventTarget {
517
517
  * @param clientId The external client ID.
518
518
  * @param redirectUri The external identity provider redirect URI.
519
519
  * @param baseLogin The Medplum login request.
520
+ * @category Authentication
520
521
  */
521
522
  signInWithExternalAuth(authorizeUrl: string, clientId: string, redirectUri: string, baseLogin: BaseLoginRequest): Promise<void>;
523
+ /**
524
+ * Builds the external identity provider redirect URI.
525
+ * @param authorizeUrl The external authorization URL.
526
+ * @param clientId The external client ID.
527
+ * @param redirectUri The external identity provider redirect URI.
528
+ * @param loginRequest The Medplum login request.
529
+ * @returns The external identity provider redirect URI.
530
+ * @category Authentication
531
+ */
532
+ getExternalAuthRedirectUri(authorizeUrl: string, clientId: string, redirectUri: string, loginRequest: BaseLoginRequest): string;
522
533
  /**
523
534
  * Builds a FHIR URL from a collection of URL path components.
524
535
  * For example, `buildUrl('/Patient', '123')` returns `fhir/R4/Patient/123`.
@@ -1182,6 +1193,7 @@ export declare class MedplumClient extends EventTarget {
1182
1193
  /**
1183
1194
  * Starts a new PKCE flow.
1184
1195
  * These PKCE values are stateful, and must survive redirects and page refreshes.
1196
+ * @category Authentication
1185
1197
  */
1186
1198
  startPkce(): Promise<{
1187
1199
  codeChallengeMethod: string;
@@ -1191,6 +1203,7 @@ export declare class MedplumClient extends EventTarget {
1191
1203
  * Processes an OAuth authorization code.
1192
1204
  * See: https://openid.net/specs/openid-connect-core-1_0.html#TokenRequest
1193
1205
  * @param code The authorization code received by URL parameter.
1206
+ * @category Authentication
1194
1207
  */
1195
1208
  processCode(code: string): Promise<ProfileResource>;
1196
1209
  /**