@medplum/core 5.0.11 → 5.0.13

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 {
@@ -370,6 +371,22 @@ export declare interface BotEvent<T = unknown> {
370
371
  readonly requester?: Reference<Bot | ClientApplication | Patient | Practitioner | RelatedPerson>;
371
372
  /** Headers from the original request, when invoked by HTTP request */
372
373
  readonly headers?: Record<string, string | string[] | undefined>;
374
+ /** Optional response stream when invoked with SSE (Server Side Events) */
375
+ readonly responseStream?: BotResponseStream;
376
+ }
377
+
378
+ /**
379
+ * Response stream interface for bot streaming responses.
380
+ * Compatible with both VMContext and AWS Lambda runtimes.
381
+ */
382
+ export declare interface BotResponseStream extends NodeJS.WritableStream {
383
+ /**
384
+ * Starts streaming with the given status code and headers.
385
+ * Must be called before write() to commit the HTTP response.
386
+ * @param statusCode - HTTP status code (e.g., 200)
387
+ * @param headers - HTTP headers to send
388
+ */
389
+ startStreaming(statusCode: number, headers: Record<string, string>): void;
373
390
  }
374
391
 
375
392
  /**
@@ -2770,6 +2787,17 @@ export declare function isDateString(input: unknown): input is string;
2770
2787
  */
2771
2788
  export declare function isDateTimeString(input: unknown): input is string;
2772
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 usage:
2796
+ * const arr: Array<number | undefined> = [1,undefined];
2797
+ * const refined: Array<number> = arr.filter(isDefined);
2798
+ */
2799
+ export declare function isDefined<T>(value: T | undefined | null): value is T;
2800
+
2773
2801
  /**
2774
2802
  * Returns true if the value is empty (null, undefined, empty string, or empty object).
2775
2803
  * @param v - Any value.
@@ -3855,7 +3883,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3855
3883
  * @param reference - The FHIR reference.
3856
3884
  * @returns The resource if it is available in the cache; undefined otherwise.
3857
3885
  */
3858
- getCachedReference<T extends Resource>(reference: Reference<T>): T | undefined;
3886
+ getCachedReference<T extends Resource>(reference: Reference<T>): WithId<T> | undefined;
3859
3887
  /**
3860
3888
  * Reads a resource by resource type and ID.
3861
3889
  *
@@ -5978,9 +6006,10 @@ export declare class ParserBuilder {
5978
6006
  * @see https://hl7.org/fhir/fhir-xquery.html
5979
6007
  * @param query - The X-Fhir-Query string to parse
5980
6008
  * @param variables - Values to pass into embedded FHIRPath expressions
6009
+ * @param context - The context collection to evaluate over
5981
6010
  * @returns The parsed search request
5982
6011
  */
5983
- export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>): SearchRequest;
6012
+ export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>, context?: TypedValue[]): SearchRequest;
5984
6013
 
5985
6014
  /**
5986
6015
  * JSONPatch patch operation.
@@ -6162,6 +6191,12 @@ export declare class ParserBuilder {
6162
6191
  * Time to wait before request timeout in milliseconds; defaults to `10000` (10 s)
6163
6192
  */
6164
6193
  waitTimeout?: number;
6194
+ /**
6195
+ * The ACK-level that the agent should wait for when sending HL7 messages.
6196
+ * - `'first'`: Return on the first ACK message received (default)
6197
+ * - `'application'`: Wait for application-level ACK (AA), skipping commit ACKs (CA)
6198
+ */
6199
+ returnAck?: ReturnAckCategory;
6165
6200
  }
6166
6201
 
6167
6202
  export declare type QuantityUnit = Pick<Quantity, 'unit' | 'code' | 'system'>;
