Skip to content

NicoApizee/dev-service-framework

 
 

Repository files navigation

reTHINK Service Framework

ReThink Framework Overview

The reTHINK Framework is built around Hyperlinked Entities (hyperties) that leverages the protocol-on-the-fly (ProtoFly) concept to avoid creating or modifying standard network protocols, but moving instead towards an API based flat service architecture. The reTHINK project envisages a global network of interconnected hyperties that are executed in web runtime environment on end-user devices or edge-network servers. The reTHINK Framework functions are based on a series of such hyperties that are generated by the service provider, and are downloaded to the users’ end-users or edge-network servers. The hyperty modules represent a set of services that are stored in a Catalogue. The instantiated versions of these hyperties are registered in a Registry, which represents authenticated users who are available for in-coming connectivity service. Therefore, the Registry serves as a location manager and is used for user discovery. A user can be a human being, a group or, a connected object (e.g. building room with sensors). Users have independent identities that are maintained by Identity Providers (IdPs) that are independent organizations. The users’ identities are based on their personal and confidential data, which is verified by other solicited data, but such private information is only divulged under user-controlled privacy rules.

More information about reTHINK Framework is provided here:

The current repository provides the Hyperty Service Framework, comprised by a set of libs to develop, and test new Hyperties. Check below a quick guideline on how to use the Hyperty Service Framework. In order to setup your own reTHINK Framework, you should install the following components (docker images available):

Very soon we will provide a live public reTHINK environment, to let you publish and try your Hyperties or Apps without the need to install anything. Demos with Apps and Hyperty examples are provided below.

Getting Started

Different development manuals are available, including:

You may find, Hyperty WebRTC and Group Chat examples here

A summary of Hyperty examples will be provided here very soon

How to contribute

This section provides guidelines on how to contribute to reTHINK Service Framework. Contributions to other reTHINK components should follow its own guidelines:

How to install this repository like a NPM Module;

How to include this repository in other software parts, like dev-runtime-browser, dev-runtime-node or dev-runtime-core;

jspm install service-framework=github:reTHINK-project/dev-service-framework

or

npm install github:reTHINK-project/dev-service-framework --save

If you have problems with the npm install service framework module, you may need following the steps present on Github Help. and select operation system you are using.

Setup Environment

On the first time you are cloning this repository, you need to run the command npm run init-setup;

After running successfully this command you will have 2 folders (node_modules and vendor), these folders are excluded from the commit process, and are only for development.

if you already have the project configured on your machine, you only need run the command npm install to add new dependencies;

if you have some trouble with the environment, you can open an issue;

Address data factory is based on https://github.com/jsdom/whatwg-url, which transforms the source file with some minor changes. In this project, I have added a rule to perform that changes. Just do:

npm run-script build
Javascript Environment

JavaScript code should be written in ES6. There are direct dependencies from nodejs and npm, these can be installed separately or in conjunction with nvm

dependencies:
  • nodejs
  • npm
  • karma - Make the communication between unit test tool and jenkins. See more on karma
  • mocha - Unit test tool. See more on http://mochajs.org
  • jspm - Don't need compile the code, it uses babel (or traucer or typescript) to run ES6 code on browser. Know more in jspm.io
  • gulp - Automate and enhance your workflow. See more about gulp on gulp
Code Style and Hinting

On the root directory you will find .jshintrc and .jscsrc, these files are helpers to maintain syntax consistency, it signals syntax mistakes and makes the code equal for all developers.

  • jscs - Maintain JavaScript Code Style
  • jshint - Detect errors and potential problems in JavaScript code.

All IDE's and Text Editors can handle these tools.

To generates api documentation you can run

gulp doc

Append to all files in src folder the license text;

Run the command:gulp license

To distribute the runtime-core, you can make a distribution file.

Run the command:gulp dist

To distribute the runtime-core, but with the source code maps, and to detect where is some error.

Run the command:gulp build

In this repository, we have some tasks which can help you. If you need change some resource file, like an Hyperty or ProtoStub, and load it to the Hyperties.json or ProtoStubs.json, run the following command, and answer to the questions;

gulp encode

you need to answer this questions: File to be converted? > resources/VertxProtoStub.js

Configuration file like an object or url to ProtoStub have on configuration: > something like: {"url":"wss://msg-node.localhost:9090/ws"} or only wss://msg-node.localhost:9090/ws

This will be a default file to be loaded? (yes/no) > yes or no

// TODO: optimize this to read if it is an hyperty or protocol stub;

If you need change some resource file, like an Hyperty, you need run this task first. This task will be covert ES6 to ES5 and encode the Hyperty file changes in a base64 file and add it to the descriptor folder in the respective place;

in your command line run:gulp watch-hyperty --dest=resources

if you need watch all changes on src folder and convert them to a dist file, run:

gulp watch

This will convert all the files from ES6 to ES5 and update the distribution file;

Unit Testing

Unit testing can be launched manually with karma start.

It's advisable to use expect.js instead of assert.

After investigate and testing the expect.js it don't support some features for ES6, because this tool hasn't activity at some time, that is why, it is recomended use the chaijs it is more versatile and have expect.js (but updated) and others tools that can be useful;

The address data factory can be tested independently by calling

cd <base folder>/test
mocha addressFactoryTest.js

to be moved to My First reTHINK Applications?

This repository have a folder with an working example of Hyperty Connector and we can send message and make a WebRTC call between remote hyperties through the vertx;

To run the demo on example folder: - this example have a dependecy from dev-msg-node-vertx and dev-registry-domain for communication between hyperties in two distinct browsers or tabs. At this moment you need run locally dev-msg-node-vertx and dev-registry-domain - you need, in the root folder, run command: npm start - in your browser, access to https://127.0.0.1:8080/example

This example works over https protocol, but since we are running in the 127.0.0.1, this address is considered secure and the webRTC will works well;

About

Development repository for the service framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.1%
  • HTML 1.9%