Preserve order in distinctBy

WorkflowBuilder now inspects the merged source workflow and if it is ordered,
attmepts to reconstruct the $sort op after grouping. This works only if the
source pipeline has one of a couple of recognized shapes.
pending test for unhandled case
Note: previous commit fixes #284
Merge remote-tracking branch 'upstream/master' into ready/order-preserving-distinct
Merge pull request #374 from mossprescott/ready/order-preserving-distinct

Preserve order in distinctBy