Logic
Interactor® logic is populated in a corresponding event file.
Each file is named [event].[language name]. For example, a general execution based on javascript will be named execute.js
.
Currently, only Javascript is supported.
Each logic will have different expectations depending on what component is being configured.
Automation configuration:
- Trigger: create.js
- Trigger: delete.js
Automation triggered:
- Trigger: trigger.js
- Action: execute.js
- Condition: execute.js
Event:
- Event: route.js
- Event: response.js
Following JS packages are built into the deployment
{
"axios": "^1.6.2",
"body-parser": "^1.20.2",
"express": "^4.18.2",
"lodash": "^4.17.21",
"node-cache": "^5.1.2",
"xml2js": "^0.6.2"
}
Additional packages may be included by changing deployment files. For example, assuming lodash was not builtin, if lodash was being custom added,
Docker
FROM interactor/interactor-language-javascript:latest
WORKDIR /usr/src/app
# ENV INPUT_VAR=input
# ENV DEPS_VAR=$
RUN npm install lodash
COPY deps.js .
RUN npm ci --omit=dev
deps.js
import lodash from 'lodash'
export default { lodash }
Lodash can now be used in logic as follows.
return $.lodash.shuffle([1,2,3])
Helpful?