"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractIdFromLocationHeader = void 0;
const lodash_1 = require("lodash");
const extractIdFromLocationHeader = (response) => {
    var _a;
    const locationHeader = response.headers.location;
    if ((0, lodash_1.isNil)(locationHeader))
        throw new Error('Location header not found.');
    const id = (_a = locationHeader.match(/\/([^/]+)\/_history/)) === null || _a === void 0 ? void 0 : _a[1];
    if ((0, lodash_1.isNil)(id))
        throw new Error('ID not found in location header.');
    return id;
};
exports.extractIdFromLocationHeader = extractIdFromLocationHeader;
//# sourceMappingURL=utils.js.map