Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const accountCopyIndex = (
source: SearchIndex,
destination: SearchIndex,
requestOptions: RequestOptions
): WaitablePromise => {
// eslint-disable-next-line functional/prefer-readonly-type
const responses: Array> = [];
const promise = exists(destination)()
.then(res => {
if (source.appId === destination.appId) {
throw createIndicesInSameAppError(source.appId);
}
if (res) {
throw createDestinationIndiceExistsError();
}
})
.then(() => getSettings(source)())
.then(settings =>
// eslint-disable-next-line functional/immutable-data
responses.push(setSettings(destination)(settings, requestOptions))
)
.then(() =>
browseRules(source)({