43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
var configRegistry = require('./../../config-registry');
|
|
|
|
module.exports = (function () {
|
|
|
|
var masterDebug = function(ctx,modelName,modelType,model) {
|
|
ctx.server.get(
|
|
ctx.createSlugApiServerBase('master')+
|
|
'/'+modelName+
|
|
'/'+modelType
|
|
,ctx.renderFunctionJSON(function() {
|
|
var result = {};
|
|
result[modelName] = model;
|
|
return result;
|
|
})
|
|
);
|
|
};
|
|
|
|
return function ServerDebugPlugin() {
|
|
|
|
this.configPlugin = function (ctx) {
|
|
ctx.key = 'serverDebug';
|
|
ctx.description = 'Exports some debug data.';
|
|
ctx.localDir = __dirname;
|
|
ctx.localConfigTemplate = 'debug.json';
|
|
};
|
|
|
|
this.configServer = function(ctx) {
|
|
var mt = configRegistry.getMasterTemplates();
|
|
masterDebug(ctx,'tfield', 'template', mt.masterTFieldTemplate);
|
|
masterDebug(ctx,'tfield', 'thelp', mt.masterTFieldTHelp);
|
|
masterDebug(ctx,'tentity', 'template', mt.masterTEntityTemplate);
|
|
masterDebug(ctx,'tentity', 'thelp', mt.masterTEntityTHelp);
|
|
masterDebug(ctx,'tview', 'template', mt.masterTViewTemplate);
|
|
masterDebug(ctx,'tview', 'thelp', mt.masterTViewTHelp);
|
|
|
|
// todo: TypeError: Converting circular structure to JSON
|
|
//ctx.server.get(ctx.createSlugApiServerBase('config/root-tentity'),this.renderFunction(function() {
|
|
// return configRegistry.rootTEntity;
|
|
//}));
|
|
};
|
|
};
|
|
})();
|