Changed middleware to use `emitter`

Tests now passing for arrays, documents, and strings
Updated inferer API
Moved inferer middleware to `plugin()` functions
Added deeper plugin support to type registry

TODO: Remove casting by name/string. We should implement functionality
like inferring `StringType` from `String` in inferer middleware/plugins