Releases: trayio/threadneedle
REST support in global SOAP configuration
- a method can be set to
type: 'REST'while the global configuration is SOAP - none of the global configurations are inherited/processed for these methods
Migrate to using trayio/needle
- Needle dependency changed to use @trayio/needle
v1.13.0
Error messages have been updated to include method name when the config passed in fails validation.
Logging and Method Function bugfix
- Threadneedle can now perform request flow logging normally done when
NODE_ENV=developmentis set, by now using a dedicated environment flagTHREADNEEDLE_ENABLE_LOGS=true - Function Methods had a bug where if they were non-async and threw an error, the error was not caught and formatted in the expected format by Threadneedle. This is now fixed.
v1.11.0
typeflag has been introduced, while there is now a deprecation warning for thesoapflag- the
methodproperty in REST configuration now accepts both mustaching and function- an error will be thrown if this doesn't resolve to a valid HTTP verb
urlin REST configuration can now be an empty string (which assumesbaseUrlis the endpoint)- if the complete URL resolves to an empty string, an error will be thrown
smartSubstitutionis now exposed viarequire('@trayio/threadneedle/smartSubstitution');for external usage
Patch: global before/beforeRequest modification should be passed on
A bug in the logic prevented the modified respective objects of the global before/beforeRequest from being passed on, if the method before/beforeRequest were functions which did not modify and therefore returned undefined, due the reference object being reused in this situation.
This is now fixed by updating the reference object if an object is returned, since at this point the explicitly returned object should passed on.
Patch: old reference behaviour is maintained outside of development mode
When run outside of development mode, the old reference behaviour for before and beforeRequest is maintained (but a console warning will still be logged).
An error will still be thrown in development mode for methods run which fail the check.
Deprecation of modification by reference
Main change (potentially breaking)
before and beforeRequest will now require their respective objects (params and request) to be returned if any modifications are to be passed on, instead of allowing modification by reference without having to return them.
This will throw an error in development mode, otherwise a console warning will be logged instead.
Other changes
urlin global configuration will now invoke the same deprecation behaviour (error in development mode, console warn otherwise), in favour ofbaseUrl.afterHeaderswill check if the returned value is an object, (error in development mode, console warn otherwise).
Hash parameter support in Substitution
Substitution will now first detect if the parameters specified in the template begin with hash (#), and will render these with separately with dedicated logic, instead of allowing Mustache's specific behaviour of sections for hash parameters.
Check globals flag first before invoking global logic
This update gets the logic behind individual properties for REST and SOAP methods to first check the globals flag, before invoking the associated global logic/function.
- If globals is false, then only the logic associated with the local/method is invoked.
- If globals is true, then the execution order is maintained as before, i.e. global logic is invoked first, followed by local/method logic.