lib/actions.js
function describeChangeset(cfn, name, changesetId, callback) {

  var changesetDescriptions;
  var changes = [];

  (function callAPI(nextToken, callback) {
    cfn.describeChangeSet({ ChangeSetName: changesetId, StackName: name, NextToken: nextToken }, function(err, data) {
      if (err) return callback(err);

      changesetDescriptions = data;

      if (data.Status === 'CREATE_COMPLETE' || data.Status === 'FAILED' || data.status === 'DELETE_COMPLETE') {
        changes = changes.concat(data.Changes || []);

        if (!data.NextToken) {
          if (changes.length) changesetDescriptions.Changes = changes;
          return callback(null, changesetDescriptions);
        }
      }

      setTimeout(callAPI, 1000, data.NextToken, callback);
    });
  })(undefined, callback);
}
function describeChangeset(cfn, name, changesetId, callback) {

  var changesetDescriptions;
  var changes = [];

  (function callAPI(nextToken, callback) {
    cfn.describeChangeSet({ ChangeSetName: changesetId, StackName: name, NextToken: nextToken }, function(err, data) {
      if (err) return callback(err);

      changesetDescriptions = data;

      if (data.Status === 'CREATE_COMPLETE' || data.Status === 'FAILED' || data.status === 'DELETE_COMPLETE') {
        changes = changes.concat(data.Changes || []);

        if (!data.NextToken) {
          if (changes.length) changesetDescriptions.Changes = changes;
          return callback(null, changesetDescriptions);
        }
      }

      setTimeout(callAPI, 1000, data.NextToken, callback);
    });
  })(undefined, callback);
}
function describeChangeset ( cfn , name , changesetId , callback ) { var changesetDescriptions ; var changes = [ ] ; ( function callAPI ( nextToken , callback ) { cfn . describeChangeSet ( { ChangeSetName : changesetId , StackName : name , NextToken : nextToken } , function ( err , data ) { if ( err ) return callback ( err ) ; changesetDescriptions = data ; if ( data . Status === 'CREATE_COMPLETE' || data . Status === 'FAILED' || data . status === 'DELETE_COMPLETE' ) { changes = changes . concat ( data . Changes || [ ] ) ; if ( ! data . NextToken ) { if ( changes . length ) changesetDescriptions . Changes = changes ; return callback ( null , changesetDescriptions ) ; } } setTimeout ( callAPI , 1000 , data . NextToken , callback ) ; } ) ; } ) ( undefined , callback ) ; }
Poll changeset until it has reached a completed state.

@private
@param {object} cfn - a cloudformation client object
@param {string} name - the name of the existing stack to update
@param {string} changesetId - the name or ARN of an existing changeset
@param {function} callback - a function that will be provided with the changeset
details once the changeset is in CREATE_COMPLETE, DELETE_COMPLETE, or FAILED state
Poll changeset until it has reached a completed state .