A Javascript wrap for helyOS GrapQL interface.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Important Update: We've relocated this project to a new repository. Future updates and versions of this source code will be exclusively released in the new repository. This change was crucial to simplify project management and foster better collaboration.
The helyosjs-sdk allows the development of javascript applications using the helyOS framework. This library contains all necessary methods and entity types to build a front-end using helyOS as backend system.
- Log in as administrator or regular user.
- List and edit automatons (agents).
- Retrieve sensors data and work process status.
- Create, schedule and handle work processes.
- Manage and edit yards: set drivable areas, gates, obstacles, etc.
$ npm i helyosjs-sdk --saveimport { HelyosServices, H_Agents } from 'helyosjs-sdk';
const helyosService = new HelyosServices('http://localhost', {socketPort:'5002', gqlPort:'5000'});
const username = 'admin@email.com';
const password = 'password';
helyosService.login(username, password)
.then( response => helyosService.connect())
.then( connected => console.log(connected));;
function listAgents {
return helyosService.agents.list(0)
.then((agents: H_Agent[]) => {
console.log(agents);
});
}
function editTool(patch: H_Agents) {
return helyosService.agents.patch(patch)
.then(agents => {
console.log(agents);
)}
}helyosService.connect()
.then(() => {
const socket = helyosService.socket;
socket.on('new_agent_poses',(updates)=>{
console.log(updates); // Notifications from agent sensors.
});
socket.on('change_agent_status',(updates)=>{
console.log(updates); // Notifications from agents working status.
});
socket.on('change_work_processes',(updates)=>{
console.log(updates); // Notifications from work processes status.
});
});
| Command | Description |
|---|---|
helyosService.register(email,password,adminPassword): Promise |
Register new user. |
helyosService.login(username, password): Promise |
User login. |
helyosService.connect(): Promise |
Establish websocket connection after logged. |
helyosService.logout(): Promise |
User logout. |
helyosService.changePassword(user,password,newPassword): Promise |
Change password. |
| --- | --- |
| EXAMPLE OF CRUD OPERATIONS | |
helyosService.workprocess |
Work Processes services |
| .list (condition: Partial<H_WorkProcess>): Promise<H_WorkProcess[]> | list all work processes filtered by condition. |
| .create (data: H_WorkProcess): Promise<H_WorkProcess> | create work process. |
| .get (workProcessId: number): Promise<H_WorkProcess> | get work process by ID. |
| .patch (data:Partial<H_WorkProcess>): Promise<H_WorkProcess> | edit work process. |
| --- | --- |
| Model | Description |
|---|---|
H_Agents |
Tool represents a sensor or any movable device that can perform an action |
| id: number | unique db identifcation number |
| code: number | unique identifcation number |
| name: string | agent name |
| picture: string | base64 jpg |
| yardId: number | to which yard this agent is associated. |
| status: string | 'busy', 'free' |
| picture: string | base64 jpg |
| geometry: JSON | Description of the agent geometry |
| heartbeat: Date | Last time agent contacted the yard base |
| --- | --- |
H_Yard |
Physical space enclosing agents in a drivable area. |
| id: number | unique db identifcation number |
| name: string | yard name |
| picture: string | base64 jpg |
| mapData: {origin: {lat?: number, lon?: number, zoomLevel?: number}} | base64 jpg |
| --- | --- |
H_MapObject |
Define objects in the yard map: areas or lines. |
| id: number | unique db identifcation number. |
| yardId: number | associated yard. |
| deletedAt: Date | when shape was marked deleted. |
| type: string | type of object: "obstacle", "parking-area", "gate", etc. |
| data: Object | user-defined arbitrary data format |
| dataFormat: string | name of the data format |
| --- | --- |
H_WorkProcess |
Group and serialize actions to be executed by the agents. |
| id: number | unique db identifcation number. |
| schedStartAt: date | date and time when the process is scheduled to start. |
| schedEndAt: date | date and time when the process is predicted to end. |
| startedAt: date | date and time of actual start. |
| endedAt: date | date and time of actual end. |
| status: string | status. |
| processType: string | status. |
| data: MoveToTargetDescriptor | MoveFreeDescription | Any JSON data that describes the actions. |
| --- | --- |
Keep it simple. Keep it minimal.
- Carlos E. Viol Barbosa
- Nikolay Belov
This project is licensed under the MIT License
