actionhero
Version:
actionhero.js is a multi-transport API Server with integrated cluster capabilities and delayed tasks
48 lines (47 loc) • 1.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Params = void 0;
const index_1 = require("../index");
/**
* Collects and formats allowed params for this server.
*/
class Params extends index_1.Initializer {
constructor() {
super();
this.name = "params";
this.loadPriority = 420;
}
async initialize() {
index_1.api.params = {
postVariables: [],
};
// special params we will always accept
index_1.api.params.globalSafeParams = [
"file",
"apiVersion",
"callback",
"action",
"messageId",
];
index_1.api.params.buildPostVariables = () => {
const postVariables = [];
let i;
let j;
index_1.api.params.globalSafeParams.forEach((p) => {
postVariables.push(p);
});
for (i in index_1.api.actions.actions) {
for (j in index_1.api.actions.actions[i]) {
const action = index_1.api.actions.actions[i][j];
for (const key in action.inputs) {
postVariables.push(key);
}
}
}
index_1.api.params.postVariables = index_1.utils.arrayUnique(postVariables);
return index_1.api.params.postVariables;
};
index_1.api.params.buildPostVariables();
}
}
exports.Params = Params;