@medplum/core 5.0.4 → 5.0.6
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 +225 -9
- package/dist/esm/index.d.ts +225 -9
- package/dist/esm/index.mjs +8 -8
- package/dist/esm/index.mjs.map +4 -4
- package/package.json +3 -3
package/dist/esm/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ import type { OperationOutcomeIssue } from '@medplum/fhirtypes';
|
|
|
37
37
|
import type { Patient } from '@medplum/fhirtypes';
|
|
38
38
|
import type { Period } from '@medplum/fhirtypes';
|
|
39
39
|
import type { Practitioner } from '@medplum/fhirtypes';
|
|
40
|
+
import type { PractitionerRole } from '@medplum/fhirtypes';
|
|
40
41
|
import type { Project } from '@medplum/fhirtypes';
|
|
41
42
|
import type { ProjectMembership } from '@medplum/fhirtypes';
|
|
42
43
|
import type { ProjectMembershipAccess } from '@medplum/fhirtypes';
|
|
@@ -45,7 +46,7 @@ import type { Quantity } from '@medplum/fhirtypes';
|
|
|
45
46
|
import type { QuestionnaireResponse } from '@medplum/fhirtypes';
|
|
46
47
|
import type { QuestionnaireResponseItemAnswer } from '@medplum/fhirtypes';
|
|
47
48
|
import type { Range as Range_2 } from '@medplum/fhirtypes';
|
|
48
|
-
import type { Readable } from 'stream';
|
|
49
|
+
import type { Readable } from 'node:stream';
|
|
49
50
|
import type { Reference } from '@medplum/fhirtypes';
|
|
50
51
|
import type { RelatedPerson } from '@medplum/fhirtypes';
|
|
51
52
|
import type { Resource } from '@medplum/fhirtypes';
|
|
@@ -369,6 +370,16 @@ export declare interface BotEvent<T = unknown> {
|
|
|
369
370
|
readonly headers?: Record<string, string | string[] | undefined>;
|
|
370
371
|
}
|
|
371
372
|
|
|
373
|
+
/**
|
|
374
|
+
* Builds a CDS request.
|
|
375
|
+
* @param medplum - The Medplum client.
|
|
376
|
+
* @param user - The user resource.
|
|
377
|
+
* @param service - The CDS service definition.
|
|
378
|
+
* @param context - The CDS request context.
|
|
379
|
+
* @returns The fully populated CDS request.
|
|
380
|
+
*/
|
|
381
|
+
export declare function buildCdsRequest(medplum: MedplumClient, user: CdsUserResource, service: CdsService, context: Record<string, unknown>): Promise<CdsRequest>;
|
|
382
|
+
|
|
372
383
|
export declare function buildElementsContext({ parentContext, path, elements, profileUrl, debugMode, accessPolicyResource, }: {
|
|
373
384
|
/** The most recent `ElementsContextType` in which this context is being built. */
|
|
374
385
|
parentContext: ElementsContextType | undefined;
|
|
@@ -415,7 +426,7 @@ export declare function calculateAgeString(birthDateStr: string, endDateStr?: st
|
|
|
415
426
|
|
|
416
427
|
export declare type CanBePopulated = {
|
|
417
428
|
length: number;
|
|
418
|
-
} |
|
|
429
|
+
} | Record<string, any>;
|
|
419
430
|
|
|
420
431
|
/**
|
|
421
432
|
* Determines if the current user can read the specified resource type.
|
|
@@ -449,6 +460,152 @@ export declare function canWriteResourceType(accessPolicy: AccessPolicy, resourc
|
|
|
449
460
|
|
|
450
461
|
export declare function capitalize(word: string): string;
|
|
451
462
|
|
|
463
|
+
/**
|
|
464
|
+
* CDS Action.
|
|
465
|
+
* See {@link https://cds-hooks.hl7.org/#actions | CDS Actions} for full details.
|
|
466
|
+
*/
|
|
467
|
+
export declare type CdsAction = CdsCreateAction | CdsUpdateAction | CdsDeleteAction;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* CDS Card definition.
|
|
471
|
+
* See {@link https://cds-hooks.hl7.org/#card-attributes | CDS Cards} for full details.
|
|
472
|
+
*/
|
|
473
|
+
export declare interface CdsCard {
|
|
474
|
+
readonly uuid?: string;
|
|
475
|
+
readonly summary: string;
|
|
476
|
+
readonly detail?: string;
|
|
477
|
+
readonly indicator: 'info' | 'warning' | 'hard-stop';
|
|
478
|
+
readonly source?: CdsSource;
|
|
479
|
+
readonly suggestions?: CdsSuggestion[];
|
|
480
|
+
readonly links?: CdsLink[];
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* CDS Create Action.
|
|
485
|
+
* See {@link https://cds-hooks.hl7.org/#actions | CDS Actions} for full details.
|
|
486
|
+
*/
|
|
487
|
+
export declare interface CdsCreateAction {
|
|
488
|
+
readonly type: 'create';
|
|
489
|
+
readonly description: string;
|
|
490
|
+
readonly resource: Resource;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* CDS Delete Action.
|
|
495
|
+
* See {@link https://cds-hooks.hl7.org/#actions | CDS Actions} for full details.
|
|
496
|
+
*/
|
|
497
|
+
export declare interface CdsDeleteAction {
|
|
498
|
+
readonly type: 'delete';
|
|
499
|
+
readonly description: string;
|
|
500
|
+
readonly resourceId: string;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* CDS Discovery Response definition.
|
|
505
|
+
* See {@link https://cds-hooks.hl7.org/#discovery | CDS Hooks Discovery} for full details.
|
|
506
|
+
*/
|
|
507
|
+
export declare interface CdsDiscoveryResponse {
|
|
508
|
+
readonly services: CdsService[];
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* CDS FHIR Authorization definition.
|
|
513
|
+
*/
|
|
514
|
+
export declare interface CdsFhirAuthorization {
|
|
515
|
+
readonly access_token: string;
|
|
516
|
+
readonly token_type: string;
|
|
517
|
+
readonly expires_in?: number;
|
|
518
|
+
readonly scope?: string;
|
|
519
|
+
readonly subject?: string;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* CDS Link definition.
|
|
524
|
+
* See {@link https://cds-hooks.hl7.org/#link | CDS Link} for full details.
|
|
525
|
+
*/
|
|
526
|
+
export declare interface CdsLink {
|
|
527
|
+
readonly label: string;
|
|
528
|
+
readonly url: string;
|
|
529
|
+
readonly type: 'absolute' | 'smart' | 'relative';
|
|
530
|
+
readonly appContext?: string;
|
|
531
|
+
readonly autolaunchable?: boolean;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* CDS Request definition.
|
|
536
|
+
* See {@link https://cds-hooks.hl7.org/#http-request-1 | Calling a CDS Service} for full details.
|
|
537
|
+
*/
|
|
538
|
+
export declare interface CdsRequest {
|
|
539
|
+
readonly hook: string;
|
|
540
|
+
readonly hookInstance: string;
|
|
541
|
+
readonly context: Record<string, unknown>;
|
|
542
|
+
readonly prefetch?: Record<string, unknown>;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* CDS Request with FHIR authorization.
|
|
547
|
+
*/
|
|
548
|
+
export declare interface CdsRequestWithAuth extends CdsRequest {
|
|
549
|
+
readonly fhirServer: string;
|
|
550
|
+
readonly fhirAuthorization: CdsFhirAuthorization;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* CDS Response definition.
|
|
555
|
+
* See {@link https://cds-hooks.hl7.org/#cds-service-response | CDS Service Response} for full details.
|
|
556
|
+
*/
|
|
557
|
+
export declare interface CdsResponse {
|
|
558
|
+
readonly cards: CdsCard[];
|
|
559
|
+
readonly systemActions?: CdsAction[];
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* CDS Service definition.
|
|
564
|
+
* See {@link https://cds-hooks.hl7.org/#response | CDS Hooks Discovery} for full details.
|
|
565
|
+
*/
|
|
566
|
+
export declare interface CdsService {
|
|
567
|
+
readonly id: string;
|
|
568
|
+
readonly hook: string;
|
|
569
|
+
readonly title?: string;
|
|
570
|
+
readonly description?: string;
|
|
571
|
+
readonly usageRequirements?: string;
|
|
572
|
+
readonly prefetch?: Record<string, string>;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* CDS Source definition.
|
|
577
|
+
* See {@link https://cds-hooks.hl7.org/#source | CDS Source} for full details.
|
|
578
|
+
*/
|
|
579
|
+
export declare interface CdsSource {
|
|
580
|
+
readonly label: string;
|
|
581
|
+
readonly url?: string;
|
|
582
|
+
readonly icon?: string;
|
|
583
|
+
readonly topic?: Coding;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* CDS Suggestion definition.
|
|
588
|
+
* See {@link https://cds-hooks.hl7.org/#suggestion | CDS Suggestions} for full details.
|
|
589
|
+
*/
|
|
590
|
+
export declare interface CdsSuggestion {
|
|
591
|
+
readonly label: string;
|
|
592
|
+
readonly uuid?: string;
|
|
593
|
+
readonly isRecommended?: boolean;
|
|
594
|
+
readonly actions: CdsAction[];
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* CDS Update Action.
|
|
599
|
+
* See {@link https://cds-hooks.hl7.org/#actions | CDS Actions} for full details.
|
|
600
|
+
*/
|
|
601
|
+
export declare interface CdsUpdateAction {
|
|
602
|
+
readonly type: 'update';
|
|
603
|
+
readonly description: string;
|
|
604
|
+
readonly resource: Resource;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
export declare type CdsUserResource = WithId<Patient | Practitioner | PractitionerRole | RelatedPerson>;
|
|
608
|
+
|
|
452
609
|
/**
|
|
453
610
|
* Recursively checks for null values in an object.
|
|
454
611
|
*
|
|
@@ -858,6 +1015,21 @@ export declare const DEFAULT_MAX_SEARCH_COUNT = 1000;
|
|
|
858
1015
|
|
|
859
1016
|
export declare const DEFAULT_SEARCH_COUNT = 20;
|
|
860
1017
|
|
|
1018
|
+
/**
|
|
1019
|
+
* Derives an "identifier" search parameter from a reference search parameter.
|
|
1020
|
+
*
|
|
1021
|
+
* FHIR references can have an "identifier" property.
|
|
1022
|
+
*
|
|
1023
|
+
* Any FHIR reference search parameter can be used to search for resources with an identifier.
|
|
1024
|
+
*
|
|
1025
|
+
* However, the FHIR specification does not define an "identifier" search parameter for every resource type.
|
|
1026
|
+
*
|
|
1027
|
+
* This function derives an "identifier" search parameter from a reference search parameter.
|
|
1028
|
+
* @param inputParam - The original reference search parameter.
|
|
1029
|
+
* @returns The derived "identifier" search parameter.
|
|
1030
|
+
*/
|
|
1031
|
+
export declare function deriveIdentifierSearchParameter(inputParam: SearchParameter): SearchParameter;
|
|
1032
|
+
|
|
861
1033
|
export declare class DotAtom extends InfixOperatorAtom {
|
|
862
1034
|
constructor(left: Atom, right: Atom);
|
|
863
1035
|
eval(context: AtomContext, input: TypedValue[]): TypedValue[];
|
|
@@ -1852,6 +2024,8 @@ export declare function getIdentifier(resource: Resource, system: string): strin
|
|
|
1852
2024
|
*/
|
|
1853
2025
|
export declare function getImageSrc(resource: Resource): string | undefined;
|
|
1854
2026
|
|
|
2027
|
+
export declare function getInnerDerivedIdentifierExpression(expression: string): string | undefined;
|
|
2028
|
+
|
|
1855
2029
|
export declare function getNestedProperty(value: TypedValueWithPath | undefined, key: string, options: {
|
|
1856
2030
|
profileUrl?: string;
|
|
1857
2031
|
withPath: true;
|
|
@@ -1862,6 +2036,8 @@ export declare function getNestedProperty(value: TypedValue | undefined, key: st
|
|
|
1862
2036
|
withPath?: false;
|
|
1863
2037
|
}): (TypedValue | TypedValue[] | undefined)[];
|
|
1864
2038
|
|
|
2039
|
+
export declare function getParsedDerivedIdentifierExpression(originalExpression: string, atom: FhirPathAtom): FhirPathAtom;
|
|
2040
|
+
|
|
1865
2041
|
export declare function getParsedExpressionForResourceType(resourceType: string, expression: string): FhirPathAtom;
|
|
1866
2042
|
|
|
1867
2043
|
/**
|
|
@@ -2652,7 +2828,7 @@ export declare function isPeriod(input: unknown): input is Period;
|
|
|
2652
2828
|
*/
|
|
2653
2829
|
export declare function isPopulated<T extends {
|
|
2654
2830
|
length: number;
|
|
2655
|
-
} |
|
|
2831
|
+
} | Record<string, any>>(arg: CanBePopulated | undefined | null): arg is T;
|
|
2656
2832
|
|
|
2657
2833
|
/**
|
|
2658
2834
|
* Returns true if the type code is a primitive type.
|
|
@@ -4247,6 +4423,20 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
|
|
|
4247
4423
|
* @returns Promise to the result. If waiting for response, the result is the response body. Otherwise, it is an operation outcome.
|
|
4248
4424
|
*/
|
|
4249
4425
|
pushToAgent(agent: Agent | Reference<Agent>, destination: Device | Reference<Device> | string, body: any, contentType?: string, waitForResponse?: boolean, options?: PushToAgentOptions): Promise<any>;
|
|
4426
|
+
/**
|
|
4427
|
+
* Reads the list of available CDS services.
|
|
4428
|
+
* @param options - Optional fetch options.
|
|
4429
|
+
* @returns The list of CDS services.
|
|
4430
|
+
*/
|
|
4431
|
+
getCdsServices(options?: MedplumRequestOptions): Promise<CdsDiscoveryResponse>;
|
|
4432
|
+
/**
|
|
4433
|
+
* Calls a CDS service by ID.
|
|
4434
|
+
* @param id - The CDS service ID.
|
|
4435
|
+
* @param body - The CDS request body.
|
|
4436
|
+
* @param options - Optional fetch options.
|
|
4437
|
+
* @returns The CDS response.
|
|
4438
|
+
*/
|
|
4439
|
+
callCdsService(id: string, body: CdsRequest, options?: MedplumRequestOptions): Promise<CdsResponse>;
|
|
4250
4440
|
/**
|
|
4251
4441
|
* @category Authentication
|
|
4252
4442
|
* @returns The Login State
|
|
@@ -5413,6 +5603,22 @@ export declare const OAuthGrantType: {
|
|
|
5413
5603
|
|
|
5414
5604
|
export declare type OAuthGrantType = (typeof OAuthGrantType)[keyof typeof OAuthGrantType];
|
|
5415
5605
|
|
|
5606
|
+
/**
|
|
5607
|
+
* OAuth Signing Algorithms
|
|
5608
|
+
* See {@link https://datatracker.ietf.org/doc/html/rfc7519 | RFC 7519} for full details.
|
|
5609
|
+
*/
|
|
5610
|
+
export declare const OAuthSigningAlgorithm: {
|
|
5611
|
+
readonly ES256: "ES256";
|
|
5612
|
+
readonly ES384: "ES384";
|
|
5613
|
+
readonly ES512: "ES512";
|
|
5614
|
+
readonly HS256: "HS256";
|
|
5615
|
+
readonly RS256: "RS256";
|
|
5616
|
+
readonly RS384: "RS384";
|
|
5617
|
+
readonly RS512: "RS512";
|
|
5618
|
+
};
|
|
5619
|
+
|
|
5620
|
+
export declare type OAuthSigningAlgorithm = (typeof OAuthSigningAlgorithm)[keyof typeof OAuthSigningAlgorithm];
|
|
5621
|
+
|
|
5416
5622
|
/**
|
|
5417
5623
|
* OAuth 2.0 Client Authentication Methods
|
|
5418
5624
|
* See: https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication
|
|
@@ -5655,7 +5861,7 @@ export declare class ParserBuilder {
|
|
|
5655
5861
|
* @param query - Optional collection of additional query string parameters.
|
|
5656
5862
|
* @returns A parsed SearchRequest.
|
|
5657
5863
|
*/
|
|
5658
|
-
export declare function parseSearchRequest<T extends Resource = Resource>(url:
|
|
5864
|
+
export declare function parseSearchRequest<T extends Resource = Resource>(url: URL | string, query?: Record<string, string[] | string | undefined>): SearchRequest<T>;
|
|
5659
5865
|
|
|
5660
5866
|
/**
|
|
5661
5867
|
* Parses a StructureDefinition resource into an internal schema better suited for
|
|
@@ -5774,7 +5980,7 @@ export declare class ParserBuilder {
|
|
|
5774
5980
|
|
|
5775
5981
|
/**
|
|
5776
5982
|
* List of property types.
|
|
5777
|
-
* http://www.hl7.org/fhir/valueset-defined-types.html
|
|
5983
|
+
* http://www.hl7.org/fhir/R4/valueset-defined-types.html
|
|
5778
5984
|
* The list here includes additions found from StructureDefinition resources.
|
|
5779
5985
|
*/
|
|
5780
5986
|
export declare const PropertyType: {
|
|
@@ -5793,6 +5999,8 @@ export declare class ParserBuilder {
|
|
|
5793
5999
|
readonly Distance: "Distance";
|
|
5794
6000
|
readonly Dosage: "Dosage";
|
|
5795
6001
|
readonly Duration: "Duration";
|
|
6002
|
+
readonly Element: "Element";
|
|
6003
|
+
readonly ElementDefinition: "ElementDefinition";
|
|
5796
6004
|
readonly Expression: "Expression";
|
|
5797
6005
|
readonly Extension: "Extension";
|
|
5798
6006
|
readonly HumanName: "HumanName";
|
|
@@ -5800,6 +6008,7 @@ export declare class ParserBuilder {
|
|
|
5800
6008
|
readonly MarketingStatus: "MarketingStatus";
|
|
5801
6009
|
readonly Meta: "Meta";
|
|
5802
6010
|
readonly Money: "Money";
|
|
6011
|
+
readonly MoneyQuantity: "MoneyQuantity";
|
|
5803
6012
|
readonly Narrative: "Narrative";
|
|
5804
6013
|
readonly ParameterDefinition: "ParameterDefinition";
|
|
5805
6014
|
readonly Period: "Period";
|
|
@@ -5813,6 +6022,7 @@ export declare class ParserBuilder {
|
|
|
5813
6022
|
readonly RelatedArtifact: "RelatedArtifact";
|
|
5814
6023
|
readonly SampledData: "SampledData";
|
|
5815
6024
|
readonly Signature: "Signature";
|
|
6025
|
+
readonly SimpleQuantity: "SimpleQuantity";
|
|
5816
6026
|
readonly SubstanceAmount: "SubstanceAmount";
|
|
5817
6027
|
readonly SystemString: "http://hl7.org/fhirpath/System.String";
|
|
5818
6028
|
readonly Timing: "Timing";
|
|
@@ -5837,6 +6047,7 @@ export declare class ParserBuilder {
|
|
|
5837
6047
|
readonly uri: "uri";
|
|
5838
6048
|
readonly url: "url";
|
|
5839
6049
|
readonly uuid: "uuid";
|
|
6050
|
+
readonly xhtml: "xhtml";
|
|
5840
6051
|
};
|
|
5841
6052
|
|
|
5842
6053
|
/**
|
|
@@ -5869,9 +6080,14 @@ export declare class ParserBuilder {
|
|
|
5869
6080
|
export declare type QueryTypes = URLSearchParams | string[][] | Record<string, string | number | boolean | undefined> | string | undefined;
|
|
5870
6081
|
|
|
5871
6082
|
export declare type RateLimitInfo = {
|
|
6083
|
+
/** Name of the rate limiter. */
|
|
5872
6084
|
name: string;
|
|
6085
|
+
/** Remaining rate limit quota units. */
|
|
5873
6086
|
remainingUnits: number;
|
|
6087
|
+
/** Number of seconds until the rate limit resets to its full quota. */
|
|
5874
6088
|
secondsUntilReset: number;
|
|
6089
|
+
/** Timestamp (seconds from 1970-01-01T00:00:00Z) after which the rate limiter resets to its full quota. */
|
|
6090
|
+
resetsAfter: number;
|
|
5875
6091
|
};
|
|
5876
6092
|
|
|
5877
6093
|
/**
|
|
@@ -6621,16 +6837,16 @@ export declare class ParserBuilder {
|
|
|
6621
6837
|
|
|
6622
6838
|
export declare class TypedEventTarget<TEvents extends Record<string, Event_2>> {
|
|
6623
6839
|
private readonly emitter;
|
|
6624
|
-
dispatchEvent<TEventType extends keyof TEvents
|
|
6625
|
-
addEventListener<TEventType extends keyof TEvents
|
|
6626
|
-
removeEventListener<TEventType extends keyof TEvents
|
|
6840
|
+
dispatchEvent<TEventType extends keyof TEvents>(event: TEvents[TEventType]): void;
|
|
6841
|
+
addEventListener<TEventType extends keyof TEvents>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
|
|
6842
|
+
removeEventListener<TEventType extends keyof TEvents>(type: TEventType, handler: (event: TEvents[TEventType]) => void): void;
|
|
6627
6843
|
removeAllListeners(): void;
|
|
6628
6844
|
/**
|
|
6629
6845
|
* Gets the number of listeners for the provided Event type.
|
|
6630
6846
|
* @param type - The name of the Event type.
|
|
6631
6847
|
* @returns The number of listeners for this Event type.
|
|
6632
6848
|
*/
|
|
6633
|
-
listenerCount<TEventType extends keyof TEvents
|
|
6849
|
+
listenerCount<TEventType extends keyof TEvents>(type: TEventType): number;
|
|
6634
6850
|
}
|
|
6635
6851
|
|
|
6636
6852
|
export declare interface TypedValue {
|