@@ -6459,6 +6494,15 @@ export declare class ParserBuilder {
6459
6494
 
6460
6495
  export declare type ResourceWithCode = Resource & Code;
6461
6496
 
6497
+ export declare const ReturnAckCategory: {
6498
+ /** The first ACK message received is the one returned */
6499
+ readonly FIRST: "first";
6500
+ /** Only return upon receiving a positive application-level ACK (AA, AE, or AR), or if a commit-level error occurred */
6501
+ readonly APPLICATION: "application";
6502
+ };
6503
+
6504
+ export declare type ReturnAckCategory = (typeof ReturnAckCategory)[keyof typeof ReturnAckCategory];
6505
+
6462
6506
  export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
6463
6507
 
6464
6508
  export declare type SamplingInfo = Omit<SampledData, 'data'>;
@@ -7104,6 +7148,7 @@ export declare class ParserBuilder {
7104
7148
  collect?: {
7105
7149
  tokens?: Record<string, TypedValueWithPath[]>;
7106
7150
  };
7151
+ base64BinaryMaxBytes?: number;
7107
7152
  }
7108
7153
 
7109
7154
  export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;
@@ -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 {
@@ -370,6 +371,22 @@ export declare interface BotEvent<T = unknown> {
370
371
  readonly requester?: Reference<Bot | ClientApplication | Patient | Practitioner | RelatedPerson>;
371
372
  /** Headers from the original request, when invoked by HTTP request */
372
373
  readonly headers?: Record<string, string | string[] | undefined>;
374
+ /** Optional response stream when invoked with SSE (Server Side Events) */
375
+ readonly responseStream?: BotResponseStream;
376
+ }
377
+
378
+ /**
379
+ * Response stream interface for bot streaming responses.
380
+ * Compatible with both VMContext and AWS Lambda runtimes.
381
+ */
382
+ export declare interface BotResponseStream extends NodeJS.WritableStream {
383
+ /**
384
+ * Starts streaming with the given status code and headers.
385
+ * Must be called before write() to commit the HTTP response.
386
+ * @param statusCode - HTTP status code (e.g., 200)
387
+ * @param headers - HTTP headers to send
388
+ */
389
+ startStreaming(statusCode: number, headers: Record<string, string>): void;
373
390
  }
374
391
 
375
392
  /**
@@ -2770,6 +2787,17 @@ export declare function isDateString(input: unknown): input is string;
2770
2787
  */
2771
2788
  export declare function isDateTimeString(input: unknown): input is string;
2772
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 usage:
2796
+ * const arr: Array<number | undefined> = [1,undefined];
2797
+ * const refined: Array<number> = arr.filter(isDefined);
2798
+ */
2799
+ export declare function isDefined<T>(value: T | undefined | null): value is T;
2800
+
2773
2801
  /**
2774
2802
  * Returns true if the value is empty (null, undefined, empty string, or empty object).
2775
2803
  * @param v - Any value.
@@ -3855,7 +3883,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3855
3883
  * @param reference - The FHIR reference.
3856
3884
  * @returns The resource if it is available in the cache; undefined otherwise.
3857
3885
  */
3858
- getCachedReference<T extends Resource>(reference: Reference<T>): T | undefined;
3886
+ getCachedReference<T extends Resource>(reference: Reference<T>): WithId<T> | undefined;
3859
3887
  /**
3860
3888
  * Reads a resource by resource type and ID.
3861
3889
  *
@@ -5978,9 +6006,10 @@ export declare class ParserBuilder {
5978
6006
  * @see https://hl7.org/fhir/fhir-xquery.html
5979
6007
  * @param query - The X-Fhir-Query string to parse
5980
6008
  * @param variables - Values to pass into embedded FHIRPath expressions
6009
+ * @param context - The context collection to evaluate over
5981
6010
  * @returns The parsed search request
5982
6011
  */
5983
- export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>): SearchRequest;
6012
+ export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>, context?: TypedValue[]): SearchRequest;
5984
6013
 
5985
6014
  /**
5986
6015
  * JSONPatch patch operation.
@@ -6162,6 +6191,12 @@ export declare class ParserBuilder {
6162
6191
  * Time to wait before request timeout in milliseconds; defaults to `10000` (10 s)
6163
6192
  */
6164
6193
  waitTimeout?: number;
6194
+ /**
6195
+ * The ACK-level that the agent should wait for when sending HL7 messages.
6196
+ * - `'first'`: Return on the first ACK message received (default)
6197
+ * - `'application'`: Wait for application-level ACK (AA), skipping commit ACKs (CA)
6198
+ */
6199
+ returnAck?: ReturnAckCategory;
6165
6200
  }
6166
6201
 
6167
6202
  export declare type QuantityUnit = Pick<Quantity, 'unit' | 'code' | 'system'>;
@@ -6459,6 +6494,15 @@ export declare class ParserBuilder {
6459
6494
 
6460
6495
  export declare type ResourceWithCode = Resource & Code;
6461
6496
 
6497
+ export declare const ReturnAckCategory: {
6498
+ /** The first ACK message received is the one returned */
6499
+ readonly FIRST: "first";
6500
+ /** Only return upon receiving a positive application-level ACK (AA, AE, or AR), or if a commit-level error occurred */
6501
+ readonly APPLICATION: "application";
6502
+ };
6503
+
6504
+ export declare type ReturnAckCategory = (typeof ReturnAckCategory)[keyof typeof ReturnAckCategory];
6505
+
6462
6506
  export declare const RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm";
6463
6507
 
6464
6508
  export declare type SamplingInfo = Omit<SampledData, 'data'>;
@@ -7104,6 +7148,7 @@ export declare class ParserBuilder {
7104
7148
  collect?: {
7105
7149
  tokens?: Record<string, TypedValueWithPath[]>;
7106
7150
  };
7151
+ base64BinaryMaxBytes?: number;
7107
7152
  }
7108
7153
 
7109
7154
  export declare type ValueOrExternalSecret<T extends ExternalSecretPrimitive> = T | ExternalSecret<T>;