@medplum/core 5.0.12 → 5.0.14

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.
@@ -181,6 +181,7 @@ export declare interface AgentTransmitRequest extends BaseAgentRequestMessage {
181
181
  remote: string;
182
182
  contentType: string;
183
183
  body: string;
184
+ returnAck?: ReturnAckCategory;
184
185
  }
185
186
 
186
187
  export declare interface AgentTransmitResponse extends BaseAgentMessage {
@@ -2786,6 +2787,19 @@ export declare function isDateString(input: unknown): input is string;
2786
2787
  */
2787
2788
  export declare function isDateTimeString(input: unknown): input is string;
2788
2789
 
2790
+ /**
2791
+ * Helper function to narrow a type by excluding undefined/null values.
2792
+ * @param value - The value to refine
2793
+ * @returns boolean
2794
+ *
2795
+ * @example
2796
+ * ```typescript
2797
+ * const arr: Array<number | undefined> = [1,undefined];
2798
+ * const refined: Array<number> = arr.filter(isDefined);
2799
+ * ```
2800
+ */
2801
+ export declare function isDefined<T>(value: T | undefined | null): value is T;
2802
+
2789
2803
  /**
2790
2804
  * Returns true if the value is empty (null, undefined, empty string, or empty object).
2791
2805
  * @param v - Any value.
@@ -3560,7 +3574,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3560
3574
  * @param options - Optional fetch options.
3561
3575
  * @returns Promise to the response content.
3562
3576
  */
3563
- post(url: URL | string, body?: any, contentType?: string, options?: MedplumRequestOptions): Promise<any>;
3577
+ post<T = any>(url: URL | string, body?: any, contentType?: string, options?: MedplumRequestOptions): Promise<T>;
3564
3578
  /**
3565
3579
  * Makes an HTTP PUT request to the specified URL.
3566
3580
  *
@@ -3693,10 +3707,11 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3693
3707
  * Exchange an external access token for a Medplum access token.
3694
3708
  * @param token - The access token that was generated by the external identity provider.
3695
3709
  * @param clientId - The ID of the `ClientApplication` in your Medplum project that will be making the exchange request.
3710
+ * @param membershipId - Optional membership ID to restrict the exchange to a specific ProjectMembership.
3696
3711
  * @returns The user profile resource.
3697
3712
  * @category Authentication
3698
3713
  */
3699
- exchangeExternalAccessToken(token: string, clientId?: string): Promise<ProfileResource>;
3714
+ exchangeExternalAccessToken(token: string, clientId?: string, membershipId?: string): Promise<ProfileResource>;
3700
3715
  /**
3701
3716
  * Builds the external identity provider redirect URI.
3702
3717
  * @param authorizeUrl - The external authorization URL.
@@ -5994,9 +6009,10 @@ export declare class ParserBuilder {
5994
6009
  * @see https://hl7.org/fhir/fhir-xquery.html
5995
6010
  * @param query - The X-Fhir-Query string to parse
5996
6011
  * @param variables - Values to pass into embedded FHIRPath expressions
6012
+ * @param context - The context collection to evaluate over
5997
6013
  * @returns The parsed search request
5998
6014
  */
5999
- export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>): SearchRequest;
6015
+ export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>, context?: TypedValue[]): SearchRequest;
6000
6016
 
6001
6017
  /**
6002
6018
  * JSONPatch patch operation.
@@ -6178,6 +6194,12 @@ export declare class ParserBuilder {
6178
6194
  * Time to wait before request timeout in milliseconds; defaults to `10000` (10 s)
6179
6195
  */
6180
6196
  waitTimeout?: number;
6197
+ /**
6198
+ * The ACK-level that the agent should wait for when sending HL7 messages.
6199
+ * - `'first'`: Return on the first ACK message received (default)
6200
+ * - `'application'`: Wait for application-level ACK (AA), skipping commit ACKs (CA)
6201
+ */
6202
+ returnAck?: ReturnAckCategory;
6181
6203
  }
6182
6204
 
6183
6205
  export declare type QuantityUnit = Pick<Quantity, 'unit' | 'code' | 'system'>;
