2.0.4 • Published 23 days ago

helyosjs-sdk v2.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
23 days ago

About The Project

The helyosjs-sdk helps 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.

npm.io

List of features

  • 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.

Built With

Getting Started

Installation

$ npm i helyosjs-sdk  --save

Usage

import { 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);
    )}
}

Listening agent/agent sensors and work process status

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 Reference

CommandDescription
helyosService.register(email,password,adminPassword): PromiseRegister new user.
helyosService.login(username, password): PromiseUser login.
helyosService.connect(): PromiseEstablish websocket connection after logged.
helyosService.logout(): PromiseUser logout.
helyosService.changePassword(user,password,newPassword): PromiseChange password.
------
EXAMPLE OF CRUD OPERATIONS
helyosService.workprocessWork 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.
------

Most important models

ModelDescription
H_AgentsTool represents a sensor or any movable device that can perform an action
id: numberunique db identifcation number
code: numberunique identifcation number
name: stringagent name
picture: stringbase64 jpg
yardId: numberto which yard this agent is associated.
status: string'busy', 'free'
picture: stringbase64 jpg
geometry: JSONDescription of the agent geometry
heartbeat: DateLast time agent contacted the yard base
------
H_YardPhysical space enclosing agents in a drivable area.
id: numberunique db identifcation number
name: stringyard name
picture: stringbase64 jpg
mapData: {origin: {lat?: number, lon?: number, zoomLevel?: number}}base64 jpg
------
H_MapObjectDefine objects in the yard map: areas or lines.
id: numberunique db identifcation number.
yardId: numberassociated yard.
deletedAt: Datewhen shape was marked deleted.
type: stringtype of object: "obstacle", "parking-area", "gate", etc.
data: Objectuser-defined arbitrary data format
dataFormat: stringname of the data format
------
H_WorkProcessGroup and serialize actions to be executed by the agents.
id: numberunique db identifcation number.
schedStartAt: datedate and time when the process is scheduled to start.
schedEndAt: datedate and time when the process is predicted to end.
startedAt: datedate and time of actual start.
endedAt: datedate and time of actual end.
status: stringstatus.
processType: stringstatus.
data: MoveToTargetDescriptor | MoveFreeDescriptionAny JSON data that describes the actions.
------

Contributing

Keep it simple. Keep it minimal. If you have any question, please write to our Discussion forum.

License

This project is licensed under the MIT License

2.0.4

23 days ago

2.0.3

25 days ago

2.0.2

2 months ago

2.0.2-rc5

2 months ago

2.0.2-rc6

2 months ago

2.0.2-rc4

2 months ago

2.0.2-rc1

2 months ago

2.0.2-rc3

2 months ago

2.0.2-rc2

2 months ago

2.0.1

2 months ago

2.0.1-rc1

2 months ago

2.0.0

4 months ago

0.9.2

5 months ago

0.9.2-rc1

6 months ago

0.9.2-rc2

5 months ago

0.8.3-rc1

6 months ago

0.9.0

6 months ago

0.9.1

6 months ago

0.8.2

6 months ago

0.6.7

7 months ago

0.6.6

8 months ago

0.6.8

7 months ago

0.8.1

7 months ago

0.8.0

7 months ago

0.7.0

7 months ago

0.6.3

8 months ago

0.6.2

8 months ago

0.6.1

8 months ago

0.5.11-rc2

11 months ago

0.5.10

12 months ago

0.5.11

11 months ago

0.5.11-rc

11 months ago

0.6.0

9 months ago

0.5.5

12 months ago

0.5.1

1 year ago

0.3.9

1 year ago

0.3.0

1 year ago

0.3.8

1 year ago

0.3.7

1 year ago

0.4.1

1 year ago

0.3.2

1 year ago

0.2.13

2 years ago

0.1.74

2 years ago

0.1.83

2 years ago

0.1.68

2 years ago

0.1.69

2 years ago

0.1.70

2 years ago

0.1.60

2 years ago