Releases: trayio/falafel
Threadneedle needle xml2js fix
Function model afterHeaders support
Function models now have support for afterHeaders
function by specifying a after_headers.js
file in the same directory as the model, and exporting a function accepting arguments error
, params
, and body
.
module.exports = function (error, params, body) {
return {
//Must return an object
};
};
Promises Timeout Limit
For connectors running on AWS Lambda or on operation calls in which context.getRemainingTimeInMillis()
function is provided, falafel will add a timeout limit to all operation calls, forcibly ending the promise 5 seconds prior to the expected timeout. If this occurs, falafel will provide an appropriate error to the callback.
File handling change and Trigger unique ID
Trigger - getUniqueTriggerID
request.js
file now supports getUniqueTriggerID
property, which should be a function. The arguments passed in (order) are params
, http
, and output
(from the before
function). The function is expected to return either a string or number, which would then be set as trigger_deduplication_id
in the JSON headers property (NOT the HTTP header from the dev server during development).
File handling - AWS SDK migration
As of this version, the file handling has been migrated to use the AWS SDK instead of the Knox library. This therefore means that environment variables can now be utilised (including the use of roles for the lambda function).
Additionally, bucket
and region
can also now be passed in to override the default values of workflow-file-uploads
and us-west-2
respectively.
NOTE: Unless environment variables are setup with AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
, local development will still need the aws.json
file to be required.
Dependencies update
All dependencies have been updated to the latest versions (including threadneedle).
File stream support
The file helpers now include two additional options:
- streamUpload
- streamMPUpload (only use if content-length cannot be specified)
- streamDownload
Additionally, file helpers will now check for AWS credentials in environment.
falafel.files.streamUpload
Expects an object in the following format:
{
readStream: [stream object/reference],
name: '',
contentType: '', //Optional - mime can be infered from name
length: 12345
}
This will return the same object as the standard upload function.
falafel.files.streamDownload
Expects the same object as the standard download function.
The return object however will be in the following format:
{
readStream: [stream object/reference],
name: '',
mime_type: '',
expires: 12345
}
falafel.files.streamMPUpload
Expects an object in the following format:
{
readStream: [stream object/reference],
name: '',
contentType: '', //Optional - mime can be infered from name
}
This upload variant should be used sparingly, and only if there is now way of knowing the content-length
beforehand. This will return the same thing as streamUpload
.
Error format
All errors handled through falafel will now ensure body
is an object.
v1.10.0
This release addresses the breaking changes of Threadneedle v1.4.0 in such a way that older apps should work as expected.