import { EditorLanguage, FormComponentType, LanguagePluginID, Plugin, PluginResponseType, PluginType } from '../../types/index.js'; import { PUBLIC_INTEGRATIONS_LOGO_URL } from './constants.js'; const JavascriptPluginVersions = { V1: '0.0.1' }; export const JavascriptPlugin: Plugin = { id: LanguagePluginID.JavaScript, name: 'JavaScript', moduleName: 'JavascriptPlugin', modulePath: 'plugins/javascript/JavascriptPlugin', iconLocation: `${PUBLIC_INTEGRATIONS_LOGO_URL}/javascript.png`, type: PluginType.CODE, responseType: PluginResponseType.JSON, hasRawRequest: true, rawRequestName: 'Executed code', datasourceTemplate: { sections: [] }, actionTemplate: { sections: [ { name: 'main', items: [ { name: 'body', label: '', startVersion: JavascriptPluginVersions.V1, componentType: FormComponentType.CODE_EDITOR, language: EditorLanguage.JAVASCRIPT, initialValue: `/* * You can use JavaScript Functions to: * 1. Transform the output of previous Steps by referencing their output (ex. Step1.output) * 2. Write business logic referencing UI components (ex. Table1.selectedRow.id) * 3. Make http calls via axios * * Learn more in the docs: https://docs.superblocks.com/backend-apis/javascript */ const obj = {str: "hello world"}; console.log(obj.str); return obj; `, rules: [{ required: true, message: 'Function body is required' }] } ] } ] } };