registerPipe(plugin, event, handler) {
    debug('[%s] registering pipe on event "%s"', plugin.name, event);

    const warnDelay =
      plugin.config.pipeWarnTime !== undefined
        ? plugin.config.pipeWarnTime
        : this.config.common.pipeWarnTime;

    const wrapper = (...data) => {
      const now = warnDelay ? Date.now() : null;
      const callback = data.pop();

      const cb = (error, result) => {
        if (warnDelay) {
          const elapsed = Date.now() - now;

          if (elapsed > warnDelay) {
            global.kuzzle.log.warn(
              `${plugin.logPrefix} pipe for event '${event}' is slow (${elapsed}ms)`,
            );
          }
        }

        callback(error, result);
      };

      try {
        const pipeResponse =
          data.length === 0 ? handler(null, cb) : handler(...data, cb);

        if (
          typeof pipeResponse === "object" &&
          pipeResponse !== null &&
          typeof pipeResponse.then === "function" &&
          typeof pipeResponse.catch === "function"
        ) {
          pipeResponse
            .then((result) => {
              cb(null, result);
              return null; // prevents a false-positive bluebird warning
            })
            .catch((error) => cb(error));
        }
      } catch (error) {
        cb(
          error instanceof KuzzleError
            ? error
            : runtimeError.getFrom(error, "unexpected_error", error.message),
        );
      }
    };

    return global.kuzzle.registerPluginPipe(event, wrapper);
  }
Register a pipe function on an event

@param {object} plugin
@param {number} warnDelay - delay before a warning is issued
@param {string} event name
@param {Function} handler - function to attach

@returns {string} pipeId