click-trigger.js 895 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * @node click-trigger
  3. * @name Click Trigger
  4. * @category triggers
  5. * @version 1.0.0
  6. * @description Manual execution trigger - starts workflow when clicked
  7. * @trigger
  8. * @icon play
  9. */
  10. const configSchema = {
  11. type: 'object',
  12. properties: {
  13. label: {
  14. type: 'string',
  15. title: 'Button Label',
  16. default: 'Execute'
  17. }
  18. }
  19. };
  20. const inputSchema = {
  21. type: 'object',
  22. properties: {}
  23. };
  24. const outputSchema = {
  25. type: 'object',
  26. properties: {
  27. timestamp: { type: 'number' },
  28. triggeredBy: { type: 'string' },
  29. executionId: { type: 'string' }
  30. }
  31. };
  32. async function execute(config, input, context) {
  33. smartbotic.log.info('Click trigger activated');
  34. return {
  35. timestamp: Date.now(),
  36. triggeredBy: 'manual',
  37. executionId: context.executionId || smartbotic.utils.uuid()
  38. };
  39. }
  40. module.exports = { configSchema, inputSchema, outputSchema, execute };