Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const transporter = createTransporter({
...options,
// No retry strategy on recommendation client
hostsCache: createNullCache(),
});
const appId = options.appId;
transporter.setHosts([{ url: `recommendation.${region}.algolia.com`, accept: CallEnum.Any }]);
transporter.addHeaders({
...auth.headers(),
...{ 'content-type': 'application/json' },
});
transporter.addQueryParameters(auth.queryParameters());
return addMethods({ appId, transporter }, options.methods);
};
const transporter = createTransporter({
...options,
// No retry strategy on recommendation client
hostsCache: createNullCache(),
});
const appId = options.appId;
transporter.setHosts([{ url: `analytics.${region}.algolia.com`, accept: CallEnum.Any }]);
transporter.addHeaders({
...auth.headers(),
...{ 'content-type': 'application/json' },
});
transporter.addQueryParameters(auth.queryParameters());
return addMethods({ appId, transporter }, options.methods);
};
transporter.addHeaders({
...auth.headers(),
...{ 'content-type': 'application/x-www-form-urlencoded' },
});
transporter.addQueryParameters(auth.queryParameters());
const base = {
transporter,
appId,
addAlgoliaAgent(segment: string, version?: string): void {
transporter.userAgent.add({ segment, version });
},
};
return addMethods(base, options.methods);
};
return (indexName, options = {}) => {
const searchIndex: SearchIndex = {
transporter: base.transporter,
appId: base.appId,
indexName,
};
return addMethods(searchIndex, options.methods);
};
};