UNPKG

@yext/search-core

Version:

Typescript Networking Library for the Yext Search API

27 lines 1.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createVerticalSearchResponse = void 0; const createDirectAnswer_1 = require("./createDirectAnswer"); const createFacets_1 = require("./createFacets"); const createLocationBias_1 = require("./createLocationBias"); const createSpellCheck_1 = require("./createSpellCheck"); const createVerticalResults_1 = require("./createVerticalResults"); function createVerticalSearchResponse(data) { var _a, _b, _c; return { verticalResults: (0, createVerticalResults_1.createVerticalResults)(data.response), queryId: data.response.queryId, directAnswer: data.response.directAnswer && (0, createDirectAnswer_1.createDirectAnswer)(data.response.directAnswer), searchIntents: data.response.searchIntents, facets: (0, createFacets_1.createFacets)(data.response.facets), spellCheck: data.response.spellCheck && (0, createSpellCheck_1.createSpellCheck)(data.response.spellCheck), locationBias: data.response.locationBias && (0, createLocationBias_1.createLocationBias)(data.response.locationBias), allResultsForVertical: data.response.allResultsForVertical && createVerticalSearchResponse({ response: data.response.allResultsForVertical }), alternativeVerticals: (_b = (_a = data.response.alternativeVerticals) === null || _a === void 0 ? void 0 : _a.modules) === null || _b === void 0 ? void 0 : _b.map(createVerticalResults_1.createVerticalResults), uuid: (_c = data.meta) === null || _c === void 0 ? void 0 : _c.uuid, queryRulesActionsData: data.response.queryRulesActionsData }; } exports.createVerticalSearchResponse = createVerticalSearchResponse; //# sourceMappingURL=createVerticalSearchResponse.js.map