Skip to content

Instantly share code, notes, and snippets.

@flancer64
Last active February 8, 2022 13:36
Show Gist options
  • Save flancer64/082e6b0279f5f792e3aeacbeea09d14a to your computer and use it in GitHub Desktop.
Save flancer64/082e6b0279f5f792e3aeacbeea09d14a to your computer and use it in GitHub Desktop.
TeqFW action code template (./src/Back/Act/Name.mjs)
/**
* Action description.
*
* @namespace Vnd_Prj_Back_Act_Name
*/
// MODULE'S IMPORT
import {join} from 'path';
// MODULE'S VARS
const NS = 'Vnd_Prj_Back_Act_Name';
// MODULE'S CLASSES
/**
* Enumeration for result codes.
* @memberOf Vnd_Prj_Back_Act_Name
*/
const RESULT = {
FAIL: 'fail',
SUCCESS: 'success',
}
Object.freeze(RESULT);
// MODULE'S FUNCTIONS
export default function (spec) {
// DEPS
/** @type {Vnd_Prj_Back_Defaults} */
const DEF = spec['Vnd_Prj_Back_Defaults$'];
// ENCLOSED VARS
// ENCLOSED FUNCS
/**
* @param {string} title
* @param {string} body
* @return {Promise<{msgId, code}>}
* @memberOf Vnd_Prj_Back_Act_Name
*/
async function act({title, body}) {
// ENCLOSED FUNCS
// MAIN
const msgId = 1;
const code = RESULT.SUCCESS;
return {msgId, code};
}
// MAIN FUNCTIONALITY
Object.defineProperty(act, 'namespace', {value: `${NS}.act`});
act.RESULT = RESULT;
return act;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment