@medplum/core 3.0.10 → 3.0.12

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.
@@ -482,6 +482,32 @@ export declare const CPT = "http://www.ama-assn.org/go/cpt";
482
482
 
483
483
  export declare function crawlResource(resource: Resource, visitor: ResourceVisitor, schema?: InternalTypeSchema, initialPath?: string): void;
484
484
 
485
+ /**
486
+ * Binary upload options.
487
+ */
488
+ export declare interface CreateBinaryOptions {
489
+ /**
490
+ * The binary data to upload.
491
+ */
492
+ readonly data: BinarySource;
493
+ /**
494
+ * Content type for the binary.
495
+ */
496
+ readonly contentType: string;
497
+ /**
498
+ * Optional filename for the binary.
499
+ */
500
+ readonly filename?: string;
501
+ /**
502
+ * Optional security context for the binary.
503
+ */
504
+ readonly securityContext?: Reference;
505
+ /**
506
+ * Optional fetch options. **NOTE:** only `requestOptions.signal` is respected when `onProgress` is also provided.
507
+ */
508
+ readonly onProgress?: (e: ProgressEvent) => void;
509
+ }
510
+
485
511
  export declare function createConstraintIssue(expression: string, constraint: Constraint): OperationOutcomeIssue;
486
512
 
487
513
  export declare const created: OperationOutcome;
@@ -499,12 +525,37 @@ export declare function createFhircastMessagePayload<EventName extends FhircastE
499
525
 
500
526
  export declare function createFhircastMessagePayload<EventName extends FhircastEventVersionRequired>(topic: string, event: EventName, context: FhircastValidContextForEvent<EventName> | FhircastValidContextForEvent<EventName>[], versionId: string): FhircastMessagePayload<EventName>;
501
527
 
528
+ export declare interface CreateMediaOptions extends CreateBinaryOptions {
529
+ /**
530
+ * Optional additional fields for the Media resource.
531
+ */
532
+ readonly additionalFields?: Partial<Media>;
533
+ }
534
+
502
535
  export declare function createOperationOutcomeIssue(severity: IssueSeverity, code: IssueType, message: string, path: string, data?: Record<string, any>): OperationOutcomeIssue;
503
536
 
504
537
  export declare interface CreatePdfFunction {
505
538
  (docDefinition: TDocumentDefinitions, tableLayouts?: Record<string, CustomTableLayout> | undefined, fonts?: TFontDictionary | undefined): Promise<any>;
506
539
  }
507
540
 
541
+ /**
542
+ * PDF upload options.
543
+ */
544
+ export declare interface CreatePdfOptions extends Omit<CreateBinaryOptions, 'data' | 'contentType'> {
545
+ /**
546
+ * The PDF document definition. See https://pdfmake.github.io/docs/0.1/document-definition-object/
547
+ */
548
+ readonly docDefinition: TDocumentDefinitions;
549
+ /**
550
+ * Optional pdfmake custom table layout.
551
+ */
552
+ readonly tableLayouts?: Record<string, CustomTableLayout>;
553
+ /**
554
+ * Optional pdfmake custom font dictionary.
555
+ */
556
+ readonly fonts?: TFontDictionary;
557
+ }
558
+
508
559
  export declare function createProcessingIssue(expression: string, message: string, err: Error, data?: Record<string, any>): OperationOutcomeIssue;
509
560
 
510
561
  /**
@@ -677,6 +728,7 @@ declare class EventTarget_2 {
677
728
  addEventListener(type: string, callback: EventListener_2): void;
678
729
  removeEventListener(type: string, callback: EventListener_2): void;
679
730
  dispatchEvent(event: Event_2): boolean;
731
+ removeAllListeners(): void;
680
732
  }
681
733
  export { EventTarget_2 as EventTarget }
682
734
 
@@ -1869,6 +1921,16 @@ export declare interface InviteRequest {
1869
1921
  admin?: boolean;
1870
1922
  }
1871
1923
 
1924
+ export declare interface IRobustWebSocket extends TypedEventTarget<RobustWebSocketEventMap> {
1925
+ readyState: number;
1926
+ close(): void;
1927
+ send(message: string): void;
1928
+ }
1929
+
1930
+ export declare interface IRobustWebSocketCtor {
1931
+ new (url: string): IRobustWebSocket;
1932
+ }
1933
+
1872
1934
  export declare function isAccepted(outcome: OperationOutcome): boolean;
1873
1935
 
1874
1936
  export declare class IsAtom extends BooleanInfixOperatorAtom {
@@ -2279,6 +2341,8 @@ export declare function matchesRange(value: number, range: Range_2, precision?:
2279
2341
  */
