Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (
settings: Settings,
requestOptions?: RequestOptions & SetSettingsOptions
): Readonly> => {
const { forwardToReplicas, ...options } = requestOptions || {};
const mappedRequestOptions = createMappedRequestOptions(options);
if (forwardToReplicas) {
mappedRequestOptions.queryParameters.forwardToReplicas = 1; // eslint-disable-line functional/immutable-data
}
return createWaitablePromise(
base.transporter.write(
{
method: MethodEnum.Put,
path: encode('1/indexes/%s/settings', base.indexName),
data: settings,
},
mappedRequestOptions
),
(response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
);
};
};
getApiKeyResponse[updatedField] === updatedFields[updatedField]
);
});
};
const wait: Wait = (_, waitRequestOptions) =>
createRetryablePromise(retry => {
return getApiKey(base)(apiKey, waitRequestOptions).then(getApiKeyResponse => {
return hasChanged(getApiKeyResponse) ? Promise.resolve() : retry();
});
});
return createWaitablePromise(
base.transporter.write(
{
method: MethodEnum.Put,
path: encode('1/keys/%s', apiKey),
data,
},
options
),
wait
);
};
};