2023-03-23 17:22:26 -07:00
|
|
|
import type { EntitiesPath, ExpandedEntitiesPath } from './types';
|
2023-03-22 14:06:10 -07:00
|
|
|
|
2023-03-22 14:12:05 -07:00
|
|
|
function parseEntitiesPath(expandedPath: ExpandedEntitiesPath) {
|
2023-03-22 14:06:10 -07:00
|
|
|
const [entityType, ...listKeys] = expandedPath;
|
|
|
|
const listKey = (listKeys || []).join(':');
|
2023-03-22 14:12:05 -07:00
|
|
|
const path: EntitiesPath = [entityType, listKey];
|
|
|
|
|
|
|
|
return {
|
|
|
|
entityType,
|
|
|
|
listKey,
|
|
|
|
path,
|
|
|
|
};
|
2023-03-22 14:06:10 -07:00
|
|
|
}
|
|
|
|
|
2023-03-23 12:14:53 -07:00
|
|
|
|
2023-03-23 17:22:26 -07:00
|
|
|
export { parseEntitiesPath };
|