@causalfoundry/js-sdk
Version:
Causal Foundry WEB SDK (JS/TS)
24 lines (22 loc) • 747 B
text/typescript
import {SearchProperties, ModuleType, SearchModuleType} from "../typings";
import {
LegacySearchProperties,
} from "../legacyLoggerFunctions";
/**
* Maps LegacySearchProperties to SearchProperties
* @param legacyProperties - The legacy search properties
* @returns The new search properties format
*/
export const searchPropertiesMapper = (
legacyProperties: LegacySearchProperties
): SearchProperties => {
return {
query: legacyProperties.query,
module: (legacyProperties.module ||
SearchModuleType.Core) as unknown as ModuleType,
results_list: legacyProperties.results_list?.map((item) => item.id) || [],
filter: legacyProperties.filter,
page: legacyProperties.page,
meta: legacyProperties.meta,
};
};