15 lines
480 B
JavaScript
15 lines
480 B
JavaScript
|
import { appDefinitionFile } from '../common';
|
||
|
import { constructHierarchy } from './createNodes';
|
||
|
|
||
|
export const getApplicationDefinition = datastore => async () => {
|
||
|
const exists = await datastore.exists(appDefinitionFile);
|
||
|
|
||
|
if (!exists) throw new Error('Application definition does not exist');
|
||
|
|
||
|
const appDefinition = await datastore.loadJson(appDefinitionFile);
|
||
|
appDefinition.hierarchy = constructHierarchy(
|
||
|
appDefinition.hierarchy,
|
||
|
);
|
||
|
return appDefinition;
|
||
|
};
|