@medplum/core 5.0.8 → 5.0.10
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.cjs +6 -6
- package/dist/cjs/index.cjs.map +3 -3
- package/dist/cjs/index.d.ts +74 -6
- package/dist/esm/index.d.ts +74 -6
- package/dist/esm/index.mjs +5 -5
- package/dist/esm/index.mjs.map +3 -3
- package/package.json +3 -3
package/dist/cjs/index.d.ts
CHANGED
|
@@ -266,6 +266,8 @@ export declare function arrayBufferToBase64(arrayBuffer: ArrayBufferLike | Array
|
|
|
266
266
|
*/
|
|
267
267
|
export declare function arrayBufferToHex(arrayBuffer: ArrayBufferLike | ArrayBufferView): string;
|
|
268
268
|
|
|
269
|
+
export declare function arrayify<T>(value: NonNullable<T> | NonNullable<T>[]): T[];
|
|
270
|
+
|
|
269
271
|
export declare function arrayify<T>(value: T | T[] | undefined): T[] | undefined;
|
|
270
272
|
|
|
271
273
|
export declare class AsAtom extends InfixOperatorAtom {
|
|
@@ -629,6 +631,14 @@ export declare function checkIfValidMedplumVersion(appName: string, version: str
|
|
|
629
631
|
*/
|
|
630
632
|
export declare function clearReleaseCache(): void;
|
|
631
633
|
|
|
634
|
+
/**
|
|
635
|
+
* Log level for MedplumClient requests and responses.
|
|
636
|
+
* - 'none': No logging
|
|
637
|
+
* - 'basic': Log method, URL, and status code only (no sensitive headers)
|
|
638
|
+
* - 'verbose': Log all details including headers (may include sensitive data)
|
|
639
|
+
*/
|
|
640
|
+
export declare type ClientLogLevel = 'none' | 'basic' | 'verbose';
|
|
641
|
+
|
|
632
642
|
/**
|
|
633
643
|
* The ClientStorage class is a utility class for storing strings and objects.
|
|
634
644
|
*
|
|
@@ -1911,9 +1921,6 @@ export declare class FunctionAtom implements Atom {
|
|
|
1911
1921
|
|
|
1912
1922
|
/**
|
|
1913
1923
|
* Cross platform random UUID generator
|
|
1914
|
-
* Note that this is not intended for production use, but rather for testing
|
|
1915
|
-
* This should be replaced when crypto.randomUUID is fully supported
|
|
1916
|
-
* See: https://stackoverflow.com/revisions/2117523/28
|
|
1917
1924
|
* @returns A random UUID.
|
|
1918
1925
|
*/
|
|
1919
1926
|
export declare function generateId(): string;
|
|
@@ -3406,6 +3413,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3406
3413
|
private initPromise;
|
|
3407
3414
|
private initComplete;
|
|
3408
3415
|
private keyValueClient?;
|
|
3416
|
+
private logLevel;
|
|
3409
3417
|
constructor(options?: MedplumClientOptions);
|
|
3410
3418
|
/**
|
|
3411
3419
|
* @returns Whether the client has been fully initialized or not. Should always be true unless a custom asynchronous `ClientStorage` was passed into the constructor.
|
|
@@ -3416,6 +3424,12 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3416
3424
|
* @returns A Promise that resolves when any async initialization of the client is finished.
|
|
3417
3425
|
*/
|
|
3418
3426
|
getInitPromise(): Promise<void>;
|
|
3427
|
+
/**
|
|
3428
|
+
* Initializes the log level with backward compatibility for the verbose option.
|
|
3429
|
+
* @param options - The client options.
|
|
3430
|
+
* @returns The initialized log level.
|
|
3431
|
+
*/
|
|
3432
|
+
private initializeLogLevel;
|
|
3419
3433
|
private attemptResumeActiveLogin;
|
|
3420
3434
|
/**
|
|
3421
3435
|
* Returns the current base URL for all API requests.
|
|
@@ -4789,10 +4803,46 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4789
4803
|
* @param clientSecret - The client secret.
|
|
4790
4804
|
*/
|
|
4791
4805
|
setBasicAuth(clientId: string, clientSecret: string): void;
|
|
4806
|
+
/**
|
|
4807
|
+
* Sets the log level for the client.
|
|
4808
|
+
* - 'none': No logging
|
|
4809
|
+
* - 'basic': Log method, URL, and status code only (no sensitive headers)
|
|
4810
|
+
* - 'verbose': Log all details including headers (may include sensitive data)
|
|
4811
|
+
*
|
|
4812
|
+
* @example
|
|
4813
|
+
* ```typescript
|
|
4814
|
+
* // Basic logging for production
|
|
4815
|
+
* medplum.setLogLevel('basic');
|
|
4816
|
+
* await medplum.searchResources('Patient');
|
|
4817
|
+
* // Output:
|
|
4818
|
+
* // > GET https://api.medplum.com/fhir/R4/Patient
|
|
4819
|
+
* // < 200 OK
|
|
4820
|
+
* ```
|
|
4821
|
+
*
|
|
4822
|
+
* @example
|
|
4823
|
+
* ```typescript
|
|
4824
|
+
* // Verbose logging for debugging
|
|
4825
|
+
* medplum.setLogLevel('verbose');
|
|
4826
|
+
* await medplum.searchResources('Patient');
|
|
4827
|
+
* // Output includes all headers
|
|
4828
|
+
* ```
|
|
4829
|
+
*
|
|
4830
|
+
* @category HTTP
|
|
4831
|
+
* @param level - The log level to set.
|
|
4832
|
+
*/
|
|
4833
|
+
setLogLevel(level: ClientLogLevel): void;
|
|
4834
|
+
/**
|
|
4835
|
+
* Gets the current log level.
|
|
4836
|
+
* @category HTTP
|
|
4837
|
+
* @returns The current log level.
|
|
4838
|
+
*/
|
|
4839
|
+
getLogLevel(): ClientLogLevel;
|
|
4792
4840
|
/**
|
|
4793
4841
|
* Sets the verbose mode for the client.
|
|
4794
4842
|
* When verbose is enabled, the client will log all requests and responses to the console.
|
|
4795
4843
|
*
|
|
4844
|
+
* @deprecated Use setLogLevel instead. This method will be removed in a future version.
|
|
4845
|
+
*
|
|
4796
4846
|
* @example
|
|
4797
4847
|
* ```typescript
|
|
4798
4848
|
* medplum.setVerbose(true);
|
|
@@ -5172,8 +5222,18 @@ export declare interface MedplumClientOptions {
|
|
|
5172
5222
|
redirect?: RequestRedirect;
|
|
5173
5223
|
/**
|
|
5174
5224
|
* When the verbose flag is set, the client will log all requests and responses to the console.
|
|
5225
|
+
* @deprecated Use logLevel instead. Will be removed in a future version.
|
|
5175
5226
|
*/
|
|
5176
5227
|
verbose?: boolean;
|
|
5228
|
+
/**
|
|
5229
|
+
* Log level for requests and responses.
|
|
5230
|
+
* - 'none': No logging (default)
|
|
5231
|
+
* - 'basic': Log method, URL, and status code only (no sensitive headers)
|
|
5232
|
+
* - 'verbose': Log all details including headers (may include sensitive data like tokens)
|
|
5233
|
+
*
|
|
5234
|
+
* @default 'none'
|
|
5235
|
+
*/
|
|
5236
|
+
logLevel?: ClientLogLevel;
|
|
5177
5237
|
/**
|
|
5178
5238
|
* Optional flag to enable or disable Medplum extended mode.
|
|
5179
5239
|
*
|
|
@@ -5902,6 +5962,14 @@ export declare class ParserBuilder {
|
|
|
5902
5962
|
readonly value?: any;
|
|
5903
5963
|
}
|
|
5904
5964
|
|
|
5965
|
+
/**
|
|
5966
|
+
* Translates a path emitted by this crawler into an RFC6902 JSON Patch pointer
|
|
5967
|
+
*
|
|
5968
|
+
* @param path - A path emitted from a Crawler
|
|
5969
|
+
* @returns pointer -An RFC6902 pointer describing the path
|
|
5970
|
+
*/
|
|
5971
|
+
export declare function pathToJSONPointer(path: string): string;
|
|
5972
|
+
|
|
5905
5973
|
export declare type PendingSubscriptionRequest = Omit<SubscriptionRequest, 'endpoint'>;
|
|
5906
5974
|
|
|
5907
5975
|
/**
|
|
@@ -6310,9 +6378,9 @@ export declare class ParserBuilder {
|
|
|
6310
6378
|
*
|
|
6311
6379
|
* Note that the spec says:
|
|
6312
6380
|
*
|
|
6313
|
-
*
|
|
6314
|
-
*
|
|
6315
|
-
*
|
|
6381
|
+
* Individual hooks specify which of their `context` fields can be used as prefetch tokens.
|
|
6382
|
+
* Only root-level fields with a primitive value within the `context` object are eligible to be used as prefetch tokens.
|
|
6383
|
+
* For example, `{{context.medication.id}}` is not a valid prefetch token because it attempts to access the `id` field of the `medication` field.
|
|
6316
6384
|
*
|
|
6317
6385
|
* Unfortunately, many CDS Hooks services do not follow this rule. Therefore, this implementation allows access to nested fields.
|
|
6318
6386
|
*
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -266,6 +266,8 @@ export declare function arrayBufferToBase64(arrayBuffer: ArrayBufferLike | Array
|
|
|
266
266
|
*/
|
|
267
267
|
export declare function arrayBufferToHex(arrayBuffer: ArrayBufferLike | ArrayBufferView): string;
|
|
268
268
|
|
|
269
|
+
export declare function arrayify<T>(value: NonNullable<T> | NonNullable<T>[]): T[];
|
|
270
|
+
|
|
269
271
|
export declare function arrayify<T>(value: T | T[] | undefined): T[] | undefined;
|
|
270
272
|
|
|
271
273
|
export declare class AsAtom extends InfixOperatorAtom {
|
|
@@ -629,6 +631,14 @@ export declare function checkIfValidMedplumVersion(appName: string, version: str
|
|
|
629
631
|
*/
|
|
630
632
|
export declare function clearReleaseCache(): void;
|
|
631
633
|
|
|
634
|
+
/**
|
|
635
|
+
* Log level for MedplumClient requests and responses.
|
|
636
|
+
* - 'none': No logging
|
|
637
|
+
* - 'basic': Log method, URL, and status code only (no sensitive headers)
|
|
638
|
+
* - 'verbose': Log all details including headers (may include sensitive data)
|
|
639
|
+
*/
|
|
640
|
+
export declare type ClientLogLevel = 'none' | 'basic' | 'verbose';
|
|
641
|
+
|
|
632
642
|
/**
|
|
633
643
|
* The ClientStorage class is a utility class for storing strings and objects.
|
|
634
644
|
*
|
|
@@ -1911,9 +1921,6 @@ export declare class FunctionAtom implements Atom {
|
|
|
1911
1921
|
|
|
1912
1922
|
/**
|
|
1913
1923
|
* Cross platform random UUID generator
|
|
1914
|
-
* Note that this is not intended for production use, but rather for testing
|
|
1915
|
-
* This should be replaced when crypto.randomUUID is fully supported
|
|
1916
|
-
* See: https://stackoverflow.com/revisions/2117523/28
|
|
1917
1924
|
* @returns A random UUID.
|
|
1918
1925
|
*/
|
|
1919
1926
|
export declare function generateId(): string;
|
|
@@ -3406,6 +3413,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3406
3413
|
private initPromise;
|
|
3407
3414
|
private initComplete;
|
|
3408
3415
|
private keyValueClient?;
|
|
3416
|
+
private logLevel;
|
|
3409
3417
|
constructor(options?: MedplumClientOptions);
|
|
3410
3418
|
/**
|
|
3411
3419
|
* @returns Whether the client has been fully initialized or not. Should always be true unless a custom asynchronous `ClientStorage` was passed into the constructor.
|
|
@@ -3416,6 +3424,12 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
3416
3424
|
* @returns A Promise that resolves when any async initialization of the client is finished.
|
|
3417
3425
|
*/
|
|
3418
3426
|
getInitPromise(): Promise<void>;
|
|
3427
|
+
/**
|
|
3428
|
+
* Initializes the log level with backward compatibility for the verbose option.
|
|
3429
|
+
* @param options - The client options.
|
|
3430
|
+
* @returns The initialized log level.
|
|
3431
|
+
*/
|
|
3432
|
+
private initializeLogLevel;
|
|
3419
3433
|
private attemptResumeActiveLogin;
|
|
3420
3434
|
/**
|
|
3421
3435
|
* Returns the current base URL for all API requests.
|
|
@@ -4789,10 +4803,46 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4789
4803
|
* @param clientSecret - The client secret.
|
|
4790
4804
|
*/
|
|
4791
4805
|
setBasicAuth(clientId: string, clientSecret: string): void;
|
|
4806
|
+
/**
|
|
4807
|
+
* Sets the log level for the client.
|
|
4808
|
+
* - 'none': No logging
|
|
4809
|
+
* - 'basic': Log method, URL, and status code only (no sensitive headers)
|
|
4810
|
+
* - 'verbose': Log all details including headers (may include sensitive data)
|
|
4811
|
+
*
|
|
4812
|
+
* @example
|
|
4813
|
+
* ```typescript
|
|
4814
|
+
* // Basic logging for production
|
|
4815
|
+
* medplum.setLogLevel('basic');
|
|
4816
|
+
* await medplum.searchResources('Patient');
|
|
4817
|
+
* // Output:
|
|
4818
|
+
* // > GET https://api.medplum.com/fhir/R4/Patient
|
|
4819
|
+
* // < 200 OK
|
|
4820
|
+
* ```
|
|
4821
|
+
*
|
|
4822
|
+
* @example
|
|
4823
|
+
* ```typescript
|
|
4824
|
+
* // Verbose logging for debugging
|
|
4825
|
+
* medplum.setLogLevel('verbose');
|
|
4826
|
+
* await medplum.searchResources('Patient');
|
|
4827
|
+
* // Output includes all headers
|
|
4828
|
+
* ```
|
|
4829
|
+
*
|
|
4830
|
+
* @category HTTP
|
|
4831
|
+
* @param level - The log level to set.
|
|
4832
|
+
*/
|
|
4833
|
+
setLogLevel(level: ClientLogLevel): void;
|
|
4834
|
+
/**
|
|
4835
|
+
* Gets the current log level.
|
|
4836
|
+
* @category HTTP
|
|
4837
|
+
* @returns The current log level.
|
|
4838
|
+
*/
|
|
4839
|
+
getLogLevel(): ClientLogLevel;
|
|
4792
4840
|
/**
|
|
4793
4841
|
* Sets the verbose mode for the client.
|
|
4794
4842
|
* When verbose is enabled, the client will log all requests and responses to the console.
|
|
4795
4843
|
*
|
|
4844
|
+
* @deprecated Use setLogLevel instead. This method will be removed in a future version.
|
|
4845
|
+
*
|
|
4796
4846
|
* @example
|
|
4797
4847
|
* ```typescript
|
|
4798
4848
|
* medplum.setVerbose(true);
|
|
@@ -5172,8 +5222,18 @@ export declare interface MedplumClientOptions {
|
|
|
5172
5222
|
redirect?: RequestRedirect;
|
|
5173
5223
|
/**
|
|
5174
5224
|
* When the verbose flag is set, the client will log all requests and responses to the console.
|
|
5225
|
+
* @deprecated Use logLevel instead. Will be removed in a future version.
|
|
5175
5226
|
*/
|
|
5176
5227
|
verbose?: boolean;
|
|
5228
|
+
/**
|
|
5229
|
+
* Log level for requests and responses.
|
|
5230
|
+
* - 'none': No logging (default)
|
|
5231
|
+
* - 'basic': Log method, URL, and status code only (no sensitive headers)
|
|
5232
|
+
* - 'verbose': Log all details including headers (may include sensitive data like tokens)
|
|
5233
|
+
*
|
|
5234
|
+
* @default 'none'
|
|
5235
|
+
*/
|
|
5236
|
+
logLevel?: ClientLogLevel;
|
|
5177
5237
|
/**
|
|
5178
5238
|
* Optional flag to enable or disable Medplum extended mode.
|
|
5179
5239
|
*
|
|
@@ -5902,6 +5962,14 @@ export declare class ParserBuilder {
|
|
|
5902
5962
|
readonly value?: any;
|
|
5903
5963
|
}
|
|
5904
5964
|
|
|
5965
|
+
/**
|
|
5966
|
+
* Translates a path emitted by this crawler into an RFC6902 JSON Patch pointer
|
|
5967
|
+
*
|
|
5968
|
+
* @param path - A path emitted from a Crawler
|
|
5969
|
+
* @returns pointer -An RFC6902 pointer describing the path
|
|
5970
|
+
*/
|
|
5971
|
+
export declare function pathToJSONPointer(path: string): string;
|
|
5972
|
+
|
|
5905
5973
|
export declare type PendingSubscriptionRequest = Omit<SubscriptionRequest, 'endpoint'>;
|
|
5906
5974
|
|
|
5907
5975
|
/**
|
|
@@ -6310,9 +6378,9 @@ export declare class ParserBuilder {
|
|
|
6310
6378
|
*
|
|
6311
6379
|
* Note that the spec says:
|
|
6312
6380
|
*
|
|
6313
|
-
*
|
|
6314
|
-
*
|
|
6315
|
-
*
|
|
6381
|
+
* Individual hooks specify which of their `context` fields can be used as prefetch tokens.
|
|
6382
|
+
* Only root-level fields with a primitive value within the `context` object are eligible to be used as prefetch tokens.
|
|
6383
|
+
* For example, `{{context.medication.id}}` is not a valid prefetch token because it attempts to access the `id` field of the `medication` field.
|
|
6316
6384
|
*
|
|
6317
6385
|
* Unfortunately, many CDS Hooks services do not follow this rule. Therefore, this implementation allows access to nested fields.
|
|
6318
6386
|
*
|