function sendOutputMap(outputs, resultType, options) {
  // First check if the output sequence contains errors
  const errors = outputs.filter((map) => map.error != null).map((map) => map.error);
  if (errors.length) {
    return Promise.reject(normalizeOutput(errors, options));
  }

  if (resultType === 'sequence') {
    return Promise.resolve(outputs.map((map) => {
      /** @type {Object<string, any|IP>} */
      const res = {};
      Object.keys(map).forEach((key) => {
        const val = map[key];
        if (options.raw) {
          res[key] = val;
          return;
        }
        res[key] = normalizeOutput([val], options);
      });
      return res;
    }));
  }

  // Flatten the sequence
  /** @type {Object<string, Array<any|IP>>} */
  const mappedOutputs = {};
  outputs.forEach((map) => {
    Object.keys(map).forEach((key) => {
      const val = map[key];
      if (!mappedOutputs[key]) {
        mappedOutputs[key] = [];
      }
      mappedOutputs[key].push(val);
    });
  });

  const outputKeys = Object.keys(mappedOutputs);
  const withValue = outputKeys.filter((outport) => mappedOutputs[outport].length > 0);
  if (withValue.length === 0) {
    // No output
    return Promise.resolve(null);
  }
  if ((withValue.length === 1) && (resultType === 'simple')) {
    // Single outport
    return Promise.resolve(normalizeOutput(mappedOutputs[withValue[0]], options));
  }
  /** @type {Object<string, any|IP>} */
  const result = {};
  Object.keys(mappedOutputs).forEach((port) => {
    const packets = mappedOutputs[port];
    result[port] = normalizeOutput(packets, options);
  });
  return Promise.resolve(result);
}
@param {OutputMap} outputs
@param {string} resultType
@param {AsCallbackOptions} options