handleBlockExpression.js 493 B

12345678910111213141516171819
  1. import * as tmpl from '@n8n_io/riot-tmpl';
  2. import functions from '@/newtab/workflowEngine/templating/templatingFunctions';
  3. tmpl.brackets.set('{{ }}');
  4. const templatingFunctions = Object.keys(functions).reduce((acc, funcName) => {
  5. acc[`$${funcName}`] = functions[funcName];
  6. return acc;
  7. }, {});
  8. export default function ({ str, data }, sendResponse) {
  9. const value = tmpl.tmpl(str, { ...data, ...templatingFunctions });
  10. sendResponse({
  11. list: {},
  12. value: value.slice(2),
  13. });
  14. }