Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (
userID: string,
requestOptions?: RequestOptions
): Readonly> => {
const mappedRequestOptions = createMappedRequestOptions(requestOptions);
// eslint-disable-next-line functional/immutable-data
mappedRequestOptions.headers['X-Algolia-User-ID'] = userID;
return base.transporter.write(
{
method: MethodEnum.Delete,
path: '1/clusters/mapping',
},
mappedRequestOptions
);
};
};
return (
objectID: string,
requestOptions?: RequestOptions
): 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.Delete,
path: encode('1/indexes/%s/rules/%s', base.indexName, objectID),
},
mappedRequestOptions
),
(response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
);
};
};
return (
objectID: string,
requestOptions?: RequestOptions & DeleteSynonymOptions
): 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.Delete,
path: encode('1/indexes/%s/synonyms/%s', base.indexName, objectID),
},
mappedRequestOptions
),
(response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
);
};
};
return (requestOptions?: RequestOptions): Readonly> => {
return createWaitablePromise(
base.transporter.write(
{
method: MethodEnum.Delete,
path: encode('1/indexes/%s', base.indexName),
},
requestOptions
),
(response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
);
};
};
const wait: Wait = (_, waitRequestOptions) => {
return createRetryablePromise(retry => {
return getApiKey(base)(apiKey, waitRequestOptions)
.catch((apiError: ApiError) => {
if (apiError.status !== 404) {
throw apiError;
}
})
.then(retry);
});
};
return createWaitablePromise(
base.transporter.write(
{
method: MethodEnum.Delete,
path: encode('1/keys/%s', apiKey),
},
requestOptions
),
wait
);
};
};