const { transform } = require('decorators-transform')
* Called if there is an error in the source operation. If the method
* does not throw an error, Cortex throws the original error.
* @param err {Fault} thrown fault.
* Called if the result is not a cursor (but a single result value).
* The method must return a result if it's to be transformed. If the
* method does not return a value, Cortex outputs the original result value.
* Cursor handler called only once and before all other processing.
* @param memo { Object } An empty object that can be modified and is saved
* for the duration of the transformation.
* @param cursor {Cursor} The output cursor.
beforeAll(memo, { cursor }) {
* Cursor handler called before each script run, and shares
* the current script context with each and after.
before(memo, { cursor }) {
* Cursor handler called with each cursor object. Returning undefined
* filters the object from the output stream.
* @param object { Object } the current output document
* @param cursor {Cursor}\
* @returns {*} a value to be pushed to the output cursor.
each(object, memo, { cursor }) {
* Cursor handler called after before() and each() was called.
* @param count { Number } The number of documents pushed by the script
* runtime during the current execution.
after(memo, { cursor, count }) {
* Cursor handler called only once and after the cursor is exhausted.
afterAll(memo, { cursor }) {