@@ -6475,6 +6497,15 @@ export declare class ParserBuilder {
6475
6497
 
6476
6498
  export declare type ResourceWithCode = Resource & Code;
6477
6499
 
6500
+ export declare const ReturnAckCategory: {
6501
+ /** The first ACK message received is the one returned */
6502
+ readonly FIRST: "first";
6503
+ /** Only return upon receiving a positive application-level ACK (AA, AE, or AR), or if a commit-level error occurred */
6504
+ readonly APPLICATION: "application";
6505
+ };
6506
+
6507
+ export declare type ReturnAckCategory = (typeof ReturnAckCategory)[keyof typeof ReturnAckCategory];
6508
+
6478
6509
  export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
6479
6510
 
6480
6511
  export declare type SamplingInfo = Omit<SampledData, 'data'>;
@@ -6591,10 +6622,16 @@ export declare class ParserBuilder {
6591
6622
  * @param resource - The resource to add the identifier to.
6592
6623
  * @param system - The identifier system.
6593
6624
  * @param value - The identifier value.
6625
+ * @param options - Optional attributes to set
6594
6626
  */
6595
6627
  export declare function setIdentifier(resource: Resource & {
6596
6628
  identifier?: Identifier[];
6597
- }, system: string, value: string): void;
6629
+ }, system: string, value: string, options?: SetIdentifierOptions): void;
6630
+
6631
+ export declare interface SetIdentifierOptions {
6632
+ /** IdentifierUse code. See {@link https://build.fhir.org/valueset-identifier-use.html} */
6633
+ use?: Identifier['use'];
6634
+ }
6598
6635
 
6599
6636
  export declare function singleton(collection: TypedValue[], type?: string): TypedValue | undefined;
6600
6637
 
@@ -6830,6 +6867,7 @@ export declare class ParserBuilder {
6830
6867
  reconnectWebSocket(): void;
6831
6868
  getCriteriaCount(): number;
6832
6869
  getMasterEmitter(): SubscriptionEmitter;
6870
+ reconnectIfNeeded(): Promise<void>;
6833
6871
  }
6834
6872
 
6835
6873
  /**
@@ -181,6 +181,7 @@ export declare interface AgentTransmitRequest extends BaseAgentRequestMessage {
181
181
  remote: string;
182
182
  contentType: string;
183
183
  body: string;
184
+ returnAck?: ReturnAckCategory;
184
185
  }
185
186
 
186
187
  export declare interface AgentTransmitResponse extends BaseAgentMessage {
@@ -2786,6 +2787,19 @@ export declare function isDateString(input: unknown): input is string;
2786
2787
  */
2787
2788
  export declare function isDateTimeString(input: unknown): input is string;
2788
2789
 
2790
+ /**
2791
+ * Helper function to narrow a type by excluding undefined/null values.
2792
+ * @param value - The value to refine
2793
+ * @returns boolean
2794
+ *
2795
+ * @example
2796
+ * ```typescript
2797
+ * const arr: Array<number | undefined> = [1,undefined];
2798
+ * const refined: Array<number> = arr.filter(isDefined);
2799
+ * ```
2800
+ */
2801
+ export declare function isDefined<T>(value: T | undefined | null): value is T;
2802
+
2789
2803
  /**
2790
2804
  * Returns true if the value is empty (null, undefined, empty string, or empty object).
2791
2805
  * @param v - Any value.
@@ -3560,7 +3574,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3560
3574
  * @param options - Optional fetch options.
3561
3575
  * @returns Promise to the response content.
3562
3576
  */
3563
- post(url: URL | string, body?: any, contentType?: string, options?: MedplumRequestOptions): Promise<any>;
3577
+ post<T = any>(url: URL | string, body?: any, contentType?: string, options?: MedplumRequestOptions): Promise<T>;
3564
3578
  /**
3565
3579
  * Makes an HTTP PUT request to the specified URL.
3566
3580
  *
@@ -3693,10 +3707,11 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3693
3707
  * Exchange an external access token for a Medplum access token.
3694
3708
  * @param token - The access token that was generated by the external identity provider.
3695
3709
  * @param clientId - The ID of the `ClientApplication` in your Medplum project that will be making the exchange request.
3710
+ * @param membershipId - Optional membership ID to restrict the exchange to a specific ProjectMembership.
3696
3711
  * @returns The user profile resource.
3697
3712
  * @category Authentication
3698
3713
  */
