Requirements On Source Code
There are multiple requirements regarding the code structure as well as the files as well.
Javascript Files Only
All files uploaded need to be valid javascript files with .js ending.
Importing of Other Files
You can upload up to 10 javascript files which can import one another. Importing from another file needs to be only local - meaning the imported
file must be one of the other files in the request. However, a javascript file can import another using require keyword only, like the following:
const { getResponseMessage } = require('./second');
Your code won't work if you use import instead of require as the code is being run on node js server!
One Main File Requirement
As mentioned before you can import multiple files but exactly one of them must be called main.js.
If none of the files will be called main.js, Javascript Execution Service won't accept such source code.
Exporting Exactly One Function From Main File
In addition to the necessity of one file needed to be called main.js, this file needs to export exactly one function using the following syntax:
const helloWorld = async parametersObject => {
const {accessTokensToProfiles, configuration, clientCustomData} = parametersObject;
}
module.exports = helloWorld;
Main Export Function from Main file parameter requirement
Exported function from the main.js file needs to have exactly one parameter of type object. This object is bound to be passed and it's ensured the parameter won't be null.
Exact contents of that object as well as how the result from your entry function is returned is specified here.