lib/Model.js
function Operations () {
    this.ifNotExistsSet = {};
    this.SET = {};
    this.ADD = {};
    this.REMOVE = {};
    this.LISTAPPEND = {};

    this.addIfNotExistsSet = function (name, item) {
      this.ifNotExistsSet[name] = item;
    };

    this.addSet = function (name, item) {
      if (schema.hashKey.name !== name && (schema.rangeKey || {}).name !== name) {
        this.SET[name] = item;
      }
    };

    this.addListAppend = function (name, item) {
      if (schema.hashKey.name !== name && (schema.rangeKey || {}).name !== name) {
        this.LISTAPPEND[name] = item;
      }
    };

    this.addAdd = function (name, item) {
      if (schema.hashKey.name !== name && (schema.rangeKey || {}).name !== name) {
        this.ADD[name] = item;
      }
    };

    this.addRemove = function (name, item) {
      if (schema.hashKey.name !== name && (schema.rangeKey || {}).name !== name) {
        this.REMOVE[name] = item;
      }
    };

    this.getUpdateExpression = function (getUpdateReq) {
      let attrCount = 0;
      let updateExpression = '';

      let attrName;
      let valName;
      let name;
      let item;

      const setExpressions = [];
      for (name in this.ifNotExistsSet) {
        item = this.ifNotExistsSet[name];

        attrName = `#_n${attrCount}`;
        valName = `:_p${attrCount}`;

        getUpdateReq.ExpressionAttributeNames[attrName] = name;
        getUpdateReq.ExpressionAttributeValues[valName] = item;

        setExpressions.push(`${attrName} = if_not_exists(${attrName}, ${valName})`);

        attrCount += 1;
      }

      for (name in this.SET) {
        item = this.SET[name];

        attrName = `#_n${attrCount}`;
        valName = `:_p${attrCount}`;

        getUpdateReq.ExpressionAttributeNames[attrName] = name;
        getUpdateReq.ExpressionAttributeValues[valName] = item;

        setExpressions.push(`${attrName} = ${valName}`);

        attrCount += 1;
      }
      for (name in this.LISTAPPEND) {
        item = this.LISTAPPEND[name];

        attrName = `#_n${attrCount}`;
        valName = `:_p${attrCount}`;

        getUpdateReq.ExpressionAttributeNames[attrName] = name;
        getUpdateReq.ExpressionAttributeValues[valName] = item;

        setExpressions.push(`${attrName} = list_append(${attrName}, ${valName})`);

        attrCount += 1;
      }
      if (setExpressions.length > 0) {
        updateExpression += `SET ${setExpressions.join(',')} `;
      }

      const addExpressions = [];
      for (name in this.ADD) {
        item = this.ADD[name];

        attrName = `#_n${attrCount}`;
        valName = `:_p${attrCount}`;

        getUpdateReq.ExpressionAttributeNames[attrName] = name;
        getUpdateReq.ExpressionAttributeValues[valName] = item;

        addExpressions.push(`${attrName} ${valName}`);

        attrCount += 1;
      }
      if (addExpressions.length > 0) {
        updateExpression += `ADD ${addExpressions.join(',')} `;
      }

      const removeExpressions = [];
      for (name in this.REMOVE) {
        item = this.REMOVE[name];

        attrName = `#_n${attrCount}`;

        getUpdateReq.ExpressionAttributeNames[attrName] = name;

        removeExpressions.push(attrName);

        attrCount += 1;
      }
      if (removeExpressions.length > 0) {
        updateExpression += `REMOVE ${removeExpressions.join(',')}`;
      }

      getUpdateReq.UpdateExpression = updateExpression;
    };
  }
function Operations () {
    this.ifNotExistsSet = {};
    this.SET = {};
    this.ADD = {};
    this.REMOVE = {};
    this.LISTAPPEND = {};

    this.addIfNotExistsSet = function (name, item) {
      this.ifNotExistsSet[name] = item;
    };

    this.addSet = function (name, item) {
      if (schema.hashKey.name !== name && (schema.rangeKey || {}).name !== name) {
        this.SET[name] = item;
      }
    };

    this.addListAppend = function (name, item) {
      if (schema.hashKey.name !== name && (schema.rangeKey || {}).name !== name) {
        this.LISTAPPEND[name] = item;
      }
    };

    this.addAdd = function (name, item) {
      if (schema.hashKey.name !== name && (schema.rangeKey || {}).name !== name) {
        this.ADD[name] = item;
      }
    };

    this.addRemove = function (name, item) {
      if (schema.hashKey.name !== name && (schema.rangeKey || {}).name !== name) {
        this.REMOVE[name] = item;
      }
    };

    this.getUpdateExpression = function (getUpdateReq) {
      let attrCount = 0;
      let updateExpression = '';

      let attrName;
      let valName;
      let name;
      let item;

      const setExpressions = [];
      for (name in this.ifNotExistsSet) {
        item = this.ifNotExistsSet[name];

        attrName = `#_n${attrCount}`;
        valName = `:_p${attrCount}`;

        getUpdateReq.ExpressionAttributeNames[attrName] = name;
        getUpdateReq.ExpressionAttributeValues[valName] = item;

        setExpressions.push(`${attrName} = if_not_exists(${attrName}, ${valName})`);

        attrCount += 1;
      }

      for (name in this.SET) {
        item = this.SET[name];

        attrName = `#_n${attrCount}`;
        valName = `:_p${attrCount}`;

        getUpdateReq.ExpressionAttributeNames[attrName] = name;
        getUpdateReq.ExpressionAttributeValues[valName] = item;

        setExpressions.push(`${attrName} = ${valName}`);

        attrCount += 1;
      }
      for (name in this.LISTAPPEND) {
        item = this.LISTAPPEND[name];

        attrName = `#_n${attrCount}`;
        valName = `:_p${attrCount}`;

        getUpdateReq.ExpressionAttributeNames[attrName] = name;
        getUpdateReq.ExpressionAttributeValues[valName] = item;

        setExpressions.push(`${attrName} = list_append(${attrName}, ${valName})`);

        attrCount += 1;
      }
      if (setExpressions.length > 0) {
        updateExpression += `SET ${setExpressions.join(',')} `;
      }

      const addExpressions = [];
      for (name in this.ADD) {
        item = this.ADD[name];

        attrName = `#_n${attrCount}`;
        valName = `:_p${attrCount}`;

        getUpdateReq.ExpressionAttributeNames[attrName] = name;
        getUpdateReq.ExpressionAttributeValues[valName] = item;

        addExpressions.push(`${attrName} ${valName}`);

        attrCount += 1;
      }
      if (addExpressions.length > 0) {
        updateExpression += `ADD ${addExpressions.join(',')} `;
      }

      const removeExpressions = [];
      for (name in this.REMOVE) {
        item = this.REMOVE[name];

        attrName = `#_n${attrCount}`;

        getUpdateReq.ExpressionAttributeNames[attrName] = name;

        removeExpressions.push(attrName);

        attrCount += 1;
      }
      if (removeExpressions.length > 0) {
        updateExpression += `REMOVE ${removeExpressions.join(',')}`;
      }

      getUpdateReq.UpdateExpression = updateExpression;
    };
  }
determine the set of operations to be executed