## 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 resource in the cycle is visited twice, and all references can be resolved.

**Signature:**

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

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| bundle | Bundle | Input bundle with type `batch` or `transaction` |

**Returns:**

Bundle

Bundle of the same type, with Bundle.entry reordered.
