This project is in format of a Component Package. Component Packages are the recommended way to organize Oracle Digital Assistant Custom Components and Event Handler code and allow the component code to be more portable to different runtime environments.
Generated by
@oracle/bots-node-sdk
on Thu Dec 02 2021
.
├── .npmignore
├── components
│ └── ...
├── main.js
├── package.json
├── Dockerfile
├── docker-compose.yml
└── spec
└── ...
Description | |
---|---|
.npmignore |
Ignore files when packaging as npm module |
components |
Directory (default) where Component implementations are added |
main.js |
Entrypoint for the Custom Component Package configuration |
Dockerfile |
Configuration file to create docker image |
docker-compose.yml |
Configuration file for docker deployment |
spec |
Placeholder for unit test implementations |
The Component Package behaves like any other npm
project. Directly install
any dependencies or tools required to implement the customizations.
TIP: Use
npm run bots-node-sdk
for additional CLI help and usage information.
This component package is ready to run as a local development service. Once the
service starts you may use a local tunnel, such as ngrok
,
and configure an External Service to connect the components to your Skill.
npm start
# or run with additional options
npm run bots-node-sdk -- service .
# or run with debugger
node --inspect $(npm bin)/bots-node-sdk service .
With custom component services running, test endpoints like so:
# get component metadata
curl -X GET localhost:3000/components
# invoke custom component
curl -H "Content-Type: application/json" -d @./spec/test.cc.req.json localhost:3000/components/helloWorld
# invoke entity event handler component
curl -H "Content-Type: application/json" -d @./spec/test.eh.req.json localhost:3000/components/resolveentities/helloWorld
As this package is designed to be installed and run with a corresponding service
wrapper, run npm pack
and upload the resulting .tgz
as a package for
the Embedded Container service.
npm pack
# or validate and package with the @oracle/bots-node-sdk command line
npm run bots-node-sdk -- pack .
TIP: use
npm run bots-node-sdk -- pack --help
for additional packaging options.
Run the following commands to deploy to docker and start the container:
npm run-script docker-build
docker-compose up