2280
2342
  export declare function matchesSearchRequest(resource: Resource, searchRequest: SearchRequest): boolean;
2281
2343
 
2344
+ export declare const MEDPLUM_CLI_CLIENT_ID = "medplum-cli";
2345
+
2282
2346
  export declare const MEDPLUM_VERSION: any;
2283
2347
 
2284
2348
  /**
@@ -2986,6 +3050,13 @@ export declare class MedplumClient extends EventTarget_2 {
2986
3050
  * ```
2987
3051
  *
2988
3052
  * See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
3053
+ * @category Create
3054
+ * @param createBinaryOptions -The binary options. See `CreateBinaryOptions` for full details.
3055
+ * @param requestOptions - Optional fetch options. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
3056
+ * @returns The result of the create operation.
3057
+ */
3058
+ createAttachment(createBinaryOptions: CreateBinaryOptions, requestOptions?: MedplumRequestOptions): Promise<Attachment>;
3059
+ /**
2989
3060
  * @category Create
2990
3061
  * @param data - The binary data to upload.
2991
3062
  * @param filename - Optional filename for the binary.
@@ -2993,6 +3064,7 @@ export declare class MedplumClient extends EventTarget_2 {
2993
3064
  * @param onProgress - Optional callback for progress events. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
2994
3065
  * @param options - Optional fetch options. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
2995
3066
  * @returns The result of the create operation.
3067
+ * @deprecated Use `createAttachment` with `CreateBinaryOptions` instead. To be removed in Medplum 4.0.
2996
3068
  */
2997
3069
  createAttachment(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void, options?: MedplumRequestOptions): Promise<Attachment>;
2998
3070
  /**
@@ -3013,6 +3085,14 @@ export declare class MedplumClient extends EventTarget_2 {
3013
3085
  * ```
3014
3086
  *
3015
3087
  * See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
3088
+ *
3089
+ * @category Create
3090
+ * @param createBinaryOptions -The binary options. See `CreateBinaryOptions` for full details.
3091
+ * @param requestOptions - Optional fetch options. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
3092
+ * @returns The result of the create operation.
3093
+ */
3094
+ createBinary(createBinaryOptions: CreateBinaryOptions, requestOptions?: MedplumRequestOptions): Promise<Binary>;
3095
+ /**
3016
3096
  * @category Create
3017
3097
  * @param data - The binary data to upload.
3018
3098
  * @param filename - Optional filename for the binary.
@@ -3020,6 +3100,7 @@ export declare class MedplumClient extends EventTarget_2 {
3020
3100
  * @param onProgress - Optional callback for progress events. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
3021
3101
  * @param options - Optional fetch options. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
3022
3102
  * @returns The result of the create operation.
3103
+ * @deprecated Use `createBinary` with `CreateBinaryOptions` instead. To be removed in Medplum 4.0.
3023
3104
  */
3024
3105
  createBinary(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void, options?: MedplumRequestOptions): Promise<Binary>;
3025
3106
  uploadwithProgress(url: URL, data: BinarySource, contentType: string, onProgress: (e: ProgressEvent) => void, options?: MedplumRequestOptions): Promise<any>;
