@medplum/core 5.1.22 → 5.1.23
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 +501 -4
- package/dist/esm/index.d.ts +501 -4
- package/dist/esm/index.mjs +11 -11
- package/dist/esm/index.mjs.map +4 -4
- package/package.json +3 -3
package/dist/cjs/index.d.ts
CHANGED
|
@@ -115,6 +115,21 @@ export declare const AckCode: {
|
|
|
115
115
|
|
|
116
116
|
export declare type AckCode = keyof typeof AckCode;
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* o If the target location specifies an array index, a new value is
|
|
120
|
+
* inserted into the array at the specified index.
|
|
121
|
+
* o If the target location specifies an object member that does not
|
|
122
|
+
* already exist, a new member is added to the object.
|
|
123
|
+
* o If the target location specifies an object member that does exist,
|
|
124
|
+
* that member's value is replaced.
|
|
125
|
+
*
|
|
126
|
+
* @param object - The object being patched.
|
|
127
|
+
* @param operation - The operation to perform on the object.
|
|
128
|
+
* @param options - Optional params.
|
|
129
|
+
* @returns null on success, or error if one occurred.
|
|
130
|
+
*/
|
|
131
|
+
export declare function add(object: any, operation: AddOperation, options?: PatchOptions): MissingError | null;
|
|
132
|
+
|
|
118
133
|
/**
|
|
119
134
|
* Parameters for adding a pharmacy to a patient's favorites.
|
|
120
135
|
*/
|
|
@@ -124,6 +139,12 @@ export declare interface AddFavoriteParams {
|
|
|
124
139
|
setAsPrimary: boolean;
|
|
125
140
|
}
|
|
126
141
|
|
|
142
|
+
export declare interface AddOperation {
|
|
143
|
+
op: 'add';
|
|
144
|
+
path: string;
|
|
145
|
+
value: any;
|
|
146
|
+
}
|
|
147
|
+
|
|
127
148
|
/**
|
|
128
149
|
* Response from adding a pharmacy to a patient's favorites.
|
|
129
150
|
*/
|
|
@@ -303,6 +324,17 @@ export declare class AndAtom extends InfixOperatorAtom {
|
|
|
303
324
|
|
|
304
325
|
export declare function append<T>(array: T[] | undefined, value: T): T[];
|
|
305
326
|
|
|
327
|
+
/**
|
|
328
|
+
* Switch on `operation.op`, applying the corresponding patch function for each
|
|
329
|
+
* case to `object`.
|
|
330
|
+
*
|
|
331
|
+
* @param object - The object being patched.
|
|
332
|
+
* @param operation - The operation to perform on the object.
|
|
333
|
+
* @param options - Optional params.
|
|
334
|
+
* @returns null on success, or error if one occurred.
|
|
335
|
+
*/
|
|
336
|
+
export declare function apply(object: any, operation: Operation, options?: PatchOptions): MissingError | InvalidOperationError | TestError | null;
|
|
337
|
+
|
|
306
338
|
/**
|
|
307
339
|
* Adds default values to `existingValue` for the given `key` and its children. If `key` is undefined,
|
|
308
340
|
* default values are added to all elements in `elements`. Default values consist of all fixed and pattern
|
|
@@ -328,6 +360,26 @@ export declare function applyDefaultValuesToResource(resource: Resource, schema:
|
|
|
328
360
|
|
|
329
361
|
export declare function applyFixedOrPatternValue(inputValue: any, key: string, element: InternalSchemaElement, elements: Record<string, InternalSchemaElement>): any;
|
|
330
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Apply a 'application/json-patch+json'-type patch to an object.
|
|
365
|
+
*
|
|
366
|
+
* `patch` *must* be an array of operations.
|
|
367
|
+
*
|
|
368
|
+
* Operation objects MUST have exactly one "op" member, whose value
|
|
369
|
+
* indicates the operation to perform. Its value MUST be one of "add",
|
|
370
|
+
* "remove", "replace", "move", "copy", or "test"; other values are
|
|
371
|
+
* errors.
|
|
372
|
+
*
|
|
373
|
+
* This method mutates the target object in-place.
|
|
374
|
+
*
|
|
375
|
+
* @param object - The object to apply the patch to
|
|
376
|
+
* @param patch - Array of operations to apply
|
|
377
|
+
* @param options - Optional customization of patch application behavior
|
|
378
|
+
* @returns list of results, one for each operation: `null` indicated success,
|
|
379
|
+
* otherwise, the result will be an instance of one of the Error classes.
|
|
380
|
+
*/
|
|
381
|
+
export declare function applyPatch(object: any, patch: Operation[], options?: PatchOptions): (null | MissingError | InvalidOperationError | TestError)[];
|
|
382
|
+
|
|
331
383
|
export declare class ArithmeticOperatorAtom extends InfixOperatorAtom {
|
|
332
384
|
readonly impl: (x: number, y: number) => number | boolean;
|
|
333
385
|
constructor(operator: string, left: Atom, right: Atom, impl: (x: number, y: number) => number | boolean);
|
|
@@ -882,6 +934,7 @@ export declare const ContentType: {
|
|
|
882
934
|
readonly HL7_V2: "x-application/hl7-v2+er7";
|
|
883
935
|
readonly HTML: "text/html";
|
|
884
936
|
readonly JAVASCRIPT: "text/javascript";
|
|
937
|
+
readonly JOSE: "application/jose";
|
|
885
938
|
readonly JSON: "application/json";
|
|
886
939
|
readonly JSON_PATCH: "application/json-patch+json";
|
|
887
940
|
readonly JWT: "application/jwt";
|
|
@@ -933,6 +986,32 @@ export declare function convertToSearchableUris(typedValues: TypedValue[]): stri
|
|
|
933
986
|
*/
|
|
934
987
|
export declare function convertToTransactionBundle(bundle: Bundle): Bundle;
|
|
935
988
|
|
|
989
|
+
/**
|
|
990
|
+
* The "copy" operation copies the value at a specified location to the
|
|
991
|
+
* target location.
|
|
992
|
+
* The operation object MUST contain a "from" member, which is a string
|
|
993
|
+
* containing a JSON Pointer value that references the location in the
|
|
994
|
+
* target document to copy the value from.
|
|
995
|
+
* The "from" location MUST exist for the operation to be successful.
|
|
996
|
+
*
|
|
997
|
+
* This operation is functionally identical to an "add" operation at the
|
|
998
|
+
* target location using the value specified in the "from" member.
|
|
999
|
+
*
|
|
1000
|
+
* Alternatively, it's like 'move' without the 'remove'.
|
|
1001
|
+
*
|
|
1002
|
+
* @param object - The object being patched.
|
|
1003
|
+
* @param operation - The operation to perform on the object.
|
|
1004
|
+
* @param _options - Optional params.
|
|
1005
|
+
* @returns null on success, or error if one occurred.
|
|
1006
|
+
*/
|
|
1007
|
+
export declare function copy(object: any, operation: CopyOperation, _options?: PatchOptions): MissingError | null;
|
|
1008
|
+
|
|
1009
|
+
export declare interface CopyOperation {
|
|
1010
|
+
op: 'copy';
|
|
1011
|
+
from: string;
|
|
1012
|
+
path: string;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
936
1015
|
export declare const CPT = "http://www.ama-assn.org/go/cpt";
|
|
937
1016
|
|
|
938
1017
|
export declare interface CrawlerOptions {
|
|
@@ -1023,6 +1102,26 @@ export declare interface CreateMediaOptions extends CreateBinaryOptions {
|
|
|
1023
1102
|
|
|
1024
1103
|
export declare function createOperationOutcomeIssue(severity: IssueSeverity, code: IssueType, message: string, path: string, data?: Record<string, any>): OperationOutcomeIssue;
|
|
1025
1104
|
|
|
1105
|
+
/**
|
|
1106
|
+
* Produce a 'application/json-patch+json'-type patch to get from one object to
|
|
1107
|
+
* another.
|
|
1108
|
+
*
|
|
1109
|
+
* This does not alter `input` or `output` unless they have a property getter with
|
|
1110
|
+
* side-effects (which is not a good idea anyway).
|
|
1111
|
+
*
|
|
1112
|
+
* `diff` is called on each pair of comparable non-primitive nodes in the
|
|
1113
|
+
* `input`/`output` object trees, producing nested patches. Return `undefined`
|
|
1114
|
+
* to fall back to default behaviour.
|
|
1115
|
+
*
|
|
1116
|
+
* Returns list of operations to perform on `input` to produce `output`.
|
|
1117
|
+
*
|
|
1118
|
+
* @param input - The input value.
|
|
1119
|
+
* @param output - The target value.
|
|
1120
|
+
* @param diff - Optional diff function.
|
|
1121
|
+
* @returns The list of patch operations.
|
|
1122
|
+
*/
|
|
1123
|
+
export declare function createPatch(input: any, output: any, diff?: VoidableDiff): Operation[];
|
|
1124
|
+
|
|
1026
1125
|
export declare interface CreatePdfFunction {
|
|
1027
1126
|
(docDefinition: TDocumentDefinitions, tableLayouts?: Record<string, CustomTableLayout>, fonts?: TFontDictionary): Promise<any>;
|
|
1028
1127
|
}
|
|
@@ -1069,6 +1168,22 @@ export declare function createReference<T extends Resource>(resource: T): Refere
|
|
|
1069
1168
|
|
|
1070
1169
|
export declare function createStructureIssue(expression: string, details: string): OperationOutcomeIssue;
|
|
1071
1170
|
|
|
1171
|
+
/**
|
|
1172
|
+
* Produce an 'application/json-patch+json'-type list of tests, to verify that
|
|
1173
|
+
* existing values in an object are identical to the those captured at some
|
|
1174
|
+
* checkpoint (whenever this function is called).
|
|
1175
|
+
*
|
|
1176
|
+
* This does not alter `input` or `output` unless they have a property getter with
|
|
1177
|
+
* side-effects (which is not a good idea anyway).
|
|
1178
|
+
*
|
|
1179
|
+
* Returns list of test operations.
|
|
1180
|
+
*
|
|
1181
|
+
* @param input - The input value.
|
|
1182
|
+
* @param patch - The list of patch operations.
|
|
1183
|
+
* @returns A list of test operations corresponding to the current values.
|
|
1184
|
+
*/
|
|
1185
|
+
export declare function createTests(input: any, patch: Operation[]): TestOperation[];
|
|
1186
|
+
|
|
1072
1187
|
export declare type CriteriaState = 'idle' | 'connecting' | 'active' | 'refreshing' | 'removed';
|
|
1073
1188
|
|
|
1074
1189
|
export declare type CurrentContext<T extends FhircastAnchorResourceType | '' = FhircastAnchorResourceType | ''> = T extends '' ? {
|
|
@@ -1183,6 +1298,75 @@ export declare const DEFAULT_SEARCH_COUNT = 20;
|
|
|
1183
1298
|
*/
|
|
1184
1299
|
export declare function deriveIdentifierSearchParameter(inputParam: SearchParameter): SearchParameter;
|
|
1185
1300
|
|
|
1301
|
+
export declare type Diff = (input: any, output: any, ptr: Pointer) => Operation[];
|
|
1302
|
+
|
|
1303
|
+
/**
|
|
1304
|
+
* `diffAny()` returns an empty array if `input` and `output` are materially equal
|
|
1305
|
+
* (i.e., would produce equivalent JSON); otherwise it produces an array of patches
|
|
1306
|
+
* that would transform `input` into `output`.
|
|
1307
|
+
*
|
|
1308
|
+
* Here, "equal" means that the value at the target location and the
|
|
1309
|
+
* value conveyed by "value" are of the same JSON type, and that they
|
|
1310
|
+
* are considered equal by the following rules for that type:
|
|
1311
|
+
* o strings: are considered equal if they contain the same number of
|
|
1312
|
+
* Unicode characters and their code points are byte-by-byte equal.
|
|
1313
|
+
* o numbers: are considered equal if their values are numerically
|
|
1314
|
+
* equal.
|
|
1315
|
+
* o arrays: are considered equal if they contain the same number of
|
|
1316
|
+
* values, and if each value can be considered equal to the value at
|
|
1317
|
+
* the corresponding position in the other array, using this list of
|
|
1318
|
+
* type-specific rules.
|
|
1319
|
+
* o objects: are considered equal if they contain the same number of
|
|
1320
|
+
* members, and if each member can be considered equal to a member in
|
|
1321
|
+
* the other object, by comparing their keys (as strings) and their
|
|
1322
|
+
* values (using this list of type-specific rules).
|
|
1323
|
+
* o literals (false, true, and null): are considered equal if they are
|
|
1324
|
+
* the same.
|
|
1325
|
+
*
|
|
1326
|
+
* @param input - The original value.
|
|
1327
|
+
* @param output - The target value.
|
|
1328
|
+
* @param ptr - JSON Pointer.
|
|
1329
|
+
* @param diff - Diff function.
|
|
1330
|
+
* @returns The list of operations to get form the original to target value.
|
|
1331
|
+
*/
|
|
1332
|
+
export declare function diffAny(input: any, output: any, ptr: Pointer, diff?: Diff): Operation[];
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* Calculate the shortest sequence of operations to get from `input` to `output`,
|
|
1336
|
+
* using a dynamic programming implementation of the Levenshtein distance algorithm.
|
|
1337
|
+
*
|
|
1338
|
+
* To get from the input ABC to the output AZ we could just delete all the input
|
|
1339
|
+
* and say "insert A, insert Z" and be done with it. That's what we do if the
|
|
1340
|
+
* input is empty. But we can be smarter.
|
|
1341
|
+
*
|
|
1342
|
+
* output
|
|
1343
|
+
* A Z
|
|
1344
|
+
* - -
|
|
1345
|
+
* [0] 1 2
|
|
1346
|
+
* input A | 1 [0] 1
|
|
1347
|
+
* B | 2 [1] 1
|
|
1348
|
+
* C | 3 2 [2]
|
|
1349
|
+
*
|
|
1350
|
+
* 1) start at 0,0 (+0)
|
|
1351
|
+
* 2) keep A (+0)
|
|
1352
|
+
* 3) remove B (+1)
|
|
1353
|
+
* 4) replace C with Z (+1)
|
|
1354
|
+
*
|
|
1355
|
+
* If the `input` (source) is empty, they'll all be in the top row, resulting in an
|
|
1356
|
+
* array of 'add' operations.
|
|
1357
|
+
* If the `output` (target) is empty, everything will be in the left column,
|
|
1358
|
+
* resulting in an array of 'remove' operations.
|
|
1359
|
+
*
|
|
1360
|
+
* @param input - The original array.
|
|
1361
|
+
* @param output - The target array.
|
|
1362
|
+
* @param ptr - JSON Pointer.
|
|
1363
|
+
* @param diff - Diff function.
|
|
1364
|
+
* @returns A list of add/remove/replace operations.
|
|
1365
|
+
*/
|
|
1366
|
+
export declare function diffArrays<T>(input: T[], output: T[], ptr: Pointer, diff?: Diff): Operation[];
|
|
1367
|
+
|
|
1368
|
+
export declare function diffObjects(input: any, output: any, ptr: Pointer, diff?: Diff): Operation[];
|
|
1369
|
+
|
|
1186
1370
|
export declare class DotAtom extends InfixOperatorAtom {
|
|
1187
1371
|
constructor(left: Atom, right: Atom);
|
|
1188
1372
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
@@ -1270,6 +1454,8 @@ export declare function encodeBase64(data: string): string;
|
|
|
1270
1454
|
*/
|
|
1271
1455
|
export declare function encodeBase64Url(data: string): string;
|
|
1272
1456
|
|
|
1457
|
+
export declare function encodeSmartHealthLink(payload: SmartHealthLinkPayload): string;
|
|
1458
|
+
|
|
1273
1459
|
/**
|
|
1274
1460
|
* Encrypts a string with SHA256 encryption.
|
|
1275
1461
|
* @param str - The unencrypted input string.
|
|
@@ -1314,13 +1500,29 @@ export { ErrorEvent_2 as ErrorEvent }
|
|
|
1314
1500
|
*/
|
|
1315
1501
|
export declare function escapeHtml(unsafe: string): string;
|
|
1316
1502
|
|
|
1503
|
+
/**
|
|
1504
|
+
* Escape token part of a JSON Pointer string
|
|
1505
|
+
*
|
|
1506
|
+
* '~' needs to be encoded as '~0' and '/'
|
|
1507
|
+
* needs to be encoded as '~1' when these characters appear in a
|
|
1508
|
+
* reference token.
|
|
1509
|
+
*
|
|
1510
|
+
* This is the exact inverse of `unescapeToken()`, so the reverse replacements must take place in reverse order.
|
|
1511
|
+
*
|
|
1512
|
+
* @param token - The token to escape.
|
|
1513
|
+
* @returns The escaped token.
|
|
1514
|
+
*/
|
|
1515
|
+
export declare function escapeToken(token: string): string;
|
|
1516
|
+
|
|
1317
1517
|
/**
|
|
1318
1518
|
* Evaluates a FHIRPath expression against a resource or other object.
|
|
1319
1519
|
* @param expression - The FHIRPath expression to evaluate.
|
|
1320
1520
|
* @param input - The resource or object to evaluate the expression against.
|
|
1521
|
+
* @param variables - A map of variables for eval input.
|
|
1522
|
+
* @param cache - Cache for parsed ASTs.
|
|
1321
1523
|
* @returns The result of the FHIRPath expression against the resource or object.
|
|
1322
1524
|
*/
|
|
1323
|
-
export declare function evalFhirPath(expression: string | FhirPathAtom, input: unknown): unknown[];
|
|
1525
|
+
export declare function evalFhirPath(expression: string | FhirPathAtom, input: unknown, variables?: Record<string, TypedValue>, cache?: LRUCache<FhirPathAtom> | undefined): unknown[];
|
|
1324
1526
|
|
|
1325
1527
|
/**
|
|
1326
1528
|
* Evaluates a FHIRPath expression against a resource or other object.
|
|
@@ -2107,6 +2309,15 @@ export declare class FunctionAtom implements Atom {
|
|
|
2107
2309
|
*/
|
|
2108
2310
|
export declare function generateId(): string;
|
|
2109
2311
|
|
|
2312
|
+
export declare interface GenerateSmartHealthLinkParams {
|
|
2313
|
+
mode?: SmartHealthLinkMode;
|
|
2314
|
+
_type?: string;
|
|
2315
|
+
exp?: number;
|
|
2316
|
+
label?: string;
|
|
2317
|
+
passcode?: string;
|
|
2318
|
+
includeQrCode?: boolean;
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2110
2321
|
export declare function getAllDataTypes(): DataTypesMap;
|
|
2111
2322
|
|
|
2112
2323
|
/**
|
|
@@ -2360,6 +2571,8 @@ export declare function getSearchParameterDetails(resourceType: string, searchPa
|
|
|
2360
2571
|
*/
|
|
2361
2572
|
export declare function getSearchParameters(resourceType: string): Record<string, SearchParameter> | undefined;
|
|
2362
2573
|
|
|
2574
|
+
export declare function getSmartHealthLinkId(manifestUrl: string): string | undefined;
|
|
2575
|
+
|
|
2363
2576
|
export declare function getStatus(outcome: OperationOutcome): number;
|
|
2364
2577
|
|
|
2365
2578
|
/**
|
|
@@ -2973,6 +3186,18 @@ export declare interface InternalTypeSchema {
|
|
|
2973
3186
|
mandatoryProperties?: Set<string>;
|
|
2974
3187
|
}
|
|
2975
3188
|
|
|
3189
|
+
/**
|
|
3190
|
+
* List the keys that shared by all `objects`.
|
|
3191
|
+
*
|
|
3192
|
+
* The semantics of what constitutes a "key" is described in {@link subtract}.
|
|
3193
|
+
*
|
|
3194
|
+
* @param objects - Array of objects to compare
|
|
3195
|
+
* @returns Array of keys that are in ("own-properties" of) every object in `objects`.
|
|
3196
|
+
*/
|
|
3197
|
+
export declare function intersection(objects: ArrayLike<{
|
|
3198
|
+
[index: string]: any;
|
|
3199
|
+
}>): string[];
|
|
3200
|
+
|
|
2976
3201
|
/**
|
|
2977
3202
|
* Stable error when a bot response does not match {@link MedicationOrderResponse}.
|
|
2978
3203
|
*/
|
|
@@ -2988,6 +3213,11 @@ export declare const INVALID_MEDICATION_ORDER_SET_RESPONSE = "Invalid response f
|
|
|
2988
3213
|
*/
|
|
2989
3214
|
export declare const INVALID_MEDICATION_SEARCH_RESPONSE = "Invalid response from medication search bot";
|
|
2990
3215
|
|
|
3216
|
+
export declare class InvalidOperationError extends Error {
|
|
3217
|
+
operation: Operation;
|
|
3218
|
+
constructor(operation: Operation);
|
|
3219
|
+
}
|
|
3220
|
+
|
|
2991
3221
|
export declare function invalidSearchOperator(operator: Operator, searchParameterCodeOrId: string): OperationOutcome;
|
|
2992
3222
|
|
|
2993
3223
|
export declare interface InviteRequest {
|
|
@@ -2996,6 +3226,12 @@ export declare interface InviteRequest {
|
|
|
2996
3226
|
lastName: string;
|
|
2997
3227
|
email?: string;
|
|
2998
3228
|
externalId?: string;
|
|
3229
|
+
/**
|
|
3230
|
+
* The patient that a newly provisioned `RelatedPerson` is related to.
|
|
3231
|
+
* Required when inviting a `RelatedPerson` without an existing
|
|
3232
|
+
* `membership.profile`, since `RelatedPerson.patient` is a required FHIR field.
|
|
3233
|
+
*/
|
|
3234
|
+
patient?: Reference<Patient>;
|
|
2999
3235
|
scope?: 'project' | 'server';
|
|
3000
3236
|
password?: string;
|
|
3001
3237
|
sendEmail?: boolean;
|
|
@@ -3106,6 +3342,8 @@ export declare function isDateTimeString(input: unknown): input is string;
|
|
|
3106
3342
|
*/
|
|
3107
3343
|
export declare function isDefined<T>(value: T | undefined | null): value is T;
|
|
3108
3344
|
|
|
3345
|
+
export declare function isDestructive({ op }: Operation): boolean;
|
|
3346
|
+
|
|
3109
3347
|
/**
|
|
3110
3348
|
* Returns true if the value is empty (null, undefined, empty string, or empty object).
|
|
3111
3349
|
* @param v - Any value.
|
|
@@ -3535,6 +3773,12 @@ export declare interface LoginAuthenticationResponse {
|
|
|
3535
3773
|
readonly mfaEnrollRequired?: boolean;
|
|
3536
3774
|
readonly mfaRequired?: boolean;
|
|
3537
3775
|
readonly enrollQrCode?: string;
|
|
3776
|
+
/** MFA enrollment methods the project allows (e.g. 'totp', 'email'). */
|
|
3777
|
+
readonly allowedMfaMethods?: ('totp' | 'email')[];
|
|
3778
|
+
/** MFA methods the user is enrolled in, returned when an MFA challenge is required. */
|
|
3779
|
+
readonly mfaMethods?: ('totp' | 'email')[];
|
|
3780
|
+
/** The user's email address, returned with an MFA challenge so the UI can show where a magic link was sent. */
|
|
3781
|
+
readonly email?: string;
|
|
3538
3782
|
readonly code?: string;
|
|
3539
3783
|
readonly memberships?: ProjectMembership[];
|
|
3540
3784
|
}
|
|
@@ -5332,11 +5576,17 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
5332
5576
|
*/
|
|
5333
5577
|
private setRequestBody;
|
|
5334
5578
|
/**
|
|
5335
|
-
* Handles an unauthenticated response from the server.
|
|
5336
|
-
*
|
|
5337
|
-
*
|
|
5579
|
+
* Handles an unauthenticated (HTTP 401) response from the server.
|
|
5580
|
+
*
|
|
5581
|
+
* Bounded and terminal: at most {@link MAX_AUTH_ATTEMPTS} attempts per request (1 initial
|
|
5582
|
+
* + 1 recovery, tracked via {@link RequestState.authAttempt}). The recovery re-mints via a
|
|
5583
|
+
* forced {@link MedplumClient.refresh} (bypassing the {@link MedplumClient.isAuthenticated}
|
|
5584
|
+
* short-circuit on the rejected token), single-flight so concurrent 401s share one re-mint.
|
|
5585
|
+
* A second 401 is terminal: clear auth, `onUnauthenticated`, reject — never recurse.
|
|
5586
|
+
*
|
|
5338
5587
|
* @param url - The URL of the original request.
|
|
5339
5588
|
* @param options - Optional fetch request init options.
|
|
5589
|
+
* @param state - The request state carrying the per-request attempt count.
|
|
5340
5590
|
* @returns The result of the retry.
|
|
5341
5591
|
*/
|
|
5342
5592
|
private handleUnauthenticated;
|
|
@@ -5383,6 +5633,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
5383
5633
|
* has already refreshed.
|
|
5384
5634
|
*
|
|
5385
5635
|
* @param gracePeriod - Optional grace period in milliseconds threaded through to the post-lock authentication check.
|
|
5636
|
+
* @param force - When true, re-mint even if the current token still looks locally valid — used by the 401 recovery path, where the server has rejected a token that has not locally expired. A newer token already in storage (e.g. from a peer tab) is still preferred over a fresh mint.
|
|
5386
5637
|
* @returns The refresh promise if available; otherwise undefined.
|
|
5387
5638
|
* @see https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokens
|
|
5388
5639
|
*/
|
|
@@ -5392,6 +5643,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
5392
5643
|
* Tabs that wait on the lock check storage on acquisition and skip the network call
|
|
5393
5644
|
* if a peer tab has already produced a fresh access token.
|
|
5394
5645
|
* @param gracePeriod - Optional grace period in milliseconds used by the post-lock authentication check to decide whether the current token still has enough life left to skip the network refresh.
|
|
5646
|
+
* @param force - When true, bypass the post-lock expiry short-circuit for the current token (still preferring a newer token a peer tab produced).
|
|
5395
5647
|
* @returns Promise that resolves when the refresh (or short-circuit) is complete.
|
|
5396
5648
|
*/
|
|
5397
5649
|
private runRefreshWithLock;
|
|
@@ -6382,6 +6634,11 @@ export declare class MemoryStorage implements Storage {
|
|
|
6382
6634
|
|
|
6383
6635
|
export declare type Message = string | ArrayBuffer | Blob | ArrayBufferView;
|
|
6384
6636
|
|
|
6637
|
+
export declare class MissingError extends Error {
|
|
6638
|
+
path: string;
|
|
6639
|
+
constructor(path: string);
|
|
6640
|
+
}
|
|
6641
|
+
|
|
6385
6642
|
/**
|
|
6386
6643
|
* The MockAsyncClientStorage class is a mock implementation of the ClientStorage class.
|
|
6387
6644
|
* This can be used for testing async initialization of the MedplumClient.
|
|
@@ -6396,6 +6653,34 @@ export declare class MockAsyncClientStorage extends ClientStorage implements ICl
|
|
|
6396
6653
|
get isInitialized(): boolean;
|
|
6397
6654
|
}
|
|
6398
6655
|
|
|
6656
|
+
/**
|
|
6657
|
+
* The "move" operation removes the value at a specified location and
|
|
6658
|
+
* adds it to the target location.
|
|
6659
|
+
* The operation object MUST contain a "from" member, which is a string
|
|
6660
|
+
* containing a JSON Pointer value that references the location in the
|
|
6661
|
+
* target document to move the value from.
|
|
6662
|
+
* This operation is functionally identical to a "remove" operation on
|
|
6663
|
+
* the "from" location, followed immediately by an "add" operation at
|
|
6664
|
+
* the target location with the value that was just removed.
|
|
6665
|
+
*
|
|
6666
|
+
* The "from" location MUST NOT be a proper prefix of the "path"
|
|
6667
|
+
* location; i.e., a location cannot be moved into one of its children.
|
|
6668
|
+
*
|
|
6669
|
+
* TODO: throw if the check described in the previous paragraph fails.
|
|
6670
|
+
*
|
|
6671
|
+
* @param object - The object being patched.
|
|
6672
|
+
* @param operation - The operation to perform on the object.
|
|
6673
|
+
* @param _options - Optional params.
|
|
6674
|
+
* @returns null on success, or error if one occurred.
|
|
6675
|
+
*/
|
|
6676
|
+
export declare function move(object: any, operation: MoveOperation, _options?: PatchOptions): MissingError | null;
|
|
6677
|
+
|
|
6678
|
+
export declare interface MoveOperation {
|
|
6679
|
+
op: 'move';
|
|
6680
|
+
from: string;
|
|
6681
|
+
path: string;
|
|
6682
|
+
}
|
|
6683
|
+
|
|
6399
6684
|
export declare const multipleMatches: OperationOutcome;
|
|
6400
6685
|
|
|
6401
6686
|
export declare const NDC = "http://hl7.org/fhir/sid/ndc";
|
|
@@ -6562,6 +6847,8 @@ export declare const OAuthTokenType: {
|
|
|
6562
6847
|
|
|
6563
6848
|
export declare type OAuthTokenType = (typeof OAuthTokenType)[keyof typeof OAuthTokenType];
|
|
6564
6849
|
|
|
6850
|
+
export declare type Operation = AddOperation | RemoveOperation | ReplaceOperation | MoveOperation | CopyOperation | TestOperation;
|
|
6851
|
+
|
|
6565
6852
|
export declare class OperationOutcomeError extends Error {
|
|
6566
6853
|
readonly outcome: OperationOutcome;
|
|
6567
6854
|
constructor(outcome: OperationOutcome, options?: ErrorOptions);
|
|
@@ -6797,6 +7084,8 @@ export declare class ParserBuilder {
|
|
|
6797
7084
|
*/
|
|
6798
7085
|
export declare function parseSearchRequest<T extends Resource = Resource>(url: URL | string, query?: Record<string, string[] | string | undefined>): SearchRequest<T>;
|
|
6799
7086
|
|
|
7087
|
+
export declare function parseSmartHealthLink(input: string): SmartHealthLinkPayload;
|
|
7088
|
+
|
|
6800
7089
|
/**
|
|
6801
7090
|
* Parses a StructureDefinition resource into an internal schema better suited for
|
|
6802
7091
|
* programmatic validation and usage in internal systems
|
|
@@ -6826,6 +7115,8 @@ export declare class ParserBuilder {
|
|
|
6826
7115
|
*/
|
|
6827
7116
|
export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>, context?: TypedValue[]): SearchRequest;
|
|
6828
7117
|
|
|
7118
|
+
export declare type Patch = Operation[];
|
|
7119
|
+
|
|
6829
7120
|
/**
|
|
6830
7121
|
* JSONPatch patch operation.
|
|
6831
7122
|
* Compatible with fast-json-patch and rfc6902 Operation.
|
|
@@ -6836,6 +7127,25 @@ export declare class ParserBuilder {
|
|
|
6836
7127
|
readonly value?: any;
|
|
6837
7128
|
}
|
|
6838
7129
|
|
|
7130
|
+
export declare interface PatchOptions {
|
|
7131
|
+
/**
|
|
7132
|
+
* When true, "add" operations with path ending in "/-" will implicitly
|
|
7133
|
+
* create an empty array where possible.
|
|
7134
|
+
*
|
|
7135
|
+
* For example, with this option enabled, for the object `{live: true}`,
|
|
7136
|
+
* the operation `add "/tag/-" 123` will result in `{live: true, tag: [123]}`.
|
|
7137
|
+
* Subsequent operations behave normally: another `add "/tag/-" 456` will result
|
|
7138
|
+
* in `{live: true, tag: [123, 456]}`.
|
|
7139
|
+
*
|
|
7140
|
+
* If the indicated array property already exists but is not an array, this will
|
|
7141
|
+
* produce an error.
|
|
7142
|
+
*
|
|
7143
|
+
* Only the leaf array will be inferred; missing parent objects will still
|
|
7144
|
+
* produce errors.
|
|
7145
|
+
*/
|
|
7146
|
+
implicitArrayCreation?: boolean;
|
|
7147
|
+
}
|
|
7148
|
+
|
|
6839
7149
|
/**
|
|
6840
7150
|
* Translates a path emitted by this crawler into an RFC6902 JSON Patch pointer
|
|
6841
7151
|
*
|
|
@@ -6871,6 +7181,52 @@ export declare class ParserBuilder {
|
|
|
6871
7181
|
ncpdpID?: string;
|
|
6872
7182
|
}
|
|
6873
7183
|
|
|
7184
|
+
/**
|
|
7185
|
+
* JSON Pointer representation
|
|
7186
|
+
*/
|
|
7187
|
+
export declare class Pointer {
|
|
7188
|
+
tokens: string[];
|
|
7189
|
+
constructor(tokens?: string[]);
|
|
7190
|
+
/**
|
|
7191
|
+
* @param path - The JSON path: *must* be a properly escaped string.
|
|
7192
|
+
* @returns The JSON pointer object.
|
|
7193
|
+
*/
|
|
7194
|
+
static fromJSON(path: string): Pointer;
|
|
7195
|
+
toString(): string;
|
|
7196
|
+
/**
|
|
7197
|
+
* Returns an object with 'parent', 'key', and 'value' properties.
|
|
7198
|
+
* In the special case that this Pointer's path == "",
|
|
7199
|
+
* this object will be `{parent: null, key: '', value: object}`.
|
|
7200
|
+
* Otherwise, parent and key will have the property such that parent[key] == value.
|
|
7201
|
+
*
|
|
7202
|
+
* @param object - The object against which to evaluate the pointer.
|
|
7203
|
+
* @returns The evaluation result.
|
|
7204
|
+
*/
|
|
7205
|
+
evaluate(object: any): PointerEvaluation;
|
|
7206
|
+
get(object: any): any;
|
|
7207
|
+
set(object: any, value: any): void;
|
|
7208
|
+
push(token: string): void;
|
|
7209
|
+
/**
|
|
7210
|
+
* @param token - The token to add to the pointer.
|
|
7211
|
+
* @returns An updated pointer.
|
|
7212
|
+
*/
|
|
7213
|
+
add(token: string): Pointer;
|
|
7214
|
+
/**
|
|
7215
|
+
* Create a new Pointer representing the parent of this one.
|
|
7216
|
+
*
|
|
7217
|
+
* The parent of the empty pointer is the empty pointer.
|
|
7218
|
+
*
|
|
7219
|
+
* @returns The parent pointer.
|
|
7220
|
+
*/
|
|
7221
|
+
parent(): Pointer;
|
|
7222
|
+
}
|
|
7223
|
+
|
|
7224
|
+
export declare interface PointerEvaluation {
|
|
7225
|
+
parent: any;
|
|
7226
|
+
key: string;
|
|
7227
|
+
value: any;
|
|
7228
|
+
}
|
|
7229
|
+
|
|
6874
7230
|
/**
|
|
6875
7231
|
* Returns true if the two numbers are equal to the given precision.
|
|
6876
7232
|
* @param a - The first number.
|
|
@@ -7252,6 +7608,17 @@ export declare class ParserBuilder {
|
|
|
7252
7608
|
}[];
|
|
7253
7609
|
};
|
|
7254
7610
|
|
|
7611
|
+
/**
|
|
7612
|
+
* The "remove" operation removes the value at the target location.
|
|
7613
|
+
* The target location MUST exist for the operation to be successful.
|
|
7614
|
+
*
|
|
7615
|
+
* @param object - The object being patched.
|
|
7616
|
+
* @param operation - The operation to perform on the object.
|
|
7617
|
+
* @param _options - Optional params.
|
|
7618
|
+
* @returns null on success, or error if one occurred.
|
|
7619
|
+
*/
|
|
7620
|
+
export declare function remove(object: any, operation: RemoveOperation, _options?: PatchOptions): MissingError | null;
|
|
7621
|
+
|
|
7255
7622
|
/**
|
|
7256
7623
|
* Removes duplicates in array using FHIRPath equality rules.
|
|
7257
7624
|
* @param arr - The input array.
|
|
@@ -7259,6 +7626,11 @@ export declare class ParserBuilder {
|
|
|
7259
7626
|
*/
|
|
7260
7627
|
export declare function removeDuplicates(arr: TypedValue[]): TypedValue[];
|
|
7261
7628
|
|
|
7629
|
+
export declare interface RemoveOperation {
|
|
7630
|
+
op: 'remove';
|
|
7631
|
+
path: string;
|
|
7632
|
+
}
|
|
7633
|
+
|
|
7262
7634
|
/**
|
|
7263
7635
|
* Removes a preferred pharmacy extension from a Patient.
|
|
7264
7636
|
*
|
|
@@ -7288,6 +7660,31 @@ export declare class ParserBuilder {
|
|
|
7288
7660
|
*/
|
|
7289
7661
|
export declare function reorderBundle(bundle: Bundle): Bundle;
|
|
7290
7662
|
|
|
7663
|
+
/**
|
|
7664
|
+
* The "replace" operation replaces the value at the target location
|
|
7665
|
+
* with a new value. The operation object MUST contain a "value" member
|
|
7666
|
+
* whose content specifies the replacement value.
|
|
7667
|
+
* The target location MUST exist for the operation to be successful.
|
|
7668
|
+
*
|
|
7669
|
+
* This operation is functionally identical to a "remove" operation for
|
|
7670
|
+
* a value, followed immediately by an "add" operation at the same
|
|
7671
|
+
* location with the replacement value.
|
|
7672
|
+
*
|
|
7673
|
+
* Even more simply, it's like the add operation with an existence check.
|
|
7674
|
+
*
|
|
7675
|
+
* @param object - The object being patched.
|
|
7676
|
+
* @param operation - The operation to perform on the object.
|
|
7677
|
+
* @param _options - Optional params.
|
|
7678
|
+
* @returns null on success, or error if one occurred.
|
|
7679
|
+
*/
|
|
7680
|
+
export declare function replace(object: any, operation: ReplaceOperation, _options?: PatchOptions): MissingError | null;
|
|
7681
|
+
|
|
7682
|
+
export declare interface ReplaceOperation {
|
|
7683
|
+
op: 'replace';
|
|
7684
|
+
path: string;
|
|
7685
|
+
value: any;
|
|
7686
|
+
}
|
|
7687
|
+
|
|
7291
7688
|
/**
|
|
7292
7689
|
* Replaces prefetch query variables with values from the context or user profile.
|
|
7293
7690
|
*
|
|
@@ -7329,6 +7726,12 @@ export declare class ParserBuilder {
|
|
|
7329
7726
|
*/
|
|
7330
7727
|
export declare function resolveId(input: Reference | Resource | undefined): string | undefined;
|
|
7331
7728
|
|
|
7729
|
+
export declare interface ResolveSmartHealthLinkParams {
|
|
7730
|
+
shlink?: string;
|
|
7731
|
+
recipient?: string;
|
|
7732
|
+
passcode?: string;
|
|
7733
|
+
}
|
|
7734
|
+
|
|
7332
7735
|
/**
|
|
7333
7736
|
* ResourceArray is an array of resources with a bundle property.
|
|
7334
7737
|
* The bundle property is a FHIR Bundle containing the search results.
|
|
@@ -7532,6 +7935,23 @@ export declare class ParserBuilder {
|
|
|
7532
7935
|
slices: SliceDefinition[];
|
|
7533
7936
|
}
|
|
7534
7937
|
|
|
7938
|
+
export declare interface SmartHealthLinkManifestFile {
|
|
7939
|
+
contentType: string;
|
|
7940
|
+
embedded: string;
|
|
7941
|
+
lastUpdated?: string;
|
|
7942
|
+
}
|
|
7943
|
+
|
|
7944
|
+
export declare type SmartHealthLinkMode = 'manifest' | 'direct';
|
|
7945
|
+
|
|
7946
|
+
export declare interface SmartHealthLinkPayload {
|
|
7947
|
+
url: string;
|
|
7948
|
+
key: string;
|
|
7949
|
+
exp?: number;
|
|
7950
|
+
flag?: string;
|
|
7951
|
+
label?: string;
|
|
7952
|
+
v?: 1;
|
|
7953
|
+
}
|
|
7954
|
+
|
|
7535
7955
|
export declare const SNOMED = "http://snomed.info/sct";
|
|
7536
7956
|
|
|
7537
7957
|
export declare interface SortRule {
|
|
@@ -7761,6 +8181,23 @@ export declare class ParserBuilder {
|
|
|
7761
8181
|
*/
|
|
7762
8182
|
export declare function subsetResource<T extends Resource>(resource: T | undefined, properties: string[]): T | undefined;
|
|
7763
8183
|
|
|
8184
|
+
/**
|
|
8185
|
+
* List the keys in `minuend` that are not in `subtrahend`.
|
|
8186
|
+
*
|
|
8187
|
+
* A key is only considered if it is both 1) an own-property (o.hasOwnProperty(k))
|
|
8188
|
+
* of the object, and 2) has a value that is not undefined. This is to match JSON
|
|
8189
|
+
* semantics, where JSON object serialization drops keys with undefined values.
|
|
8190
|
+
*
|
|
8191
|
+
* @param minuend - Object of interest
|
|
8192
|
+
* @param subtrahend - Object of comparison
|
|
8193
|
+
* @returns Array of keys that are in `minuend` but not in `subtrahend`.
|
|
8194
|
+
*/
|
|
8195
|
+
export declare function subtract(minuend: {
|
|
8196
|
+
[index: string]: any;
|
|
8197
|
+
}, subtrahend: {
|
|
8198
|
+
[index: string]: any;
|
|
8199
|
+
}): string[];
|
|
8200
|
+
|
|
7764
8201
|
/**
|
|
7765
8202
|
* Summarizes a group of Observations into a single computed summary value, with the individual values
|
|
7766
8203
|
* preserved in `Observation.component.valueSampledData`.
|
|
@@ -7781,6 +8218,34 @@ export declare class ParserBuilder {
|
|
|
7781
8218
|
toString(): string;
|
|
7782
8219
|
}
|
|
7783
8220
|
|
|
8221
|
+
/**
|
|
8222
|
+
* The "test" operation tests that a value at the target location is
|
|
8223
|
+
* equal to a specified value.
|
|
8224
|
+
* The operation object MUST contain a "value" member that conveys the
|
|
8225
|
+
* value to be compared to the target location's value.
|
|
8226
|
+
* The target location MUST be equal to the "value" value for the
|
|
8227
|
+
* operation to be considered successful.
|
|
8228
|
+
*
|
|
8229
|
+
* @param object - The object being patched.
|
|
8230
|
+
* @param operation - The add operation to perform on the object.
|
|
8231
|
+
* @param _options - Optional params.
|
|
8232
|
+
* @returns null on success, or error if one occurred.
|
|
8233
|
+
*/
|
|
8234
|
+
declare function test_2(object: any, operation: TestOperation, _options?: PatchOptions): TestError | null;
|
|
8235
|
+
export { test_2 as test }
|
|
8236
|
+
|
|
8237
|
+
export declare class TestError extends Error {
|
|
8238
|
+
actual: any;
|
|
8239
|
+
expected: any;
|
|
8240
|
+
constructor(actual: any, expected: any);
|
|
8241
|
+
}
|
|
8242
|
+
|
|
8243
|
+
export declare interface TestOperation {
|
|
8244
|
+
op: 'test';
|
|
8245
|
+
path: string;
|
|
8246
|
+
value: any;
|
|
8247
|
+
}
|
|
8248
|
+
|
|
7784
8249
|
/**
|
|
7785
8250
|
* Converts unknown object into a JavaScript boolean.
|
|
7786
8251
|
* Note that this is different than the FHIRPath "toBoolean",
|
|
@@ -7957,6 +8422,31 @@ export declare class ParserBuilder {
|
|
|
7957
8422
|
|
|
7958
8423
|
export declare const unauthorizedTokenExpired: OperationOutcome;
|
|
7959
8424
|
|
|
8425
|
+
/**
|
|
8426
|
+
* Unescape token part of a JSON Pointer string
|
|
8427
|
+
*
|
|
8428
|
+
* `token` should *not* contain any '/' characters.
|
|
8429
|
+
*
|
|
8430
|
+
* Evaluation of each reference token begins by decoding any escaped
|
|
8431
|
+
* character sequence. This is performed by first transforming any
|
|
8432
|
+
* occurrence of the sequence '~1' to '/', and then transforming any
|
|
8433
|
+
* occurrence of the sequence '~0' to '~'. By performing the
|
|
8434
|
+
* substitutions in this order, an implementation avoids the error of
|
|
8435
|
+
* turning '~01' first into '~1' and then into '/', which would be
|
|
8436
|
+
* incorrect (the string '~01' correctly becomes '~1' after
|
|
8437
|
+
* transformation).
|
|
8438
|
+
*
|
|
8439
|
+
* Here's my take:
|
|
8440
|
+
*
|
|
8441
|
+
* ~1 is unescaped with higher priority than ~0 because it is a lower-order escape character.
|
|
8442
|
+
* I say "lower order" because '/' needs escaping due to the JSON Pointer serialization technique.
|
|
8443
|
+
* Whereas, '~' is escaped because escaping '/' uses the '~' character.
|
|
8444
|
+
*
|
|
8445
|
+
* @param token - The token to unescape.
|
|
8446
|
+
* @returns The unescaped token.
|
|
8447
|
+
*/
|
|
8448
|
+
export declare function unescapeToken(token: string): string;
|
|
8449
|
+
|
|
7960
8450
|
export declare class UnionAtom extends InfixOperatorAtom {
|
|
7961
8451
|
constructor(left: Atom, right: Atom);
|
|
7962
8452
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
@@ -8044,6 +8534,13 @@ export declare class ParserBuilder {
|
|
|
8044
8534
|
displayLanguage?: string;
|
|
8045
8535
|
}
|
|
8046
8536
|
|
|
8537
|
+
/**
|
|
8538
|
+
* VoidableDiff exists to allow the user to provide a partial diff(...) function,
|
|
8539
|
+
* falling back to the built-in diffAny(...) function if the user-provided function
|
|
8540
|
+
* returns void.
|
|
8541
|
+
*/
|
|
8542
|
+
export declare type VoidableDiff = (input: any, output: any, ptr: Pointer) => Operation[] | undefined;
|
|
8543
|
+
|
|
8047
8544
|
/**
|
|
8048
8545
|
* Checks if a newer version of Medplum is available and logs a warning if so.
|
|
8049
8546
|
* @param appName - The name of the app to check the version for.
|