Skip to content

v0.3.0

Latest
Compare
Choose a tag to compare
@IonicaBizau IonicaBizau released this 24 Jul 12:21
· 31 commits to master since this release
  • added the noCursor crud read request option to automatically convert all the cursors into array. Default false

  • fixed the linked field filtering

  • sort linked fields using JavaScript sort methods after we have the full result array

  • added noJoins: true template option to disable linked template joining

  • get template requests filter out all roles except the user role

  • callback the data after running non-read operations and server events

  • emit request.template.callback event if this is provided (also, don't call the built-in callback)

  • dates are converted using moment.js if this is installed. Dates in valid ISO date format (YYYY-MM-DDThh:mm:ss.MMM) will be parsed with the Date constructor.

  • Introduced before and after configuration:

    {
        before: {
            appId: {
                create: "createEventB",
                read: "readEventB",
                update: "updateEventB",
                delete: "deleteEventB"
            }
        },
        after: {
            appId: {
                create: "createEventA",
                read: "readEventA",
                update: "updateEventA",
                delete: "deleteEventA"
            }
        }
    }

    or

    {
        before: { appId: "catchAllB" },
        after: { appId: "catchAllA" }
    }

    In server custom scripts we can do:

    // before event
    M.on("crud:createEventB", function (request, callback) {
      // do another db request
      foo(request, function (err, data) {
        if (err) { return callback(err); }
        request.query.something = data.something;
        callback(null, request);
      });
    });
    
    // after event
    M.on("crud:createEventA", function (request, err, data, readCount, callback) {
      // handle error message
      // then send the callback
      callback(err, data, readCount);
    });