- Información general
- Funciones JavaScript
- Funciones de Python
- Implementar y ejecutar
Pruebas y depuración
Ejecuta funciones de JavaScript localmente, llámalas a través de HTTP, ejecuta una como trabajo y valida el proyecto empaquetado antes de publicarlo.
Las funciones se ejecutan localmente antes de empaquetarse, en el mismo runtime y el mismo enrutamiento que utiliza la plataforma.
Servir y llamar
uip function serve
uip function serve
Inicia un servidor de recarga en caliente en el puerto 7070; --port lo cambia. Cada función HTTP es invocable en su ruta declarada, y la URL raíz enumera las rutas registradas.
Llama a una función servida con curl en su ruta declarada:
curl -X POST http://localhost:7070/hello \
-H "Content-Type: application/json" \
-d '{"name":"Alice"}'
curl -X POST http://localhost:7070/hello \
-H "Content-Type: application/json" \
-d '{"name":"Alice"}'
serve también tarda --runtime en elegir el runtime, node o deno.
Ejecutar uno como trabajo
uip function run process-order --input '{"orderId":"A-1"}'
uip function run process-order --input '{"orderId":"A-1"}'
run runs the function once, the way the platform runs a job, and prints a JobResult with the status and the output arguments. It doesn't need serve. ctx.params and ctx.headers are empty, as in a deployed job. Use run to test job functions, and serve to test HTTP functions. Pass --input-file to read the input from a JSON file.
Llegar a Orchestrator localmente
ctx.robot es null en una ejecución local y ctx.platform se crea a partir de variables de entorno. Póngalos en un archivo .env en la raíz del proyecto:
UIPATH_ACCESS_TOKEN=<your-access-token>
UIPATH_BASE_URL=https://cloud.uipath.com
UIPATH_ORG_ID=<org id>
UIPATH_TENANT_ID=<tenant id>
UIPATH_ACCESS_TOKEN=<your-access-token>
UIPATH_BASE_URL=https://cloud.uipath.com
UIPATH_ORG_ID=<org id>
UIPATH_TENANT_ID=<tenant id>
serve loads that file. Exporting the variables in your shell works too.
Running in production mode
serve --production and run --production start the project the way the platform does, without hot reload. See the CLI reference for details.