{"size": 1130, "ext": "js", "max_stars_repo_path": "examples/example_client.js", "max_stars_repo_name": "futoin/core-js-ri-executor", "max_stars_repo_stars_event_min_datetime": "2022-02-10T05:13:03.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-10T05:13:03.000Z", "max_issues_repo_path": "examples/example_client.js", "max_issues_repo_name": "futoin/core-js-ri-executor", "max_issues_repo_issues_event_min_datetime": "2015-01-04T15:00:58.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T04:53:57.000Z", "max_forks_repo_path": "examples/example_client.js", "max_forks_repo_name": "futoin/core-js-ri-executor", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 43, "max_forks_count": null, "avg_line_length": 26.2790697674, "max_line_length": 84, "alphanum_fraction": 0.5345132743}
var async_steps = require( 'futoin-asyncsteps' );
var AdvancedCCM = require( 'futoin-invoker/AdvancedCCM' );

var ccm = new AdvancedCCM( { specDirs : [ __dirname ] } );

async_steps()
// Do it once for program's entire life time
.add(
    function( as )
    {
        // Register interface and endpoint
        ccm.register( as, 'myservice',
                      'org.example.service:1.0',
                      'http://localhost:3000/api/' );
    },
    function( as, err )
    {
        console.log( err + ': ' + as.state.error_info );
        console.log( as.state.last_exception.stack );
    }
)
// Regular service call
.add(
    function( as )
    {
        var myservice = ccm.iface( 'myservice' );
        
        // equal to myservice.call( as, 'getProgress', { progress: 'MyResource' } );
        myservice.getProgress( as, 'MyResource' );
        
        as.add( function( as, res ){
            // Use result
            console.log( 'Progress: ' + res.progress );
        } );
    },
    function( as, err )
    {
        // Handle error
        console.log( err + ': ' + as.state.error_info );
    }
)
.execute();
