1 | 'use strict';
|
2 |
|
3 | module.exports = function(json) {
|
4 | let collections = json.collections;
|
5 | let types = json.types;
|
6 | let moduleConfig = { collections, types };
|
7 | let collectionMap = {};
|
8 | let collectionPaths = [];
|
9 | let collectionNames = Object.keys(collections);
|
10 | collectionNames.forEach(function(collectionName) {
|
11 | var collection = collections[collectionName];
|
12 | var fullPath = collectionName;
|
13 | if (collection.group) {
|
14 | fullPath = collection.group + '/' + fullPath;
|
15 | }
|
16 | collectionPaths.push(fullPath);
|
17 | collectionMap[fullPath] = collectionName;
|
18 | });
|
19 |
|
20 | moduleConfig.collectionMap = collectionMap;
|
21 | moduleConfig.collectionPaths = collectionPaths;
|
22 |
|
23 |
|
24 |
|
25 | return moduleConfig;
|
26 | };
|