UNPKG

diffusion

Version:

Diffusion JavaScript client

22 lines (21 loc) 686 B
"use strict"; /** * @module V4Stack */ Object.defineProperty(exports, "__esModule", { value: true }); exports.cidFromHeaders = void 0; var errors_1 = require("./../../errors/errors"); var conversation_id_1 = require("./../conversation/conversation-id"); /** * Get the conversation id from the message headers * * @param headers the message headers * @return the conversation ID */ function cidFromHeaders(headers) { if (!headers || headers.length === 0) { throw new errors_1.IOError('Empty headers, expected at least 1'); } return conversation_id_1.ConversationId.fromString(headers[headers.length - 1]); } exports.cidFromHeaders = cidFromHeaders;