core.convertcontainedresourcestobundle | Medplum

convertContainedResourcesToBundle() function

Converts a resource with contained resources to a transaction bundle. This function is useful when creating a resource that contains other resources. Handles local references and topological sorting.

Signature:

export declare function convertContainedResourcesToBundle(resource: Resource & {
    contained?: Resource[];
}): Bundle;

Parameters

Parameter Type Description
resource Resource & { contained?: Resource[]; } The input resource which may or may not include contained resources.

Returns:

Bundle

A bundle with the input resource and all contained resources.