@@ -3041,14 +3122,22 @@ export declare class MedplumClient extends EventTarget_2 {
3041
3122
  * ```
3042
3123
  *
3043
3124
  * See the pdfmake document definition for full details: https://pdfmake.github.io/docs/0.1/document-definition-object/
3125
+ * @category Media
3126
+ * @param createPdfOptions - The PDF creation options. See `CreatePdfOptions` for full details.
3127
+ * @param requestOptions - Optional fetch options.
3128
+ * @returns The result of the create operation.
3129
+ */
3130
+ createPdf(createPdfOptions: CreatePdfOptions, requestOptions?: MedplumRequestOptions): Promise<Binary>;
3131
+ /**
3044
3132
  * @category Media
3045
3133
  * @param docDefinition - The PDF document definition.
3046
3134
  * @param filename - Optional filename for the PDF binary resource.
3047
3135
  * @param tableLayouts - Optional pdfmake custom table layout.
3048
3136
  * @param fonts - Optional pdfmake custom font dictionary.
3049
3137
  * @returns The result of the create operation.
3138
+ * @deprecated Use `createPdf` with `CreatePdfOptions` instead. To be removed in Medplum 4.0.
3050
3139
  */
3051
- createPdf(docDefinition: TDocumentDefinitions, filename?: string, tableLayouts?: Record<string, CustomTableLayout>, fonts?: TFontDictionary): Promise<Binary>;
3140
+ createPdf(docDefinition: TDocumentDefinitions, filename: string | undefined, tableLayouts?: Record<string, CustomTableLayout>, fonts?: TFontDictionary): Promise<Binary>;
3052
3141
  /**
3053
3142
  * Creates a FHIR `Communication` resource with the provided data content.
3054
3143
  *
@@ -3419,14 +3508,24 @@ export declare class MedplumClient extends EventTarget_2 {
3419
3508
  * @returns Promise to the response body as a blob.
3420
3509
  */
3421
3510
  download(url: URL | string, options?: MedplumRequestOptions): Promise<Blob>;
3511
+ /**
3512
+ * Creates a FHIR Media resource with the provided data content.
3513
+ *
3514
+ * @category Create
3515
+ * @param createMediaOptions - The media creation options. See `CreateMediaOptions` for full details.
3516
+ * @param requestOptions - Optional fetch options.
3517
+ * @returns The new media resource.
3518
+ */
3519
+ createMedia(createMediaOptions: CreateMediaOptions, requestOptions?: MedplumRequestOptions): Promise<Media>;
3422
3520
  /**
3423
3521
  * Upload media to the server and create a Media instance for the uploaded content.
3424
3522
  * @param contents - The contents of the media file, as a string, Uint8Array, File, or Blob.
3425
3523
  * @param contentType - The media type of the content.
3426
- * @param filename - The name of the file to be uploaded, or undefined if not applicable.
3524
+ * @param filename - Optional filename for the binary, or extended upload options (see `BinaryUploadOptions`).
3427
3525
  * @param additionalFields - Additional fields for Media.
3428
3526
  * @param options - Optional fetch options.
3429
3527
  * @returns Promise that resolves to the created Media
3528
+ * @deprecated Use `createMedia` with `CreateMediaOptions` instead. To be removed in Medplum 4.0.
3430
3529
  */
3431
3530
  uploadMedia(contents: string | Uint8Array | File | Blob, contentType: string, filename: string | undefined, additionalFields?: Partial<Media>, options?: MedplumRequestOptions): Promise<Media>;
3432
3531
  /**
@@ -3505,6 +3604,14 @@ export declare class MedplumClient extends EventTarget_2 {
3505
3604
  * @param contentType - The new content type to set.
3506
3605
  */
3507
3606
  private setRequestContentType;
3607
+ /**
3608
+ * Sets a header on fetch options.
3609
+ * @param options - The fetch options.
3610
+ * @param key - The header key.
3611
+ * @param value - The header value.
3612
+ * @param ifNoneExist - Optional flag to only set the header if it doesn't already exist.
3613
+ */
3614
+ private setRequestHeader;
3508
3615
  /**
3509
3616
  * Sets the body on fetch options.
3510
3617
  * @param options - The fetch options.
@@ -4197,6 +4304,10 @@ export declare interface NewUserRequest {
4197
4304
  readonly clientId?: string;
4198
4305
  }
4199
4306
 
4307
+ export declare function normalizeCreateBinaryOptions(arg1: BinarySource | CreateBinaryOptions, arg2: string | undefined | MedplumRequestOptions, arg3?: string, arg4?: (e: ProgressEvent) => void): CreateBinaryOptions;
4308
+
4309
+ export declare function normalizeCreatePdfOptions(arg1: TDocumentDefinitions | CreatePdfOptions, arg2: string | undefined | MedplumRequestOptions, arg3: Record<string, CustomTableLayout> | undefined, arg4: TFontDictionary | undefined): CreatePdfOptions;
4310
+
4200
4311
  /**
4201
4312
  * Normalizes an error object into a displayable error string.
4202
4313
  * @param error - The error value which could be a string, Error, OperationOutcome, or other unknown type.
@@ -4462,7 +4573,7 @@ export declare class ParserBuilder {
4462
4573
  * @param reference - A reference to a FHIR resource.
4463
4574
  * @returns A tuple containing the `ResourceType` and the ID of the resource or `undefined` when `undefined` or an invalid reference is passed.
4464
4575
  */
4465
- export declare function parseReference(reference: Reference | undefined): [ResourceType, string];
4576
+ export declare function parseReference<T extends Resource>(reference: Reference<T> | undefined): [T['resourceType'], string];
4466
4577
 
4467
4578
  /**
4468
4579
  * Parses a URL string into a SearchRequest.
@@ -4790,7 +4901,7 @@ export declare interface ResourceVisitor {
4790
4901
 
4791
4902
  export declare type ResourceWithCode = Resource & Code;
4792
4903
 
4793
- export declare class RobustWebSocket extends TypedEventTarget<RobustWebSocketEventMap> {
4904
+ export declare class RobustWebSocket extends TypedEventTarget<RobustWebSocketEventMap> implements IRobustWebSocket {
4794
4905
  private ws;
4795
4906
  private messageBuffer;
4796
4907
  bufferedAmount: number;
@@ -4991,6 +5102,10 @@ export declare type StringMap = {
4991
5102
  */
4992
5103
  export declare function structureMapTransform(structureMap: StructureMap, input: TypedValue[], loader?: (url: string) => StructureMap[]): TypedValue[];
4993
5104
 
5105
+ export declare interface SubManagerOptions {
5106
+ RobustWebSocket: IRobustWebSocketCtor;
5107
+ }
5108
+
4994
5109
  /**
4995
5110
  * An `EventTarget` that emits events when new subscription notifications come in over WebSockets.
4996
5111
  *
@@ -5058,7 +5173,7 @@ export declare class SubscriptionManager {
5058
5173
  private criteriaEntries;
5059
5174
  private criteriaEntriesBySubscriptionId;
5060
5175
  private wsClosed;
5061
- constructor(medplum: MedplumClient, wsUrl: URL | string);
5176
+ constructor(medplum: MedplumClient, wsUrl: URL | string, options?: SubManagerOptions);
5062
5177
  private setupWebSocketListeners;
5063
5178
  private emitConnect;
5064
5179
  private emitError;
@@ -5097,6 +5212,7 @@ export declare class SymbolAtom implements Atom {
5097
5212
  readonly name: string;
5098
5213
  constructor(name: string);
5099
5214
  eval(context: AtomContext, input: TypedValue[]): TypedValue[];
5215
+ private getVariable;
5100
5216
  private evalValue;
5101
5217
  toString(): string;
5102
5218
  }
@@ -5195,6 +5311,7 @@ export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
5195
5311
  dispatchEvent<TEventType extends keyof TEvents & string>(event: TEvents[TEventType]): void;
5196
5312
  addEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
5197
5313
  removeEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
5314
+ removeAllListeners(): void;
5198
5315
  }
5199
5316
 
5200
5317
  export declare interface TypedValue {
@@ -482,6 +482,32 @@ export declare const CPT = "http://www.ama-assn.org/go/cpt";
482
482
 
483
483
  export declare function crawlResource(resource: Resource, visitor: ResourceVisitor, schema?: InternalTypeSchema, initialPath?: string): void;
484
484
 
485
+ /**
486
+ * Binary upload options.
487
+ */
488
+ export declare interface CreateBinaryOptions {
489
+ /**
490
+ * The binary data to upload.
491
+ */
492
+ readonly data: BinarySource;
493
+ /**
494
+ * Content type for the binary.
495
+ */
496
+ readonly contentType: string;
497
+ /**
498
+ * Optional filename for the binary.
499
+ */
500
+ readonly filename?: string;
501
+ /**
502
+ * Optional security context for the binary.
503
+ */
504
+ readonly securityContext?: Reference;
505
+ /**
506
+ * Optional fetch options. **NOTE:** only `requestOptions.signal` is respected when `onProgress` is also provided.
507
+ */
508
+ readonly onProgress?: (e: ProgressEvent) => void;
509
+ }
510
+
485
511
  export declare function createConstraintIssue(expression: string, constraint: Constraint): OperationOutcomeIssue;
486
512
 
487
513
  export declare const created: OperationOutcome;
@@ -499,12 +525,37 @@ export declare function createFhircastMessagePayload<EventName extends FhircastE
499
525
 
500
526
  export declare function createFhircastMessagePayload<EventName extends FhircastEventVersionRequired>(topic: string, event: EventName, context: FhircastValidContextForEvent<EventName> | FhircastValidContextForEvent<EventName>[], versionId: string): FhircastMessagePayload<EventName>;
501
527
 
528
+ export declare interface CreateMediaOptions extends CreateBinaryOptions {
529
+ /**
530
+ * Optional additional fields for the Media resource.
531
+ */
532
+ readonly additionalFields?: Partial<Media>;
533
+ }
534
+
502
535
  export declare function createOperationOutcomeIssue(severity: IssueSeverity, code: IssueType, message: string, path: string, data?: Record<string, any>): OperationOutcomeIssue;
503
536
 
504
537
  export declare interface CreatePdfFunction {
505
538
  (docDefinition: TDocumentDefinitions, tableLayouts?: Record<string, CustomTableLayout> | undefined, fonts?: TFontDictionary | undefined): Promise<any>;
506
539
  }
507
540
 
541
+ /**
542
+ * PDF upload options.
543
+ */
544
+ export declare interface CreatePdfOptions extends Omit<CreateBinaryOptions, 'data' | 'contentType'> {
545
+ /**
546
+ * The PDF document definition. See https://pdfmake.github.io/docs/0.1/document-definition-object/
547
+ */
548
+ readonly docDefinition: TDocumentDefinitions;
549
+ /**
550
+ * Optional pdfmake custom table layout.
551
+ */
552
+ readonly tableLayouts?: Record<string, CustomTableLayout>;
553
+ /**
554
+ * Optional pdfmake custom font dictionary.
555
+ */
556
+ readonly fonts?: TFontDictionary;
557
+ }
558
+
508
559
  export declare function createProcessingIssue(expression: string, message: string, err: Error, data?: Record<string, any>): OperationOutcomeIssue;
509
560
 
510
561
  /**
@@ -677,6 +728,7 @@ declare class EventTarget_2 {
677
728
  addEventListener(type: string, callback: EventListener_2): void;
678
729
  removeEventListener(type: string, callback: EventListener_2): void;
679
730
  dispatchEvent(event: Event_2): boolean;
731
+ removeAllListeners(): void;
680
732
  }
681
733
  export { EventTarget_2 as EventTarget }
682
734
 
@@ -1869,6 +1921,16 @@ export declare interface InviteRequest {
1869
1921
  admin?: boolean;
1870
1922
  }
1871
1923
 
1924
+ export declare interface IRobustWebSocket extends TypedEventTarget<RobustWebSocketEventMap> {
1925
+ readyState: number;
1926
+ close(): void;
1927
+ send(message: string): void;
1928
+ }
1929
+
1930
+ export declare interface IRobustWebSocketCtor {
1931
+ new (url: string): IRobustWebSocket;
1932
+ }
1933
+
1872
1934
  export declare function isAccepted(outcome: OperationOutcome): boolean;
1873
1935
 
1874
1936
  export declare class IsAtom extends BooleanInfixOperatorAtom {
@@ -2279,6 +2341,8 @@ export declare function matchesRange(value: number, range: Range_2, precision?:
2279
2341
  */
2280
2342
  export declare function matchesSearchRequest(resource: Resource, searchRequest: SearchRequest): boolean;
2281
2343
 
2344
+ export declare const MEDPLUM_CLI_CLIENT_ID = "medplum-cli";
2345
+
2282
2346
  export declare const MEDPLUM_VERSION: any;
2283
2347
 
2284
2348
  /**
@@ -2986,6 +3050,13 @@ export declare class MedplumClient extends EventTarget_2 {
2986
3050
  * ```
2987
3051
  *
2988
3052
  * See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
3053
+ * @category Create
3054
+ * @param createBinaryOptions -The binary options. See `CreateBinaryOptions` for full details.
3055
+ * @param requestOptions - Optional fetch options. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
3056
+ * @returns The result of the create operation.
3057
+ */
3058
+ createAttachment(createBinaryOptions: CreateBinaryOptions, requestOptions?: MedplumRequestOptions): Promise<Attachment>;
3059
+ /**
2989
3060
  * @category Create
2990
3061
  * @param data - The binary data to upload.
2991
3062
  * @param filename - Optional filename for the binary.
@@ -2993,6 +3064,7 @@ export declare class MedplumClient extends EventTarget_2 {
2993
3064
  * @param onProgress - Optional callback for progress events. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
2994
3065
  * @param options - Optional fetch options. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
2995
3066
  * @returns The result of the create operation.
3067
+ * @deprecated Use `createAttachment` with `CreateBinaryOptions` instead. To be removed in Medplum 4.0.
2996
3068
  */
2997
3069
  createAttachment(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void, options?: MedplumRequestOptions): Promise<Attachment>;
2998
3070
  /**
@@ -3013,6 +3085,14 @@ export declare class MedplumClient extends EventTarget_2 {
3013
3085
  * ```
3014
3086
  *
3015
3087
  * See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
3088
+ *
3089
+ * @category Create
3090
+ * @param createBinaryOptions -The binary options. See `CreateBinaryOptions` for full details.
3091
+ * @param requestOptions - Optional fetch options. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
3092
+ * @returns The result of the create operation.
3093
+ */
3094
+ createBinary(createBinaryOptions: CreateBinaryOptions, requestOptions?: MedplumRequestOptions): Promise<Binary>;
3095
+ /**
3016
3096
  * @category Create
3017
3097
  * @param data - The binary data to upload.
3018
3098
  * @param filename - Optional filename for the binary.
@@ -3020,6 +3100,7 @@ export declare class MedplumClient extends EventTarget_2 {
3020
3100
  * @param onProgress - Optional callback for progress events. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
3021
3101
  * @param options - Optional fetch options. **NOTE:** only `options.signal` is respected when `onProgress` is also provided.
3022
3102
  * @returns The result of the create operation.
3103
+ * @deprecated Use `createBinary` with `CreateBinaryOptions` instead. To be removed in Medplum 4.0.
3023
3104
  */
3024
3105
  createBinary(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void, options?: MedplumRequestOptions): Promise<Binary>;
3025
3106
  uploadwithProgress(url: URL, data: BinarySource, contentType: string, onProgress: (e: ProgressEvent) => void, options?: MedplumRequestOptions): Promise<any>;
@@ -3041,14 +3122,22 @@ export declare class MedplumClient extends EventTarget_2 {
3041
3122
  * ```
3042
3123
  *
3043
3124
  * See the pdfmake document definition for full details: https://pdfmake.github.io/docs/0.1/document-definition-object/
3125
+ * @category Media
3126
+ * @param createPdfOptions - The PDF creation options. See `CreatePdfOptions` for full details.
3127
+ * @param requestOptions - Optional fetch options.
3128
+ * @returns The result of the create operation.
3129
+ */
3130
+ createPdf(createPdfOptions: CreatePdfOptions, requestOptions?: MedplumRequestOptions): Promise<Binary>;
3131
+ /**
3044
3132
  * @category Media
3045
3133
  * @param docDefinition - The PDF document definition.
3046
3134
  * @param filename - Optional filename for the PDF binary resource.
3047
3135
  * @param tableLayouts - Optional pdfmake custom table layout.
3048
3136
  * @param fonts - Optional pdfmake custom font dictionary.
3049
3137
  * @returns The result of the create operation.
3138
+ * @deprecated Use `createPdf` with `CreatePdfOptions` instead. To be removed in Medplum 4.0.
3050
3139
  */
3051
- createPdf(docDefinition: TDocumentDefinitions, filename?: string, tableLayouts?: Record<string, CustomTableLayout>, fonts?: TFontDictionary): Promise<Binary>;
3140
+ createPdf(docDefinition: TDocumentDefinitions, filename: string | undefined, tableLayouts?: Record<string, CustomTableLayout>, fonts?: TFontDictionary): Promise<Binary>;
3052
3141
  /**
3053
3142
  * Creates a FHIR `Communication` resource with the provided data content.
3054
3143
  *
@@ -3419,14 +3508,24 @@ export declare class MedplumClient extends EventTarget_2 {
3419
3508
  * @returns Promise to the response body as a blob.
3420
3509
  */
3421
3510
  download(url: URL | string, options?: MedplumRequestOptions): Promise<Blob>;
3511
+ /**
3512
+ * Creates a FHIR Media resource with the provided data content.
3513
+ *
3514
+ * @category Create
3515
+ * @param createMediaOptions - The media creation options. See `CreateMediaOptions` for full details.
3516
+ * @param requestOptions - Optional fetch options.
3517
+ * @returns The new media resource.
3518
+ */
3519
+ createMedia(createMediaOptions: CreateMediaOptions, requestOptions?: MedplumRequestOptions): Promise<Media>;
3422
3520
  /**
3423
3521
  * Upload media to the server and create a Media instance for the uploaded content.
3424
3522
  * @param contents - The contents of the media file, as a string, Uint8Array, File, or Blob.
3425
3523
  * @param contentType - The media type of the content.
3426
- * @param filename - The name of the file to be uploaded, or undefined if not applicable.
3524
+ * @param filename - Optional filename for the binary, or extended upload options (see `BinaryUploadOptions`).
3427
3525
  * @param additionalFields - Additional fields for Media.
3428
3526
  * @param options - Optional fetch options.
3429
3527
  * @returns Promise that resolves to the created Media
3528
+ * @deprecated Use `createMedia` with `CreateMediaOptions` instead. To be removed in Medplum 4.0.
3430
3529
  */
3431
3530
  uploadMedia(contents: string | Uint8Array | File | Blob, contentType: string, filename: string | undefined, additionalFields?: Partial<Media>, options?: MedplumRequestOptions): Promise<Media>;
3432
3531
  /**
@@ -3505,6 +3604,14 @@ export declare class MedplumClient extends EventTarget_2 {
3505
3604
  * @param contentType - The new content type to set.
3506
3605
  */
3507
3606
  private setRequestContentType;
3607
+ /**
3608
+ * Sets a header on fetch options.
3609
+ * @param options - The fetch options.
3610
+ * @param key - The header key.
3611
+ * @param value - The header value.
3612
+ * @param ifNoneExist - Optional flag to only set the header if it doesn't already exist.
3613
+ */
3614
+ private setRequestHeader;
3508
3615
  /**
3509
3616
  * Sets the body on fetch options.
3510
3617
  * @param options - The fetch options.
@@ -4197,6 +4304,10 @@ export declare interface NewUserRequest {
4197
4304
  readonly clientId?: string;
4198
4305
  }
4199
4306
 
4307
+ export declare function normalizeCreateBinaryOptions(arg1: BinarySource | CreateBinaryOptions, arg2: string | undefined | MedplumRequestOptions, arg3?: string, arg4?: (e: ProgressEvent) => void): CreateBinaryOptions;
4308
+
4309
+ export declare function normalizeCreatePdfOptions(arg1: TDocumentDefinitions | CreatePdfOptions, arg2: string | undefined | MedplumRequestOptions, arg3: Record<string, CustomTableLayout> | undefined, arg4: TFontDictionary | undefined): CreatePdfOptions;
4310
+
4200
4311
  /**
4201
4312
  * Normalizes an error object into a displayable error string.
4202
4313
  * @param error - The error value which could be a string, Error, OperationOutcome, or other unknown type.
@@ -4462,7 +4573,7 @@ export declare class ParserBuilder {
4462
4573
  * @param reference - A reference to a FHIR resource.
4463
4574
  * @returns A tuple containing the `ResourceType` and the ID of the resource or `undefined` when `undefined` or an invalid reference is passed.
4464
4575
  */
4465
- export declare function parseReference(reference: Reference | undefined): [ResourceType, string];
4576
+ export declare function parseReference<T extends Resource>(reference: Reference<T> | undefined): [T['resourceType'], string];
4466
4577
 
4467
4578
  /**
4468
4579
  * Parses a URL string into a SearchRequest.
@@ -4790,7 +4901,7 @@ export declare interface ResourceVisitor {
4790
4901
 
4791
4902
  export declare type ResourceWithCode = Resource & Code;
4792
4903
 
4793
- export declare class RobustWebSocket extends TypedEventTarget<RobustWebSocketEventMap> {
4904
+ export declare class RobustWebSocket extends TypedEventTarget<RobustWebSocketEventMap> implements IRobustWebSocket {
4794
4905
  private ws;
4795
4906
  private messageBuffer;
4796
4907
  bufferedAmount: number;
@@ -4991,6 +5102,10 @@ export declare type StringMap = {
4991
5102
  */
4992
5103
  export declare function structureMapTransform(structureMap: StructureMap, input: TypedValue[], loader?: (url: string) => StructureMap[]): TypedValue[];
4993
5104
 
5105
+ export declare interface SubManagerOptions {
5106
+ RobustWebSocket: IRobustWebSocketCtor;
5107
+ }
5108
+
4994
5109
  /**
4995
5110
  * An `EventTarget` that emits events when new subscription notifications come in over WebSockets.
4996
5111
  *
@@ -5058,7 +5173,7 @@ export declare class SubscriptionManager {
5058
5173
  private criteriaEntries;
5059
5174
  private criteriaEntriesBySubscriptionId;
5060
5175
  private wsClosed;
5061
- constructor(medplum: MedplumClient, wsUrl: URL | string);
5176
+ constructor(medplum: MedplumClient, wsUrl: URL | string, options?: SubManagerOptions);
5062
5177
  private setupWebSocketListeners;
5063
5178
  private emitConnect;
5064
5179
  private emitError;
@@ -5097,6 +5212,7 @@ export declare class SymbolAtom implements Atom {
5097
5212
  readonly name: string;
5098
5213
  constructor(name: string);
5099
5214
  eval(context: AtomContext, input: TypedValue[]): TypedValue[];
5215
+ private getVariable;
5100
5216
  private evalValue;
5101
5217
  toString(): string;
5102
5218
  }
@@ -5195,6 +5311,7 @@ export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
5195
5311
  dispatchEvent<TEventType extends keyof TEvents & string>(event: TEvents[TEventType]): void;
5196
5312
  addEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
5197
5313
  removeEventListener<TEventType extends keyof TEvents & string>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
5314
+ removeAllListeners(): void;
5198
5315
  }
5199
5316
 
5200
5317
  export declare interface TypedValue {