actionhero
Version:
actionhero.js is a multi-transport API Server with integrated cluster capabilities and delayed tasks
42 lines (41 loc) • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Documentation = void 0;
const index_1 = require("../index");
/**
* Documentation of Actions.
*/
class Documentation extends index_1.Initializer {
constructor() {
super();
this.name = "documentation";
this.loadPriority = 999;
}
async initialize() {
index_1.api.documentation = {
documentation: {},
build: () => {
let action;
for (const i in index_1.api.actions.actions) {
for (const j in index_1.api.actions.actions[i]) {
action = index_1.api.actions.actions[i][j];
if (action.toDocument !== false) {
if (!index_1.api.documentation.documentation[action.name]) {
index_1.api.documentation.documentation[action.name] = {};
}
index_1.api.documentation.documentation[action.name][action.version] = {
name: action.name,
version: action.version,
description: action.description,
inputs: action.inputs,
outputExample: action.outputExample,
};
}
}
}
},
};
index_1.api.documentation.build();
}
}
exports.Documentation = Documentation;