src/entity/Action.js
/**
 * Fill action type and entity ID. Resource type takes precedence over given
 * type. Entity ID overrides any pre-defined target ID, if action is created on
 * an Entity instance.
 *
 * @param {Object} data - Action data
 * @param {Scope|Resource|Entity} caller - Where the resource is attached to
 * @param {string} actionType - Resource action type
 * @return {Object} - New action data
 */
Fill action type and entity ID. Resource type takes precedence over given
type. Entity ID overrides any pre-defined target ID, if action is created on
an Entity instance.

@param {Object} data - Action data
@param {Scope|Resource|Entity} caller - Where the resource is attached to
@param {string} actionType - Resource action type
@return {Object} - New action data
Fill action type and entity ID . Resource type takes precedence over given type . Entity ID overrides any pre - defined target ID if action is created on an Entity instance . @param { Object } data - Action data @param { Scope|Resource|Entity } caller - Where the resource is attached to @param { string } actionType - Resource action type @return { Object } - New action data
function fillAction (data, caller, actionType) {
  const action = Object.assign({}, data)
  action.type = actionType !== 'all' ? actionType : data.type || ''
  const entityIdentifier = getIdentifier(caller)
  if (entityIdentifier) {
    action[entityIdentifier] = caller.id
  }
  return action
}
function fillAction ( data , caller , actionType ) { const action = Object . assign ( { } , data ) action . type = actionType !== 'all' ? actionType : data . type || '' const entityIdentifier = getIdentifier ( caller ) if ( entityIdentifier ) { action [ entityIdentifier ] = caller . id } return action }
Fill action type and entity ID.
Fill action type and entity ID .
// Fill type from Resource or pre-defined type. // Fill in entity ID if called on an entity.