3699
- exchangeExternalAccessToken(token: string, clientId?: string): Promise<ProfileResource>;
3714
+ exchangeExternalAccessToken(token: string, clientId?: string, membershipId?: string): Promise<ProfileResource>;
3700
3715
  /**
3701
3716
  * Builds the external identity provider redirect URI.
3702
3717
  * @param authorizeUrl - The external authorization URL.
@@ -5994,9 +6009,10 @@ export declare class ParserBuilder {
5994
6009
  * @see https://hl7.org/fhir/fhir-xquery.html
5995
6010
  * @param query - The X-Fhir-Query string to parse
5996
6011
  * @param variables - Values to pass into embedded FHIRPath expressions
6012
+ * @param context - The context collection to evaluate over
5997
6013
  * @returns The parsed search request
5998
6014
  */
5999
- export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>): SearchRequest;
6015
+ export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>, context?: TypedValue[]): SearchRequest;
6000
6016
 
6001
6017
  /**
6002
6018
  * JSONPatch patch operation.
@@ -6178,6 +6194,12 @@ export declare class ParserBuilder {
6178
6194
  * Time to wait before request timeout in milliseconds; defaults to `10000` (10 s)
6179
6195
  */
6180
6196
  waitTimeout?: number;
6197
+ /**
6198
+ * The ACK-level that the agent should wait for when sending HL7 messages.
6199
+ * - `'first'`: Return on the first ACK message received (default)
6200
+ * - `'application'`: Wait for application-level ACK (AA), skipping commit ACKs (CA)
6201
+ */
6202
+ returnAck?: ReturnAckCategory;
6181
6203
  }
6182
6204
 
6183
6205
  export declare type QuantityUnit = Pick<Quantity, 'unit' | 'code' | 'system'>;
@@ -6475,6 +6497,15 @@ export declare class ParserBuilder {
6475
6497
 
6476
6498
  export declare type ResourceWithCode = Resource & Code;
6477
6499
 
6500
+ export declare const ReturnAckCategory: {
6501
+ /** The first ACK message received is the one returned */
6502
+ readonly FIRST: "first";
6503
+ /** Only return upon receiving a positive application-level ACK (AA, AE, or AR), or if a commit-level error occurred */
6504
+ readonly APPLICATION: "application";
6505
+ };
6506
+
6507
+ export declare type ReturnAckCategory = (typeof ReturnAckCategory)[keyof typeof ReturnAckCategory];
6508
+
6478
6509
  export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
6479
6510
 
6480
6511
  export declare type SamplingInfo = Omit<SampledData, 'data'>;
@@ -6591,10 +6622,16 @@ export declare class ParserBuilder {
6591
6622
  * @param resource - The resource to add the identifier to.
6592
6623
  * @param system - The identifier system.
6593
6624
  * @param value - The identifier value.
6625
+ * @param options - Optional attributes to set
6594
6626
  */
6595
6627
  export declare function setIdentifier(resource: Resource & {
6596
6628
  identifier?: Identifier[];
6597
- }, system: string, value: string): void;
6629
+ }, system: string, value: string, options?: SetIdentifierOptions): void;
6630
+
6631
+ export declare interface SetIdentifierOptions {
6632
+ /** IdentifierUse code. See {@link https://build.fhir.org/valueset-identifier-use.html} */
6633
+ use?: Identifier['use'];
6634
+ }
6598
6635
 
6599
6636
  export declare function singleton(collection: TypedValue[], type?: string): TypedValue | undefined;
6600
6637
 
@@ -6830,6 +6867,7 @@ export declare class ParserBuilder {
6830
6867
  reconnectWebSocket(): void;
6831
6868
  getCriteriaCount(): number;
6832
6869
  getMasterEmitter(): SubscriptionEmitter;
6870
+ reconnectIfNeeded(): Promise<void>;
6833
6871
  }
6834
6872
 
6835
6873
  /**