lib/commandCenter/commandCenter.js
function generateCommandPromise(cmdInfo, state, paramList) {
	const mod = cmdInfo.mod;
	const execute = () => mod.execute.apply(mod, paramList);

	if (cmdInfo.isAsync) {
		// Async user commands will need to take the response value, and feed it
		// to `state.respond`
		const isJson = mod.serialize === false;

		return execute()
			.then((response) => state.respond(response, isJson));
	} else {
		// Callback-based user commands are expected to call `state.respond`
		// on their own; all we need to do is promisify
		return new Promise((resolve) => paramList.push(resolve) && execute());
	}
}
function generateCommandPromise(cmdInfo, state, paramList) {
	const mod = cmdInfo.mod;
	const execute = () => mod.execute.apply(mod, paramList);

	if (cmdInfo.isAsync) {
		// Async user commands will need to take the response value, and feed it
		// to `state.respond`
		const isJson = mod.serialize === false;

		return execute()
			.then((response) => state.respond(response, isJson));
	} else {
		// Callback-based user commands are expected to call `state.respond`
		// on their own; all we need to do is promisify
		return new Promise((resolve) => paramList.push(resolve) && execute());
	}
}
function generateCommandPromise ( cmdInfo , state , paramList ) { const mod = cmdInfo . mod ; const execute = ( ) => mod . execute . apply ( mod , paramList ) ; if ( cmdInfo . isAsync ) { // Async user commands will need to take the response value, and feed it // to `state.respond` const isJson = mod . serialize === false ; return execute ( ) . then ( ( response ) => state . respond ( response , isJson ) ) ; } else { // Callback-based user commands are expected to call `state.respond` // on their own; all we need to do is promisify return new Promise ( ( resolve ) => paramList . push ( resolve ) && execute ( ) ) ; } }
Promisify the user command execute method, or
ensure its return value is passed to state.respond

Once callback-based user commands are removed from MAGE,
you will be able to remove this method.

@param {*} cmdInfo
@param {State} state
@param {*} paramList
Promisify the user command execute method or ensure its return value is passed to state . respond