@medplum/core 5.1.26 → 5.1.28
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 +8 -8
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/cjs/index.d.ts +427 -4
- package/dist/esm/index.d.ts +427 -4
- package/dist/esm/index.mjs +8 -8
- package/dist/esm/index.mjs.map +4 -4
- package/package.json +4 -4
package/dist/esm/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import type { Encounter } from '@medplum/fhirtypes';
|
|
|
22
22
|
import type { Extension } from '@medplum/fhirtypes';
|
|
23
23
|
import type { ExtensionValue } from '@medplum/fhirtypes';
|
|
24
24
|
import type { ExtractResource } from '@medplum/fhirtypes';
|
|
25
|
+
import type { HealthcareService } from '@medplum/fhirtypes';
|
|
25
26
|
import type { HumanName } from '@medplum/fhirtypes';
|
|
26
27
|
import type { Identifier } from '@medplum/fhirtypes';
|
|
27
28
|
import type { ImagingStudy } from '@medplum/fhirtypes';
|
|
@@ -56,6 +57,7 @@ import type { RelatedPerson } from '@medplum/fhirtypes';
|
|
|
56
57
|
import type { Resource } from '@medplum/fhirtypes';
|
|
57
58
|
import type { ResourceType } from '@medplum/fhirtypes';
|
|
58
59
|
import type { SampledData } from '@medplum/fhirtypes';
|
|
60
|
+
import type { Schedule } from '@medplum/fhirtypes';
|
|
59
61
|
import type { SearchParameter } from '@medplum/fhirtypes';
|
|
60
62
|
import type { StructureDefinition } from '@medplum/fhirtypes';
|
|
61
63
|
import type { StructureMap } from '@medplum/fhirtypes';
|
|
@@ -137,6 +139,8 @@ export declare interface AddFavoriteParams {
|
|
|
137
139
|
patientId: string;
|
|
138
140
|
pharmacy: Organization;
|
|
139
141
|
setAsPrimary: boolean;
|
|
142
|
+
/** Selected practice location for multi-practice deployments. */
|
|
143
|
+
organization?: Reference<Organization>;
|
|
140
144
|
}
|
|
141
145
|
|
|
142
146
|
export declare interface AddOperation {
|
|
@@ -429,6 +433,24 @@ export { assert_2 as assert }
|
|
|
429
433
|
|
|
430
434
|
export declare function assertContextVersionOptional(event: string): asserts event is FhircastEventVersionOptional;
|
|
431
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Checks that a value has type `never`. Useful for ensuring exhaustive
|
|
438
|
+
* matches.
|
|
439
|
+
*
|
|
440
|
+
* @example
|
|
441
|
+
* ```typescript
|
|
442
|
+
* type MyUnion = 'a' | 'b' | 'c'
|
|
443
|
+
* function f(arg: MyUnion) {
|
|
444
|
+
* if (arg === 'a') { return 1; }
|
|
445
|
+
* if (arg === 'b') { return 2; }
|
|
446
|
+
* assertNever(arg); // Type error: 'c' is unhandled
|
|
447
|
+
* }
|
|
448
|
+
* ```
|
|
449
|
+
*
|
|
450
|
+
* @param value - The value that should never be present
|
|
451
|
+
*/
|
|
452
|
+
export declare function assertNever(value: never): never;
|
|
453
|
+
|
|
432
454
|
/**
|
|
433
455
|
* Asserts that the operation completed successfully and that the resource is defined.
|
|
434
456
|
* @param outcome - The operation outcome.
|
|
@@ -442,6 +464,8 @@ export declare function assertOk<T>(outcome: OperationOutcome, resource: T | und
|
|
|
442
464
|
*/
|
|
443
465
|
export declare function assertReleaseManifest(candidate: unknown): asserts candidate is ReleaseManifest;
|
|
444
466
|
|
|
467
|
+
export declare function assertValidMedplumSemver(version: string): asserts version is MedplumSemver;
|
|
468
|
+
|
|
445
469
|
export declare interface AsyncCrawlerVisitor {
|
|
446
470
|
onEnterObject?: (path: string, value: TypedValueWithPath, schema: InternalTypeSchema) => Promise<void>;
|
|
447
471
|
onExitObject?: (path: string, value: TypedValueWithPath, schema: InternalTypeSchema) => Promise<void>;
|
|
@@ -870,6 +894,14 @@ export declare type CodeChallengeMethod = 'plain' | 'S256';
|
|
|
870
894
|
*/
|
|
871
895
|
export declare function codingMatchesToken(coding: Coding, token: string): boolean;
|
|
872
896
|
|
|
897
|
+
/**
|
|
898
|
+
* Compares two Medplum semver version strings, ignoring any trailing commit-hash suffix.
|
|
899
|
+
* @param a - The first version to compare.
|
|
900
|
+
* @param b - The second version to compare.
|
|
901
|
+
* @returns A negative number if `a` is older than `b`, a positive number if `a` is newer than `b`, or `0` if they resolve to the same release.
|
|
902
|
+
*/
|
|
903
|
+
export declare function compareVersions(a: MedplumSemver, b: MedplumSemver): number;
|
|
904
|
+
|
|
873
905
|
export declare function compressElement(element: InternalSchemaElement): Partial<InternalSchemaElement>;
|
|
874
906
|
|
|
875
907
|
export declare class ConcatAtom extends InfixOperatorAtom {
|
|
@@ -942,6 +974,8 @@ export declare function contentTooLarge(text: string): OperationOutcome;
|
|
|
942
974
|
export declare const ContentType: {
|
|
943
975
|
readonly CSS: "text/css";
|
|
944
976
|
readonly DICOM: "application/dicom";
|
|
977
|
+
readonly DICOM_JSON: "application/dicom+json";
|
|
978
|
+
readonly EVENT_STREAM: "text/event-stream";
|
|
945
979
|
readonly FAVICON: "image/vnd.microsoft.icon";
|
|
946
980
|
readonly FHIR_JSON: "application/fhir+json";
|
|
947
981
|
readonly FORM_URL_ENCODED: "application/x-www-form-urlencoded";
|
|
@@ -1241,6 +1275,10 @@ export declare type DataTypesMap = {
|
|
|
1241
1275
|
[type: string]: InternalTypeSchema;
|
|
1242
1276
|
};
|
|
1243
1277
|
|
|
1278
|
+
export declare type DayOfWeek = (typeof DAYS_OF_WEEK)[number];
|
|
1279
|
+
|
|
1280
|
+
export declare const DAYS_OF_WEEK: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
1281
|
+
|
|
1244
1282
|
/**
|
|
1245
1283
|
* Decodes a base64 string.
|
|
1246
1284
|
* Handles both browser and Node environments.
|
|
@@ -1617,12 +1655,27 @@ export declare const ExternalSecretSystems: {
|
|
|
1617
1655
|
*/
|
|
1618
1656
|
export declare function extractAccountReferences(meta: Meta | undefined): Reference[] | undefined;
|
|
1619
1657
|
|
|
1658
|
+
/**
|
|
1659
|
+
* Extracts HealthcareService references from serviceType concepts.
|
|
1660
|
+
* @param serviceType - CodeableConcept values to inspect
|
|
1661
|
+
* @returns HealthcareService references embedded in the concepts
|
|
1662
|
+
*/
|
|
1663
|
+
export declare function extractServiceTypeReferences(serviceType: CodeableConcept[] | undefined): Reference<HealthcareService>[];
|
|
1664
|
+
|
|
1665
|
+
/**
|
|
1666
|
+
* Fetches the version strings for all published Medplum releases.
|
|
1667
|
+
* @param appName - The name of the app to fetch the release list for.
|
|
1668
|
+
* @param params - An optional list of key-value pairs to be appended to the URL query string.
|
|
1669
|
+
* @returns An array of version strings (without the leading `v`), sorted from newest to oldest.
|
|
1670
|
+
*/
|
|
1671
|
+
export declare function fetchAllVersionStrings(appName: string, params?: Record<string, string>): Promise<MedplumSemver[]>;
|
|
1672
|
+
|
|
1620
1673
|
/**
|
|
1621
1674
|
* Fetches the latest Medplum release version string.
|
|
1622
1675
|
* @param appName - The name of the app to fetch the latest version for.
|
|
1623
1676
|
* @returns A version string corresponding to the latest Medplum release version.
|
|
1624
1677
|
*/
|
|
1625
|
-
export declare function fetchLatestVersionString(appName: string): Promise<
|
|
1678
|
+
export declare function fetchLatestVersionString(appName: string): Promise<MedplumSemver>;
|
|
1626
1679
|
|
|
1627
1680
|
export declare type FetchLike = (url: string, options?: any) => Promise<any>;
|
|
1628
1681
|
|
|
@@ -2585,6 +2638,8 @@ export declare function getSearchParameterDetails(resourceType: string, searchPa
|
|
|
2585
2638
|
*/
|
|
2586
2639
|
export declare function getSearchParameters(resourceType: string): Record<string, SearchParameter> | undefined;
|
|
2587
2640
|
|
|
2641
|
+
export declare function getSearchResourceTypes(searchRequest: SearchRequest): ResourceType[];
|
|
2642
|
+
|
|
2588
2643
|
export declare function getSmartHealthLinkId(manifestUrl: string): string | undefined;
|
|
2589
2644
|
|
|
2590
2645
|
export declare function getStatus(outcome: OperationOutcome): number;
|
|
@@ -2663,6 +2718,13 @@ export declare interface GoogleLoginRequest extends BaseLoginRequest {
|
|
|
2663
2718
|
readonly createUser?: boolean;
|
|
2664
2719
|
}
|
|
2665
2720
|
|
|
2721
|
+
/**
|
|
2722
|
+
* Returns whether a Schedule or HealthcareService has a SchedulingParameters extension.
|
|
2723
|
+
* @param resource - Schedule or HealthcareService to inspect
|
|
2724
|
+
* @returns True if the resource has a SchedulingParameters extension
|
|
2725
|
+
*/
|
|
2726
|
+
export declare function hasSchedulingParameters(resource: Schedule | HealthcareService): boolean;
|
|
2727
|
+
|
|
2666
2728
|
export declare interface Hl7AckOptions {
|
|
2667
2729
|
ackCode: AckCode;
|
|
2668
2730
|
errSegment?: Hl7Segment;
|
|
@@ -3224,6 +3286,18 @@ export declare function intersection(objects: ArrayLike<{
|
|
|
3224
3286
|
[index: string]: any;
|
|
3225
3287
|
}>): string[];
|
|
3226
3288
|
|
|
3289
|
+
/**
|
|
3290
|
+
* Stable error when a cart-management bot response does not match
|
|
3291
|
+
* {@link MedicationCartManageResponse}.
|
|
3292
|
+
*/
|
|
3293
|
+
export declare const INVALID_MEDICATION_CART_RESPONSE = "Invalid response from cart-management bot";
|
|
3294
|
+
|
|
3295
|
+
/**
|
|
3296
|
+
* Stable error when a checkout-medications bot response does not match
|
|
3297
|
+
* {@link MedicationCheckoutResponse}.
|
|
3298
|
+
*/
|
|
3299
|
+
export declare const INVALID_MEDICATION_CHECKOUT_RESPONSE = "Invalid response from checkout-medications bot";
|
|
3300
|
+
|
|
3227
3301
|
/**
|
|
3228
3302
|
* Stable error when a bot response does not match {@link MedicationOrderResponse}.
|
|
3229
3303
|
*/
|
|
@@ -3362,6 +3436,8 @@ export declare function isDateString(input: unknown): input is string;
|
|
|
3362
3436
|
*/
|
|
3363
3437
|
export declare function isDateTimeString(input: unknown): input is string;
|
|
3364
3438
|
|
|
3439
|
+
export declare function isDayOfWeek(value: string | undefined): value is DayOfWeek;
|
|
3440
|
+
|
|
3365
3441
|
/**
|
|
3366
3442
|
* Helper function to narrow a type by excluding undefined/null values.
|
|
3367
3443
|
* @param value - The value to refine
|
|
@@ -3427,6 +3503,20 @@ export declare function isLowerCase(c: string): boolean;
|
|
|
3427
3503
|
*/
|
|
3428
3504
|
export declare function isMedicationArray(value: unknown): value is Medication[];
|
|
3429
3505
|
|
|
3506
|
+
/**
|
|
3507
|
+
* Type guard: validates a cart-management bot response.
|
|
3508
|
+
* @param value - Unknown bot JSON payload.
|
|
3509
|
+
* @returns True when the value matches {@link MedicationCartManageResponse}.
|
|
3510
|
+
*/
|
|
3511
|
+
export declare function isMedicationCartManageResponse(value: unknown): value is MedicationCartManageResponse;
|
|
3512
|
+
|
|
3513
|
+
/**
|
|
3514
|
+
* Type guard: validates a checkout-medications bot response.
|
|
3515
|
+
* @param value - Unknown bot JSON payload.
|
|
3516
|
+
* @returns True when the value matches {@link MedicationCheckoutResponse}.
|
|
3517
|
+
*/
|
|
3518
|
+
export declare function isMedicationCheckoutResponse(value: unknown): value is MedicationCheckoutResponse;
|
|
3519
|
+
|
|
3430
3520
|
/**
|
|
3431
3521
|
* Type guard: validates an order-medication bot response.
|
|
3432
3522
|
* @param value - Unknown bot JSON payload.
|
|
@@ -3648,7 +3738,7 @@ export declare function isValidHostname(input: string): boolean;
|
|
|
3648
3738
|
* @param version - A version string that should be tested for valid semver semantics.
|
|
3649
3739
|
* @returns `true` if `version` is a valid semver version that conforms to the Medplum versioning system, otherwise `false`.
|
|
3650
3740
|
*/
|
|
3651
|
-
export declare function isValidMedplumSemver(version: string):
|
|
3741
|
+
export declare function isValidMedplumSemver(version: string): version is MedplumSemver;
|
|
3652
3742
|
|
|
3653
3743
|
/**
|
|
3654
3744
|
* Generic interface that an implementation of `WebSocket` must satisfy to be used with `ReconnectingWebSocket`.
|
|
@@ -4006,6 +4096,126 @@ export declare const MEDICATION_REQUEST_STATUS_REASON_RESPONSE_NOT_RECEIVED = "r
|
|
|
4006
4096
|
*/
|
|
4007
4097
|
export declare const MEDICATION_REQUEST_STATUS_REASON_SYSTEM = "https://medplum.com/fhir/CodeSystem/medication-request-status-reason";
|
|
4008
4098
|
|
|
4099
|
+
/**
|
|
4100
|
+
* Vendor-neutral input to clear the patient's whole vendor cart (`$clear-cart`).
|
|
4101
|
+
*/
|
|
4102
|
+
export declare interface MedicationCartClearRequest {
|
|
4103
|
+
readonly patientId: string;
|
|
4104
|
+
}
|
|
4105
|
+
|
|
4106
|
+
/**
|
|
4107
|
+
* Encodes a {@link MedicationCartClearRequest} as a FHIR `Parameters` body for
|
|
4108
|
+
* the `$clear-cart` custom operation. Emits the `action: 'clear'` discriminator.
|
|
4109
|
+
*
|
|
4110
|
+
* @param req - Clear request (vendor-neutral).
|
|
4111
|
+
* @returns A `Parameters` resource ready to POST.
|
|
4112
|
+
*/
|
|
4113
|
+
export declare function medicationCartClearRequestToParameters(req: MedicationCartClearRequest): Parameters_2;
|
|
4114
|
+
|
|
4115
|
+
/**
|
|
4116
|
+
* Per-item outcome from a cart remove/clear. `removed` = the vendor cart item
|
|
4117
|
+
* was deleted; `not-in-cart` = the draft was not staged (nothing to remove);
|
|
4118
|
+
* `failed` = the vendor delete failed (see `error`).
|
|
4119
|
+
*/
|
|
4120
|
+
export declare interface MedicationCartItemResult {
|
|
4121
|
+
readonly medicationRequestId?: string;
|
|
4122
|
+
/** Vendor cart-item reference that was removed (ScriptSure MedCart `rxId`), when known. */
|
|
4123
|
+
readonly vendorLineId?: string;
|
|
4124
|
+
readonly status: 'removed' | 'not-in-cart' | 'failed';
|
|
4125
|
+
readonly error?: string;
|
|
4126
|
+
}
|
|
4127
|
+
|
|
4128
|
+
/**
|
|
4129
|
+
* Vendor-neutral output from a cart remove/clear: the vendor patient id, the
|
|
4130
|
+
* number of cart items actually removed, and the per-line outcomes (one for a
|
|
4131
|
+
* remove, N for a clear).
|
|
4132
|
+
*/
|
|
4133
|
+
export declare interface MedicationCartManageResponse {
|
|
4134
|
+
/** Vendor-side patient id (numeric in ScriptSure today). */
|
|
4135
|
+
readonly vendorPatientId: number;
|
|
4136
|
+
readonly removedCount: number;
|
|
4137
|
+
readonly items: MedicationCartItemResult[];
|
|
4138
|
+
}
|
|
4139
|
+
|
|
4140
|
+
/**
|
|
4141
|
+
* Vendor-neutral input to remove a single draft `MedicationRequest` from the
|
|
4142
|
+
* patient's vendor cart (`$remove-cart-medication`).
|
|
4143
|
+
*/
|
|
4144
|
+
export declare interface MedicationCartRemoveRequest {
|
|
4145
|
+
readonly patientId: string;
|
|
4146
|
+
readonly medicationRequestId: string;
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
/**
|
|
4150
|
+
* Encodes a {@link MedicationCartRemoveRequest} as a FHIR `Parameters` body for
|
|
4151
|
+
* the `$remove-cart-medication` custom operation. Emits the `action: 'remove'`
|
|
4152
|
+
* discriminator the shared cart-management bot dispatches on.
|
|
4153
|
+
*
|
|
4154
|
+
* @param req - Remove request (vendor-neutral).
|
|
4155
|
+
* @returns A `Parameters` resource ready to POST.
|
|
4156
|
+
*/
|
|
4157
|
+
export declare function medicationCartRemoveRequestToParameters(req: MedicationCartRemoveRequest): Parameters_2;
|
|
4158
|
+
|
|
4159
|
+
/**
|
|
4160
|
+
* Per-line outcome from a cart checkout. A single bad line is reported here as
|
|
4161
|
+
* `failed` rather than rolling back the lines that already queued.
|
|
4162
|
+
*/
|
|
4163
|
+
export declare interface MedicationCheckoutItemResult {
|
|
4164
|
+
readonly medicationRequestId: string;
|
|
4165
|
+
/**
|
|
4166
|
+
* Vendor per-line reference returned at checkout, for diagnostics/audit. The
|
|
4167
|
+
* concrete meaning is vendor-specific: a cart-item id for cart-based vendors
|
|
4168
|
+
* (ScriptSure MedCart `rxId`) or a per-prescription id for queue-based ones.
|
|
4169
|
+
* Optional because the vendor may not mint one at add time.
|
|
4170
|
+
*/
|
|
4171
|
+
readonly vendorLineId?: string;
|
|
4172
|
+
readonly status: 'queued' | 'failed';
|
|
4173
|
+
/**
|
|
4174
|
+
* True when the line was **not** added because the same drug was already in
|
|
4175
|
+
* the vendor's cart (the vendor-recommended duplicate check matched). Reported
|
|
4176
|
+
* as `status: 'queued'` with this flag set so the caller can surface it.
|
|
4177
|
+
*/
|
|
4178
|
+
readonly duplicate?: boolean;
|
|
4179
|
+
readonly error?: string;
|
|
4180
|
+
}
|
|
4181
|
+
|
|
4182
|
+
/**
|
|
4183
|
+
* Vendor-neutral input for a cart-checkout bot: submit a set of draft
|
|
4184
|
+
* `MedicationRequest`s (the cart) to the vendor's electronic approval queue.
|
|
4185
|
+
*/
|
|
4186
|
+
export declare interface MedicationCheckoutRequest {
|
|
4187
|
+
readonly patientId: string;
|
|
4188
|
+
readonly medicationRequestIds: string[];
|
|
4189
|
+
readonly appId?: string;
|
|
4190
|
+
/** Selected practice location; omit for single-practice prescribers. */
|
|
4191
|
+
readonly organization?: Reference<Organization>;
|
|
4192
|
+
}
|
|
4193
|
+
|
|
4194
|
+
/**
|
|
4195
|
+
* Encodes a {@link MedicationCheckoutRequest} as a FHIR `Parameters` body for
|
|
4196
|
+
* the vendor-neutral `$checkout-medications` custom operation
|
|
4197
|
+
* (`POST /fhir/R4/MedicationRequest/$checkout-medications`).
|
|
4198
|
+
*
|
|
4199
|
+
* `medicationRequestIds` is emitted as one `parameter` entry per id so the
|
|
4200
|
+
* OperationDefinition's `max: '*'` cardinality round-trips. Optional fields are
|
|
4201
|
+
* omitted entirely.
|
|
4202
|
+
*
|
|
4203
|
+
* @param req - Cart checkout request (vendor-neutral).
|
|
4204
|
+
* @returns A `Parameters` resource ready to POST.
|
|
4205
|
+
*/
|
|
4206
|
+
export declare function medicationCheckoutRequestToParameters(req: MedicationCheckoutRequest): Parameters_2;
|
|
4207
|
+
|
|
4208
|
+
/**
|
|
4209
|
+
* Vendor-neutral output from a cart-checkout bot: a single embeddable approval
|
|
4210
|
+
* widget URL (the vendor's batch sign-off surface) plus per-line results.
|
|
4211
|
+
*/
|
|
4212
|
+
export declare interface MedicationCheckoutResponse {
|
|
4213
|
+
readonly approvalUrl: string;
|
|
4214
|
+
/** Vendor-side patient id (numeric in ScriptSure today). */
|
|
4215
|
+
readonly vendorPatientId: number;
|
|
4216
|
+
readonly items: MedicationCheckoutItemResult[];
|
|
4217
|
+
}
|
|
4218
|
+
|
|
4009
4219
|
/**
|
|
4010
4220
|
* Vendor-neutral drug line for {@link MedicationOrderRequest}.
|
|
4011
4221
|
*/
|
|
@@ -4029,6 +4239,14 @@ export declare interface MedicationOrderExtensions {
|
|
|
4029
4239
|
readonly pendingOrderIdSystem: string;
|
|
4030
4240
|
readonly pendingOrderStatusUrl: string;
|
|
4031
4241
|
readonly iframeUrlExtension: string;
|
|
4242
|
+
/**
|
|
4243
|
+
* Identifier system for the vendor's per-prescription message id (SureScripts
|
|
4244
|
+
* `messageId` in ScriptSure). Stamped on a draft `MedicationRequest` by the
|
|
4245
|
+
* cart-checkout flow and used to reconcile the approval webhook back to the
|
|
4246
|
+
* draft. Optional so existing single-order consumers don't have to populate it.
|
|
4247
|
+
* Consumed by the paired `medplum-ee` cart-checkout / prescription-webhook bots.
|
|
4248
|
+
*/
|
|
4249
|
+
readonly messageIdSystem?: string;
|
|
4032
4250
|
}
|
|
4033
4251
|
|
|
4034
4252
|
/**
|
|
@@ -4066,6 +4284,8 @@ export declare interface MedicationOrderRequest {
|
|
|
4066
4284
|
/** Free-text patient instructions (additional sig); maps to dosageInstruction[0].patientInstruction when using MR path. */
|
|
4067
4285
|
readonly patientInstruction?: string;
|
|
4068
4286
|
readonly appId?: string;
|
|
4287
|
+
/** Selected practice location for multi-practice deployments. */
|
|
4288
|
+
readonly organization?: Reference<Organization>;
|
|
4069
4289
|
}
|
|
4070
4290
|
|
|
4071
4291
|
/**
|
|
@@ -4115,6 +4335,8 @@ export declare interface MedicationOrderSetRequest {
|
|
|
4115
4335
|
*/
|
|
4116
4336
|
readonly vendorOrderSetId?: number | string;
|
|
4117
4337
|
readonly appId?: string;
|
|
4338
|
+
/** Selected practice location for multi-practice deployments. */
|
|
4339
|
+
readonly organization?: Reference<Organization>;
|
|
4118
4340
|
}
|
|
4119
4341
|
|
|
4120
4342
|
/**
|
|
@@ -4181,6 +4403,8 @@ export declare const MEDPLUM_CLI_CLIENT_ID = "medplum-cli";
|
|
|
4181
4403
|
|
|
4182
4404
|
export declare const MEDPLUM_RELEASES_URL = "https://meta.medplum.com/releases";
|
|
4183
4405
|
|
|
4406
|
+
export declare const MEDPLUM_SEMVER_REGEX: RegExp;
|
|
4407
|
+
|
|
4184
4408
|
export declare const MEDPLUM_VERSION: string;
|
|
4185
4409
|
|
|
4186
4410
|
/**
|
|
@@ -4379,6 +4603,28 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4379
4603
|
* @param resourceType - The resource type to invalidate.
|
|
4380
4604
|
*/
|
|
4381
4605
|
invalidateSearches(resourceType: ResourceType): void;
|
|
4606
|
+
/**
|
|
4607
|
+
* Notifies listeners that a resource was modified outside of the standard CRUD methods,
|
|
4608
|
+
* and invalidates the relevant cached values.
|
|
4609
|
+
*
|
|
4610
|
+
* The client emits the `resourceModified` event automatically for `createResource`,
|
|
4611
|
+
* `updateResource`, `patchResource`, `deleteResource`, and related methods. Use this method
|
|
4612
|
+
* to announce modifications the client cannot classify itself, such as custom operations,
|
|
4613
|
+
* GraphQL mutations, or out-of-band changes:
|
|
4614
|
+
*
|
|
4615
|
+
* ```typescript
|
|
4616
|
+
* await medplum.post(medplum.fhirUrl('Appointment', '$book'), parameters);
|
|
4617
|
+
* medplum.notifyResourceModified({ resourceType: 'Appointment', operation: 'create' });
|
|
4618
|
+
* medplum.notifyResourceModified({ resourceType: 'Slot', operation: 'update' });
|
|
4619
|
+
* ```
|
|
4620
|
+
*
|
|
4621
|
+
* Cached searches for the resource type are invalidated. If `event.resource` is provided
|
|
4622
|
+
* for a non-delete operation, it becomes the cached read value; otherwise, if `event.id`
|
|
4623
|
+
* is provided, the cached read is invalidated.
|
|
4624
|
+
* @category Caching
|
|
4625
|
+
* @param event - The resource modification to announce.
|
|
4626
|
+
*/
|
|
4627
|
+
notifyResourceModified(event: ResourceModifiedEvent): void;
|
|
4382
4628
|
/**
|
|
4383
4629
|
* Makes an HTTP GET request to the specified URL.
|
|
4384
4630
|
*
|
|
@@ -5552,6 +5798,11 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
5552
5798
|
* @param key - The cache key to delete.
|
|
5553
5799
|
*/
|
|
5554
5800
|
private deleteCacheEntry;
|
|
5801
|
+
/**
|
|
5802
|
+
* Dispatches a `resourceModified` event if there are any listeners.
|
|
5803
|
+
* @param payload - The event payload.
|
|
5804
|
+
*/
|
|
5805
|
+
private dispatchResourceModified;
|
|
5555
5806
|
/**
|
|
5556
5807
|
* Makes an HTTP request.
|
|
5557
5808
|
* @param url - The target URL.
|
|
@@ -5611,8 +5862,8 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
5611
5862
|
/**
|
|
5612
5863
|
* Handles an unauthenticated (HTTP 401) response from the server.
|
|
5613
5864
|
*
|
|
5614
|
-
* Bounded and terminal: at most
|
|
5615
|
-
* + 1 recovery, tracked via
|
|
5865
|
+
* Bounded and terminal: at most `MAX_AUTH_ATTEMPTS` attempts per request (1 initial
|
|
5866
|
+
* + 1 recovery, tracked via `RequestState.authAttempt`). The recovery re-mints via a
|
|
5616
5867
|
* forced {@link MedplumClient.refresh} (bypassing the {@link MedplumClient.isAuthenticated}
|
|
5617
5868
|
* short-circuit on the rejected token), single-flight so concurrent 401s share one re-mint.
|
|
5618
5869
|
* A second 401 is terminal: clear auth, `onUnauthenticated`, reject — never recurse.
|
|
@@ -5962,6 +6213,10 @@ export declare type MedplumClientEventMap = {
|
|
|
5962
6213
|
error: Error;
|
|
5963
6214
|
};
|
|
5964
6215
|
};
|
|
6216
|
+
resourceModified: {
|
|
6217
|
+
type: 'resourceModified';
|
|
6218
|
+
payload: ResourceModifiedEvent;
|
|
6219
|
+
};
|
|
5965
6220
|
};
|
|
5966
6221
|
|
|
5967
6222
|
/**
|
|
@@ -6454,6 +6709,8 @@ export declare interface MedplumRequestOptions extends RequestInit {
|
|
|
6454
6709
|
duplex?: 'half';
|
|
6455
6710
|
}
|
|
6456
6711
|
|
|
6712
|
+
export declare type MedplumSemver = `${number}.${number}.${number}` | `${number}.${number}.${number}-${string}`;
|
|
6713
|
+
|
|
6457
6714
|
export declare interface MedplumSourceInfraConfig {
|
|
6458
6715
|
name: ValueOrExternalSecret<string>;
|
|
6459
6716
|
stackName: ValueOrExternalSecret<string>;
|
|
@@ -6998,11 +7255,66 @@ export declare class OrAtom extends InfixOperatorAtom {
|
|
|
6998
7255
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
6999
7256
|
}
|
|
7000
7257
|
|
|
7258
|
+
/**
|
|
7259
|
+
* Vendor-neutral decoded response from the `$sync-orderset` custom operation
|
|
7260
|
+
* (`POST /fhir/R4/PlanDefinition/$sync-orderset`). `failedCount > 0` means the
|
|
7261
|
+
* synced vendor order set carries fewer meds than the `PlanDefinition`.
|
|
7262
|
+
*/
|
|
7263
|
+
export declare interface OrderSetSyncResponse {
|
|
7264
|
+
readonly mode: 'created' | 'noop-already-synced';
|
|
7265
|
+
readonly planDefinitionId?: string;
|
|
7266
|
+
readonly scriptSureOrdersetId?: number;
|
|
7267
|
+
readonly syncedCount: number;
|
|
7268
|
+
readonly failedCount: number;
|
|
7269
|
+
readonly results: OrderSetSyncSequenceResult[];
|
|
7270
|
+
}
|
|
7271
|
+
|
|
7272
|
+
/**
|
|
7273
|
+
* Per-action outcome from the vendor-neutral `$sync-orderset` operation. A
|
|
7274
|
+
* `'failed'` row carries `error` and was NOT added to the vendor order set, so
|
|
7275
|
+
* a later apply/signing session would open with fewer meds than the
|
|
7276
|
+
* `PlanDefinition` requested — callers must surface these.
|
|
7277
|
+
*/
|
|
7278
|
+
export declare interface OrderSetSyncSequenceResult {
|
|
7279
|
+
readonly actionTitle?: string;
|
|
7280
|
+
readonly activityDefinitionUrl?: string;
|
|
7281
|
+
readonly scriptSureSequenceId?: number;
|
|
7282
|
+
readonly scriptSureOrderId?: number;
|
|
7283
|
+
readonly status: 'synced' | 'failed';
|
|
7284
|
+
readonly error?: string;
|
|
7285
|
+
}
|
|
7286
|
+
|
|
7001
7287
|
/**
|
|
7002
7288
|
* SQL on FHIR output row.
|
|
7003
7289
|
*/
|
|
7004
7290
|
export declare type OutputRow = Record<string, any>;
|
|
7005
7291
|
|
|
7292
|
+
/**
|
|
7293
|
+
* Decodes the `Parameters` response from the `$remove-cart-medication` /
|
|
7294
|
+
* `$clear-cart` custom operations into a typed {@link MedicationCartManageResponse}.
|
|
7295
|
+
* Throws {@link INVALID_MEDICATION_CART_RESPONSE} when required top-level fields
|
|
7296
|
+
* are missing.
|
|
7297
|
+
*
|
|
7298
|
+
* @param params - The `Parameters` resource returned by the operation.
|
|
7299
|
+
* @returns A vendor-neutral {@link MedicationCartManageResponse}.
|
|
7300
|
+
*/
|
|
7301
|
+
export declare function parametersToMedicationCartManageResponse(params: Parameters_2): MedicationCartManageResponse;
|
|
7302
|
+
|
|
7303
|
+
/**
|
|
7304
|
+
* Decodes the `Parameters` response from the `$checkout-medications` custom
|
|
7305
|
+
* operation into a typed {@link MedicationCheckoutResponse}. Throws
|
|
7306
|
+
* `INVALID_MEDICATION_CHECKOUT_RESPONSE` when required top-level fields are
|
|
7307
|
+
* missing.
|
|
7308
|
+
*
|
|
7309
|
+
* The repeating `items` parameter is collected across every occurrence (each is
|
|
7310
|
+
* one queued/failed line); the scalar `approvalUrl` / `vendorPatientId` are read
|
|
7311
|
+
* once.
|
|
7312
|
+
*
|
|
7313
|
+
* @param params - The `Parameters` resource returned by the operation.
|
|
7314
|
+
* @returns A vendor-neutral {@link MedicationCheckoutResponse}.
|
|
7315
|
+
*/
|
|
7316
|
+
export declare function parametersToMedicationCheckoutResponse(params: Parameters_2): MedicationCheckoutResponse;
|
|
7317
|
+
|
|
7006
7318
|
/**
|
|
7007
7319
|
* Decodes the `Parameters` response from the `$order-medication` custom
|
|
7008
7320
|
* operation into a typed {@link MedicationOrderResponse}. Throws
|
|
@@ -7027,6 +7339,16 @@ export declare function parametersToMedicationOrderResponse(params: Parameters_2
|
|
|
7027
7339
|
*/
|
|
7028
7340
|
export declare function parametersToMedicationOrderSetResponse(params: Parameters_2): MedicationOrderSetResponse;
|
|
7029
7341
|
|
|
7342
|
+
/**
|
|
7343
|
+
* Decodes the `Parameters` response from the `$sync-orderset` custom operation
|
|
7344
|
+
* into a typed {@link OrderSetSyncResponse}, including the repeating per-action
|
|
7345
|
+
* `results` rows the server previously dropped.
|
|
7346
|
+
*
|
|
7347
|
+
* @param params - The `Parameters` resource returned by the operation.
|
|
7348
|
+
* @returns A vendor-neutral {@link OrderSetSyncResponse}.
|
|
7349
|
+
*/
|
|
7350
|
+
export declare function parametersToOrderSetSyncResponse(params: Parameters_2): OrderSetSyncResponse;
|
|
7351
|
+
|
|
7030
7352
|
/**
|
|
7031
7353
|
* Parses a FHIRPath expression into an AST.
|
|
7032
7354
|
* The result can be used to evaluate the expression against a resource or other object.
|
|
@@ -7037,6 +7359,16 @@ export declare function parametersToMedicationOrderSetResponse(params: Parameter
|
|
|
7037
7359
|
*/
|
|
7038
7360
|
export declare function parseFhirPath(input: string): FhirPathAtom;
|
|
7039
7361
|
|
|
7362
|
+
/**
|
|
7363
|
+
* Parses a FHIRPath Patch `Parameters` resource into the array of operations consumed by
|
|
7364
|
+
* {@link fhirpathPatchTypedValue}. Each repeating `operation` parameter is decoded from its
|
|
7365
|
+
* `part` entries (`type`, `path`, `name`, `value`, `index`, `source`, `destination`), where
|
|
7366
|
+
* the polymorphic `value[x]` part becomes a {@link TypedValue}.
|
|
7367
|
+
* @param parameters - The FHIRPath Patch Parameters resource.
|
|
7368
|
+
* @returns The parsed FHIRPath Patch operations.
|
|
7369
|
+
*/
|
|
7370
|
+
export declare function parseFhirPathPatchParameters(parameters: Parameters_2): FhirPathPatch[];
|
|
7371
|
+
|
|
7040
7372
|
/**
|
|
7041
7373
|
* Parses a FHIR _filter parameter expression into an AST.
|
|
7042
7374
|
* @param input - The FHIR _filter parameter expression.
|
|
@@ -7212,6 +7544,8 @@ export declare class ParserBuilder {
|
|
|
7212
7544
|
address?: string;
|
|
7213
7545
|
phoneOrFax?: string;
|
|
7214
7546
|
ncpdpID?: string;
|
|
7547
|
+
/** Selected practice location for multi-practice deployments. */
|
|
7548
|
+
organization?: Reference<Organization>;
|
|
7215
7549
|
}
|
|
7216
7550
|
|
|
7217
7551
|
/**
|
|
@@ -7784,6 +8118,29 @@ export declare class ParserBuilder {
|
|
|
7784
8118
|
|
|
7785
8119
|
export declare function resourceMatchesSubscriptionCriteria({ resource, subscription, context, getPreviousResource, logger, }: ResourceMatchesSubscriptionCriteria): Promise<boolean>;
|
|
7786
8120
|
|
|
8121
|
+
/**
|
|
8122
|
+
* Payload of the `resourceModified` event, emitted after this client instance successfully
|
|
8123
|
+
* creates, updates, patches, or deletes a FHIR resource.
|
|
8124
|
+
*
|
|
8125
|
+
* Emitted by `createResource`, `createResourceIfNoneExist`, `updateResource`, `upsertResource`,
|
|
8126
|
+
* `patchResource`, `deleteResource`, and by `notifyResourceModified`.
|
|
8127
|
+
* Conditional methods (`createResourceIfNoneExist`, `upsertResource`) emit
|
|
8128
|
+
* even when the server made no change, except on HTTP 304 "Not Modified".
|
|
8129
|
+
*
|
|
8130
|
+
* @template T - The type of the modified resource. Defaults to `Resource`; narrow it (e.g. via
|
|
8131
|
+
* `useResourceModified('Slot', ...)`) to get a typed `resource` payload without extra guards.
|
|
8132
|
+
*/
|
|
8133
|
+
export declare interface ResourceModifiedEvent<T extends Resource = Resource> {
|
|
8134
|
+
/** The type of the modified resource. */
|
|
8135
|
+
resourceType: T['resourceType'];
|
|
8136
|
+
/** How the resource was modified. */
|
|
8137
|
+
operation: 'create' | 'update' | 'patch' | 'delete';
|
|
8138
|
+
/** The resource id, when known. */
|
|
8139
|
+
id?: string;
|
|
8140
|
+
/** The server-returned resource, when available. Undefined for deletes. */
|
|
8141
|
+
resource?: WithId<T>;
|
|
8142
|
+
}
|
|
8143
|
+
|
|
7787
8144
|
export declare type ResourceWithCode = Resource & Code;
|
|
7788
8145
|
|
|
7789
8146
|
export declare const ReturnAckCategory: {
|
|
@@ -7808,6 +8165,12 @@ export declare class ParserBuilder {
|
|
|
7808
8165
|
*/
|
|
7809
8166
|
export declare function satisfiedAccessPolicy(resource: Resource, interaction: AccessPolicyInteraction, accessPolicy: AccessPolicy | undefined): AccessPolicyResource | undefined;
|
|
7810
8167
|
|
|
8168
|
+
export declare const SchedulingEncounterCodingURI = "https://medplum.com/fhir/StructureDefinition/SchedulingEncounterCoding";
|
|
8169
|
+
|
|
8170
|
+
export declare const SchedulingParametersURI = "https://medplum.com/fhir/StructureDefinition/SchedulingParameters";
|
|
8171
|
+
|
|
8172
|
+
export declare const SchedulingPlanDefinitionURI = "https://medplum.com/fhir/StructureDefinition/SchedulingPlanDefinition";
|
|
8173
|
+
|
|
7811
8174
|
export declare interface SearchableToken {
|
|
7812
8175
|
readonly system: string | undefined;
|
|
7813
8176
|
readonly value: string | undefined;
|
|
@@ -7890,6 +8253,42 @@ export declare class ParserBuilder {
|
|
|
7890
8253
|
|
|
7891
8254
|
export declare function serverTimeout(msg?: string): OperationOutcome;
|
|
7892
8255
|
|
|
8256
|
+
/**
|
|
8257
|
+
* Returns whether any serviceType concept refers to the given HealthcareService.
|
|
8258
|
+
* @param serviceType - CodeableConcept values to inspect
|
|
8259
|
+
* @param service - HealthcareService or reference to match
|
|
8260
|
+
* @returns True if any concept references the service
|
|
8261
|
+
*/
|
|
8262
|
+
export declare function serviceTypeIncludesService(serviceType: CodeableConcept[] | undefined, service: WithId<HealthcareService> | (Reference<HealthcareService> & {
|
|
8263
|
+
reference: string;
|
|
8264
|
+
})): boolean;
|
|
8265
|
+
|
|
8266
|
+
/**
|
|
8267
|
+
* Extension URI holding a `Reference<HealthcareService>` on a `serviceType` CodeableConcept.
|
|
8268
|
+
*
|
|
8269
|
+
* In R5/R6, `serviceType` attributes change from `CodeableConcept[]` to
|
|
8270
|
+
* `CodeableReference<HealthcareService>`. We approximate that in R4 with this extension.
|
|
8271
|
+
*
|
|
8272
|
+
* Example: a Schedule whose serviceType refers to a HealthcareService:
|
|
8273
|
+
* ```json
|
|
8274
|
+
* {
|
|
8275
|
+
* "resourceType": "Schedule",
|
|
8276
|
+
* "actor": [{ "reference": "Practitioner/abc" }],
|
|
8277
|
+
* "serviceType": [
|
|
8278
|
+
* {
|
|
8279
|
+
* "extension": [
|
|
8280
|
+
* {
|
|
8281
|
+
* "url": "https://medplum.com/fhir/service-type-reference",
|
|
8282
|
+
* "valueReference": { "reference": "HealthcareService/123" }
|
|
8283
|
+
* }
|
|
8284
|
+
* ]
|
|
8285
|
+
* }
|
|
8286
|
+
* ]
|
|
8287
|
+
* }
|
|
8288
|
+
* ```
|
|
8289
|
+
*/
|
|
8290
|
+
export declare const ServiceTypeReferenceURI = "https://medplum.com/fhir/service-type-reference";
|
|
8291
|
+
|
|
7893
8292
|
/**
|
|
7894
8293
|
* Sets a code for a given system within a given codeable concept.
|
|
7895
8294
|
* @param concept - The codeable concept.
|
|
@@ -8279,6 +8678,8 @@ export declare class ParserBuilder {
|
|
|
8279
8678
|
value: any;
|
|
8280
8679
|
}
|
|
8281
8680
|
|
|
8681
|
+
export declare const TimezoneExtensionURI = "http://hl7.org/fhir/StructureDefinition/timezone";
|
|
8682
|
+
|
|
8282
8683
|
/**
|
|
8283
8684
|
* Converts unknown object into a JavaScript boolean.
|
|
8284
8685
|
* Note that this is different than the FHIRPath "toBoolean",
|
|
@@ -8315,6 +8716,19 @@ export declare class ParserBuilder {
|
|
|
8315
8716
|
private consumeQuotedSymbol;
|
|
8316
8717
|
private consumeDateTime;
|
|
8317
8718
|
private consumeNumber;
|
|
8719
|
+
/**
|
|
8720
|
+
* Consumes an unquoted string value that begins with digits, such as a UUID in a `_filter`
|
|
8721
|
+
* expression, starting over from the beginning of the value.
|
|
8722
|
+
*
|
|
8723
|
+
* The value ends at the first character that cannot be part of a token, per `symbolRegex`. For the
|
|
8724
|
+
* `_filter` tokenizer that is whitespace, ")", and "]", so a value at the end of a nested
|
|
8725
|
+
* expression such as "(_id eq 12345678-1234-4123-8123-123456789abc)" does not swallow the closing
|
|
8726
|
+
* parenthesis.
|
|
8727
|
+
*
|
|
8728
|
+
* @param start - The index of the first character of the value.
|
|
8729
|
+
* @returns The string token.
|
|
8730
|
+
*/
|
|
8731
|
+
private consumeUnquotedString;
|
|
8318
8732
|
private consumeSymbol;
|
|
8319
8733
|
private consumeOperator;
|
|
8320
8734
|
private consumeWhile;
|
|
@@ -8355,6 +8769,15 @@ export declare class ParserBuilder {
|
|
|
8355
8769
|
*/
|
|
8356
8770
|
export declare function toPeriod(input: unknown): Period | undefined;
|
|
8357
8771
|
|
|
8772
|
+
/**
|
|
8773
|
+
* Converts a HealthcareService into the CodeableConcept values used by
|
|
8774
|
+
* `Schedule.serviceType` and `Appointment.serviceType`, which encode an R4
|
|
8775
|
+
* approximation of `CodeableReference<HealthcareService>`.
|
|
8776
|
+
* @param service - HealthcareService to represent
|
|
8777
|
+
* @returns CodeableConcept values containing a reference to the service
|
|
8778
|
+
*/
|
|
8779
|
+
export declare function toServiceTypeCodeableConcepts(service: WithId<HealthcareService>): CodeableConcept[];
|
|
8780
|
+
|
|
8358
8781
|
/**
|
|
8359
8782
|
* Returns a "best guess" TypedValue for a given value.
|
|
8360
8783
|
* @param value - The unknown value to check.
|