Skip to main content

core.reorderbundle

Home > @medplum/core > reorderBundle

reorderBundle() function

Topologically sorts a batch or transaction bundle to improve reference resolution. The bundle is sorted such that a resource is created _before_ references to that resource appear in the bundle.

In the event of cycles, this function will first create a POST request for each resource in the cycle, and then will append a PUT request to the bundle. This ensures that each resources in the cycle is visited twice, and all references can be resolved

Signature:

export declare function reorderBundle(bundle: Bundle): Bundle;

Parameters

ParameterTypeDescription
bundleBundleInput bundle with type batch or transaction

Returns:

Bundle

Bundle of the same type, with Bundle.entry reordered