"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.splitKbText = splitKbText; var _lodash = require("lodash"); var _kb_service = require("../kb_service"); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ function splitKbText({ id, texts, ...rest }) { return [{ type: _kb_service.KnowledgeBaseEntryOperationType.Delete, labels: { document_id: id } }, ...texts.map((text, index) => ({ type: _kb_service.KnowledgeBaseEntryOperationType.Index, document: (0, _lodash.merge)({}, rest, { id: [id, index].join('_'), labels: { document_id: id }, text }) }))]; }