Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

futoin-invoker

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

futoin-invoker

FutoIn Invoker - Reference Implementation. Transparently and efficiently invoke remote or local service methods with strict API definition for Node and Browser

  • 0.8.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
100
increased by426.32%
Maintainers
1
Weekly downloads
 
Created
Source

NPM Version NPM Downloads Build Status stable

NPM

Stability: 3 - Stable

FutoIn reference implementation

Reference implementation of:

FTN7: FutoIn Invoker Concept
Version: 1.5

FTN3: FutoIn Interface Definition
Version: 1.3

FTN5: FutoIn HTTP integration
Version: 1.2

FTN9: FutoIn Interface - AuditLog
Version: 1.0 (client)

FTN14: FutoIn Cache
Version: 1.0 (client)

Web Site

About

FutoIn Invoker is a peer which initiates a request - invokes a FutoIn interface method as described in FTN3: FutoIn Interface Definition. It is not necessary a client - e.g. server may initiate request for event delivery to client.

The method can be implemented locally or remotely - it is transparent to invoking code. A similar concept can be found in CORBA and other more heavy request brokers.

Strict FutoIn interface (iface) definition and transport protocol is defined in FTN3 spec mentioned above. As it is based on JSON, both client and server can be implemented in a few minutes almost in any technology. However, Invoker and Executor concept provide significant benefits for efficiency, reliability and error control.

The core of invoker is CCM - Connection and Credentials Manager. It has the following advantages:

  • A single place to configure & hold sensitive data (like credentials)
  • Transparent connection management (no need for special connect/request/response/disconnect logic)
  • Efficient use of communications (keep-alive, persistent WebSockets channels, channel-based instead of message-based security, etc.)
  • Inversion of Control / Dependency Injection - implementations are referenced by static names like "mymodule.some.service" in code. The rest is hidden in CCM configuration.
  • Easy HMAC-based message signature and user authentication
  • Security enforcement

The primary communication channel is WebSockets. Large raw data upload and download is also supported through automatic fallback to HTTP(S).

SimpleCCM - a light version without heavy processing of iface definition (ideal for browser) AdvancedCCM - full featured CCM (extends SimpleCCM)

Communication methods:

  • HTTP/HTTPS - remote calls
  • WS/WSS - WebSockets remote calls with bi-directional sockets
  • HTML5 Web Messaging - same- and cross-origin local calls inside Browser through window.postMessage() API
  • Same Process - optimized for single instance deployment

Note: Invoker and Executor are platform/technology-neutral concepts. The implementation is already available in JS and PHP. Hopefully, others are upcoming

Installation for Node.js

Command line:

$ npm install futoin-invoker --save

All public classes can be accessed through module:

var AdvancedCCM = require('futoin-invoker').AdvancedCCM;

or included modular way, e.g.:

var AdvancedCCM = require('futoin-invoker/AdvancedCCM');

Installation for Browser

$ bower install futoin-invoker --save

Please note that browser build is available under in dist/ folder in sources generated with pure-sjc. It includes modular parts of lodash.

Note: there are the following globals available:

  • SimpleCCM - global reference to futoin-invoker.SimpleCCM class
  • AdvancedCCM - global reference to futoin-invoker.AdvancedCCM class
  • futoin.Invoker - global reference to futoin-invoker module

Examples

NOTE: more complex examples should be found in futoin-executor

Call remote function with SimpleCCM

var async_steps = require( 'futoin-asyncsteps' );
var SimpleCCM = require( 'futoin-invoker/SimpleCCM' );

// Initalize CCM, no configuration is required
var ccm = new SimpleCCM();

async_steps()
.add(
    function( as ){
        // Register interfaces without loading their specs
        ccm.register( as, 'localone', 'some.iface:1.0',
                      'https://localhost/some/path' );
        ccm.register( as, 'localtwo', 'other.iface:1.0',
                      'https://localhost/some/path',
                      'user:pass' ); // optional credentials

        as.add( function( as ){
            // Get NativeIface representation of remote interface
            // after registration is complete
            var localone = ccm.iface( 'localone' );
            var localtwo = ccm.iface( 'localtwo' );
            
            // SimpleCCM is not aware of available functions.
            // It is the only way to perform a call.
            localone.call( as, 'somefunc', {
                arg1 : 1,
                arg2 : 'abc',
                arg3 : true,
            } );
            
            as.add( function( as, res ){
                // As function prototype is not know
                // all invalid HTTP 200 responses may
                // get returned as "raw data" in res
                // parameter.
                console.log( res.result1, res.result2 );
            } );
        } );
    },
    function( as, err )
    {
        console.log( err + ': ' + as.state.error_info );
        console.log( as.state.last_exception.stack );
    }
)
.execute();

Call remote function with AdvancedCCM

var async_steps = require( 'futoin-asyncsteps' );
var invoker = require( 'futoin-invoker' );

// Define interface, which should normally be put into 
// file named "some.iface-1.0-iface.json" and put into
// a folder added to the "specDirs" option.
var some_iface_v1_0 = {
    "iface" : "some.iface",
    "version" : "1.0",
    "ftn3rev" : "1.1",
    "funcs" : {
        "somefunc" : {
            "params" : {
                "arg1" : {
                    "type" : "integer"
                },
                "arg2" : {
                    "type" : "string"
                },
                "arg3" : {
                    "type" : "boolean"
                }
            },
            "result" : {
                "result1" : {
                    "type" : "number"
                },
                "result2" : {
                    "type" : "any"
                }
            },
            "throws" : [
                "MyError"
            ]
        }
    },
    "requires" : [
        "SecureChannel",
        "AllowAnonymous"
    ]
};

var other_iface_v1_0 = {
    "iface" : "other.iface",
    "version" : "1.0",
    "ftn3rev" : "1.1"
}

// Initialize CCM. We provide interface definitions directly
var ccm = new invoker.AdvancedCCM({
    specDirs : [ __dirname + '/specs', some_iface_v1_0, other_iface_v1_0 ]
});

// AsyncSteps processing is required
async_steps()
.add(
    function( as ){
        // Register interfaces - it is done only once
        ccm.register( as, 'localone',
                      'some.iface:1.0', 'https://localhost/some/path' );
        ccm.register( as, 'localtwo',
                      'other.iface:1.0', 'https://localhost/some/path',
                      'user:pass' ); // optional credentials

        as.add( function( as ){
            // Get NativeIface representation of remote interface
            // after registration is complete
            var localone = ccm.iface( 'localone' );
            var localtwo = ccm.iface( 'localtwo' );
            
            localone.somefunc( as, 1, 'abc', true );
            
            as.add( function( as, res ){
                console.log( res.result1, res.result2 );
            } );
        } );
    },
    function( as, err )
    {
        console.log( err + ': ' + as.state.error_info );
        console.log( as.state.last_exception.stack );
    }
)
.execute();

API documentation

The concept is described in FutoIn specification: FTN7: Interface Invoker Concept v1.x

Modules

futoin-invoker

Classes

AdvancedCCMSimpleCCM
CacheFaceNativeIface
InterfaceInfo
LogFaceNativeIface
NativeIface
SimpleCCM
SpecTools
AdvancedCCMOptionsSimpleCCMOptions
SimpleCCMOptions

Members

SimpleCCM

window.SimpleCCM - Browser-only reference to futoin-asyncsteps.SimpleCCM

AdvancedCCM

window.AdvancedCCM - Browser-only reference to futoin-asyncsteps.AdvancedCCM

Invoker

futoin.Invoker - Browser-only reference to futoin-invoker module

FutoInInvoker

window.FutoInInvoker - Browser-only reference to futoin-invoker module

SimpleCCM

window.SimpleCCM - Browser-only reference to futoin-asyncsteps.SimpleCCM

futoin-invoker

AdvancedCCM ⇐ SimpleCCM

Kind: global class
Extends: SimpleCCM
Link: http://specs.futoin.org/final/preview/ftn7_iface_invoker_concept-1.html
See: AdvancedCCMOptions

new AdvancedCCM(options)

Advanced CCM - Reference Implementation

ParamTypeDescription
optionsobjectsee AdvancedCCMOptions

advancedCCM.register(as, name, ifacever, endpoint, [credentials], [options])

Register standard MasterService end-point (adds steps to as)

Kind: instance method of AdvancedCCM
Emits: register

ParamTypeDescription
asAsyncStepsAsyncSteps instance as registration may be waiting for external resources
namestringunique identifier in scope of CCM instance
ifaceverstringinterface identifier and its version separated by colon
endpointstringURI OR any other resource identifier of function( ccmimpl, info ) returning iface implementing peer, accepted by CCM implementation OR instance of Executor
[credentials]stringoptional, authentication credentials: 'master' - enable MasterService authentication logic (Advanced CCM only) '{user}:{clear-text-password}' - send as is in the 'sec' section NOTE: some more reserved words and/or patterns can appear in the future
[options]objectfine tune global CCM options per endpoint

advancedCCM.iface(name) ⇒ NativeInterface

Get native interface wrapper for invocation of iface methods

Kind: instance method of AdvancedCCM
Returns: NativeInterface - - native interface

ParamTypeDescription
namestringsee register()

advancedCCM.unRegister(name)

Unregister previously registered interface (should not be used, unless really needed)

Kind: instance method of AdvancedCCM
Emits: unregister

ParamTypeDescription
namestringsee register()

advancedCCM.defense()

Shortcut to iface( "#defense" )

Kind: instance method of AdvancedCCM

advancedCCM.log() ⇒ object

Returns extended API interface as defined in FTN9 IF AuditLogService

Kind: instance method of AdvancedCCM

advancedCCM.cache() ⇒ object

Returns extended API interface as defined in [FTN14 Cache][]

Kind: instance method of AdvancedCCM

advancedCCM.assertIface(name, ifacever)

Assert that interface registered by name matches major version and minor is not less than required. This function must generate fatal error and forbid any further execution

Kind: instance method of AdvancedCCM

ParamTypeDescription
namestringunique identifier in scope of CCM instance
ifaceverstringinterface identifier and its version separated by colon

advancedCCM.alias(name, alias)

Alias interface name with another name

Kind: instance method of AdvancedCCM
Emits: register

ParamTypeDescription
namestringunique identifier in scope of CCM instance
aliasstringalternative name for registered interface

advancedCCM.close()

Shutdown CCM (close all active comms)

Kind: instance method of AdvancedCCM
Emits: close

"register"

CCM regiser event. Fired on new interface registration. ( name, ifacever, info )

Kind: event emitted by AdvancedCCM

"unregister"

CCM regiser event. Fired on interface unregistration. ( name, info )

Kind: event emitted by AdvancedCCM

"close"

CCM close event. Fired on CCM shutdown.

Kind: event emitted by AdvancedCCM

CacheFace ⇐ NativeIface

Kind: global class
Extends: NativeIface

new CacheFace()

Cache Native interface

Register with CacheFace.register()

NOTE: it is not directly available in Invoker module interface, include separately

cacheFace.getOrSet(as, key_prefix, callable, params, ttl_ms)

Get or Set cached value

NOTE: the actual cache key is formed with concatenation of key_prefix and join of params values

Kind: instance method of CacheFace

ParamTypeDescription
asAsyncSteps
key_prefixstringunique key prefix
callablefunctionfunc( as, params.. ) - a callable which is called to generated value on cache miss
paramsArrayparameters to be passed to callable
ttl_msintegertime to live in ms to use, if value is set on cache miss

cacheFace.call(as, name, params, upload_data, [download_stream], [timeout])

Generic FutoIn function call interface Result is passed through AsyncSteps.success() as a map.

Kind: instance method of CacheFace

ParamTypeDescription
asAsyncStepsAsyncSteps object
namestringFutoIn iface function name
paramsobjectmap of func parameters
upload_datastring | stream.Readableraw upload data or input stram
[download_stream]stream.Writableoutput stream for raw download data
[timeout]intif provided, overrides the default. <=0 - disables timeout

cacheFace.ifaceInfo() ⇒ object

Get interface info

Kind: instance method of CacheFace

cacheFace.bindDerivedKey()

Results with DerivedKeyAccessor through as.success()

Kind: instance method of CacheFace

"connect"

Fired when interface establishes connection.

Kind: event emitted by CacheFace

"disconnect"

Fired when interface connection is closed.

Kind: event emitted by CacheFace

"close"

Interface close event. Fired on interface unregistration.

Kind: event emitted by CacheFace

"commError"

Interface communication error. Fired during call processing. ( error_info, rawreq )

Kind: event emitted by CacheFace

CacheFace.ifacespec

Embedded spec for FutoIn CacheFace

Kind: static property of CacheFace

CacheFace.register()

Cache Native interface registration helper

Kind: static method of CacheFace

InterfaceInfo

Kind: global class

new InterfaceInfo()

FutoIn interface info

interfaceInfo.name() ⇒ string

Get FutoIn interface type

Kind: instance method of InterfaceInfo

interfaceInfo.version() ⇒ string

Get FutoIn interface version

Kind: instance method of InterfaceInfo

interfaceInfo.inherits() ⇒ object

Get list of inherited interfaces starting from the most derived, may be null

Kind: instance method of InterfaceInfo

interfaceInfo.funcs() ⇒ object

Get list of available functions, may be null

Kind: instance method of InterfaceInfo

interfaceInfo.constraints() ⇒ object

Get list of interface constraints, may be null

Kind: instance method of InterfaceInfo

LogFace ⇐ NativeIface

Kind: global class
Extends: NativeIface

new LogFace()

AuditLog Native interface

Register with LogFace.register().

NOTE: it is not directly available Invoker module interface, include separately

logFace.msg(lvl, txt)

Log message

Kind: instance method of LogFace

ParamTypeDescription
lvlstringdebug
txtstringmessage to log

logFace.hexdump(lvl, txt, data)

Log message

Kind: instance method of LogFace

ParamTypeDescription
lvlstringdebug
txtstringmessage to log
datastringraw data

logFace.debug(txt)

Log message in debug level

Kind: instance method of LogFace

ParamTypeDescription
txtstringmessage to log

logFace.info(txt)

Log message in info level

Kind: instance method of LogFace

ParamTypeDescription
txtstringmessage to log

logFace.warn(txt)

Log message in warn level

Kind: instance method of LogFace

ParamTypeDescription
txtstringmessage to log

logFace.error(txt)

Log message in error level

Kind: instance method of LogFace

ParamTypeDescription
txtstringmessage to log

logFace.security(txt)

Log message in security level

Kind: instance method of LogFace

ParamTypeDescription
txtstringmessage to log

logFace.call(as, name, params, upload_data, [download_stream], [timeout])

Generic FutoIn function call interface Result is passed through AsyncSteps.success() as a map.

Kind: instance method of LogFace

ParamTypeDescription
asAsyncStepsAsyncSteps object
namestringFutoIn iface function name
paramsobjectmap of func parameters
upload_datastring | stream.Readableraw upload data or input stram
[download_stream]stream.Writableoutput stream for raw download data
[timeout]intif provided, overrides the default. <=0 - disables timeout

logFace.ifaceInfo() ⇒ object

Get interface info

Kind: instance method of LogFace

logFace.bindDerivedKey()

Results with DerivedKeyAccessor through as.success()

Kind: instance method of LogFace

"connect"

Fired when interface establishes connection.

Kind: event emitted by LogFace

"disconnect"

Fired when interface connection is closed.

Kind: event emitted by LogFace

"close"

Interface close event. Fired on interface unregistration.

Kind: event emitted by LogFace

"commError"

Interface communication error. Fired during call processing. ( error_info, rawreq )

Kind: event emitted by LogFace

LogFace.ifacespec

Embedded spec for FutoIn LogFace

Kind: static property of LogFace

LogFace.LVL_DEBUG

Debug log level

Kind: static constant of LogFace

LogFace.LVL_INFO

Info log level

Kind: static constant of LogFace

LogFace.LVL_WARN

Warn log level

Kind: static constant of LogFace

LogFace.LVL_ERROR

Error log level

Kind: static constant of LogFace

LogFace.LVL_SECURITY

Security log level

Kind: static constant of LogFace

LogFace.register()

AuditLog Native interface registration helper

Kind: static method of LogFace

NativeIface

Kind: global class

new NativeIface()

Native Interface for FutoIn ifaces

nativeIface.call(as, name, params, upload_data, [download_stream], [timeout])

Generic FutoIn function call interface Result is passed through AsyncSteps.success() as a map.

Kind: instance method of NativeIface

ParamTypeDescription
asAsyncStepsAsyncSteps object
namestringFutoIn iface function name
paramsobjectmap of func parameters
upload_datastring | stream.Readableraw upload data or input stram
[download_stream]stream.Writableoutput stream for raw download data
[timeout]intif provided, overrides the default. <=0 - disables timeout

nativeIface.ifaceInfo() ⇒ object

Get interface info

Kind: instance method of NativeIface

nativeIface.bindDerivedKey()

Results with DerivedKeyAccessor through as.success()

Kind: instance method of NativeIface

"connect"

Fired when interface establishes connection.

Kind: event emitted by NativeIface

"disconnect"

Fired when interface connection is closed.

Kind: event emitted by NativeIface

"close"

Interface close event. Fired on interface unregistration.

Kind: event emitted by NativeIface

"commError"

Interface communication error. Fired during call processing. ( error_info, rawreq )

Kind: event emitted by NativeIface

SimpleCCM

Kind: global class
Link: http://specs.futoin.org/final/preview/ftn7_iface_invoker_concept-1.html
See: SimpleCCMOptions

new SimpleCCM([options])

Simple CCM - Reference Implementation

Base Connection and Credentials Manager with limited error control

ParamTypeDescription
[options]objectmap of options

simpleCCM.register(as, name, ifacever, endpoint, [credentials], [options])

Register standard MasterService end-point (adds steps to as)

Kind: instance method of SimpleCCM
Emits: register

ParamTypeDescription
asAsyncStepsAsyncSteps instance as registration may be waiting for external resources
namestringunique identifier in scope of CCM instance
ifaceverstringinterface identifier and its version separated by colon
endpointstringURI OR any other resource identifier of function( ccmimpl, info ) returning iface implementing peer, accepted by CCM implementation OR instance of Executor
[credentials]stringoptional, authentication credentials: 'master' - enable MasterService authentication logic (Advanced CCM only) '{user}:{clear-text-password}' - send as is in the 'sec' section NOTE: some more reserved words and/or patterns can appear in the future
[options]objectfine tune global CCM options per endpoint

simpleCCM.iface(name) ⇒ NativeInterface

Get native interface wrapper for invocation of iface methods

Kind: instance method of SimpleCCM
Returns: NativeInterface - - native interface

ParamTypeDescription
namestringsee register()

simpleCCM.unRegister(name)

Unregister previously registered interface (should not be used, unless really needed)

Kind: instance method of SimpleCCM
Emits: unregister

ParamTypeDescription
namestringsee register()

simpleCCM.defense()

Shortcut to iface( "#defense" )

Kind: instance method of SimpleCCM

simpleCCM.log() ⇒ object

Returns extended API interface as defined in FTN9 IF AuditLogService

Kind: instance method of SimpleCCM

simpleCCM.cache() ⇒ object

Returns extended API interface as defined in [FTN14 Cache][]

Kind: instance method of SimpleCCM

simpleCCM.assertIface(name, ifacever)

Assert that interface registered by name matches major version and minor is not less than required. This function must generate fatal error and forbid any further execution

Kind: instance method of SimpleCCM

ParamTypeDescription
namestringunique identifier in scope of CCM instance
ifaceverstringinterface identifier and its version separated by colon

simpleCCM.alias(name, alias)

Alias interface name with another name

Kind: instance method of SimpleCCM
Emits: register

ParamTypeDescription
namestringunique identifier in scope of CCM instance
aliasstringalternative name for registered interface

simpleCCM.close()

Shutdown CCM (close all active comms)

Kind: instance method of SimpleCCM
Emits: close

"register"

CCM regiser event. Fired on new interface registration. ( name, ifacever, info )

Kind: event emitted by SimpleCCM

"unregister"

CCM regiser event. Fired on interface unregistration. ( name, info )

Kind: event emitted by SimpleCCM

"close"

CCM close event. Fired on CCM shutdown.

Kind: event emitted by SimpleCCM

SimpleCCM.SAFE_PAYLOAD_LIMIT

Maximum FutoIn message payload size (not related to raw data)

Kind: static constant of SimpleCCM
Default: 65536

SimpleCCM.SVC_RESOLVER

Runtime iface resolution v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_AUTH

AuthService v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_DEFENSE

Defense system v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_ACL

Access Control system v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_LOG

Audit Logging v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_CACHE_

cache v1.x iface name prefix

Kind: static constant of SimpleCCM

SpecTools

Kind: global class

new spectools()

SpecTools

SpecTools.standard_errors

Enumeration of standard errors

Kind: static constant of SpecTools

SpecTools.loadIface(as, info, specdirs, [load_cache])

Load FutoIn iface definition.

NOTE: Browser uses XHR to load specs, Node.js searches in local fs.

Kind: static method of SpecTools

ParamTypeDescription
asAsyncSteps
infoObjectdestination object with "iface" and "version" fields already set
specdirsArrayeach element - search path/url (string) or raw iface (object)
[load_cache]Objectarbitrary object to use for caching

SpecTools.parseIface(as, info, specdirs, raw_spec)

Parse raw futoin spec (preloaded)

Kind: static method of SpecTools

ParamTypeDescription
asAsyncSteps
infoObjectdestination object with "iface" and "version" fields already set
specdirsArrayeach element - search path/url (string) or raw iface (object)
raw_specObjectiface definition object

SpecTools.checkConsistency(as, info)

Deeply check consistency of loaded interface.

NOTE: not yet implemented

Kind: static method of SpecTools

ParamTypeDescription
asAsyncSteps
infoObjectpreviously loaded iface

SpecTools.checkType(info, type, val) ⇒ Boolean

Check if value matches required type

Kind: static method of SpecTools

ParamTypeDescription
infoObjectpreviously loaded iface
typestringstandard or custom iface type
val*value to check

SpecTools.checkParameterType(info, funcname, varname, value)

Check if parameter value matches required type

Kind: static method of SpecTools

ParamTypeDescription
infoObjectpreviously loaded iface
funcnamestringfunction name
varnamestringparameter name
value*value to check

SpecTools.checkResultType(as, info, funcname, varname, value)

Check if result value matches required type

Kind: static method of SpecTools

ParamTypeDescription
asAsyncSteps
infoObjectpreviously loaded iface
funcnamestringfunction name
varnamestringresult variable name
value*value to check

SpecTools.genHMAC(as, info, ftnreq) ⇒ Buffer

Generate HMAC

NOTE: for simplicity, 'sec' field must not be present

Kind: static method of SpecTools
Returns: Buffer - Binary HMAC signature

ParamTypeDescription
asAsyncSteps
infoobjectInterface raw info object
ftnreqobjectRequest Object

AdvancedCCMOptions ⇐ SimpleCCMOptions

Kind: global class
Extends: SimpleCCMOptions

new AdvancedCCMOptions()

This is a pseudo-class for documentation purposes

NOTE: Each option can be set on global level and overriden per interface.

AdvancedCCMOptions.specDirs

Search dirs for spec definition or spec instance directly. It can be single value or array of values. Each value is either path/URL (string) or iface spec instance (object).

Kind: static property of AdvancedCCMOptions
Default: []

AdvancedCCMOptions.hmacKey

Base64 encoded key for HMAC generation. See FTN6/FTN7

Kind: static property of AdvancedCCMOptions

AdvancedCCMOptions.hmacAlgo

Hash algorithm for HMAC generation: MD5(default), SHA224, SHA256, SHA384, SHA256

Kind: static property of AdvancedCCMOptions
Default: MD5

AdvancedCCMOptions.sendOnBehalfOf

Send "obf" (On Behalf Of) user information as defined in FTN3 v1.3 when invoked from Executor's request processing task

Kind: static property of AdvancedCCMOptions
Default: true

SimpleCCMOptions

Kind: global class

new SimpleCCMOptions()

This is a pseudo-class for documentation purposes.

NOTE: Each option can be set on global level and overriden per interface.

SimpleCCMOptions.callTimeoutMS

Overall call timeout (int)

Kind: static property of SimpleCCMOptions
Default: 3000

SimpleCCMOptions.prodMode

Production mode - disables some checks without compomising security

Kind: static property of SimpleCCMOptions
Default: false

SimpleCCMOptions.commConfigCallback

Communication configuration callback( type, specific-args )

Kind: static property of SimpleCCMOptions
Default:

SimpleCCMOptions.executor

Client-side executor for bi-directional communication channels

Kind: static property of SimpleCCMOptions

SimpleCCMOptions.targetOrigin

browser-only. Origin of target for window.postMessage()

Kind: static property of SimpleCCMOptions

SimpleCCMOptions.retryCount

How many times to retry the call on CommError. NOTE: actual attempt count is retryCount + 1

Kind: static property of SimpleCCMOptions
Default: 1

SimpleCCMOptions.messageSniffer()

Message sniffer callback( iface_info, msg, is_incomming ). Useful for audit logging.

Kind: static method of SimpleCCMOptions
Default: dummy

SimpleCCMOptions.disconnectSniffer()

Bi-directional channel disconnect sniffer callback( iface_info ). Useful for audit logging.

Kind: static method of SimpleCCMOptions
Default: dummy

SimpleCCM

window.SimpleCCM - Browser-only reference to futoin-asyncsteps.SimpleCCM

Kind: global variable

new SimpleCCM([options])

Simple CCM - Reference Implementation

Base Connection and Credentials Manager with limited error control

ParamTypeDescription
[options]objectmap of options

simpleCCM.register(as, name, ifacever, endpoint, [credentials], [options])

Register standard MasterService end-point (adds steps to as)

Kind: instance method of SimpleCCM
Emits: register

ParamTypeDescription
asAsyncStepsAsyncSteps instance as registration may be waiting for external resources
namestringunique identifier in scope of CCM instance
ifaceverstringinterface identifier and its version separated by colon
endpointstringURI OR any other resource identifier of function( ccmimpl, info ) returning iface implementing peer, accepted by CCM implementation OR instance of Executor
[credentials]stringoptional, authentication credentials: 'master' - enable MasterService authentication logic (Advanced CCM only) '{user}:{clear-text-password}' - send as is in the 'sec' section NOTE: some more reserved words and/or patterns can appear in the future
[options]objectfine tune global CCM options per endpoint

simpleCCM.iface(name) ⇒ NativeInterface

Get native interface wrapper for invocation of iface methods

Kind: instance method of SimpleCCM
Returns: NativeInterface - - native interface

ParamTypeDescription
namestringsee register()

simpleCCM.unRegister(name)

Unregister previously registered interface (should not be used, unless really needed)

Kind: instance method of SimpleCCM
Emits: unregister

ParamTypeDescription
namestringsee register()

simpleCCM.defense()

Shortcut to iface( "#defense" )

Kind: instance method of SimpleCCM

simpleCCM.log() ⇒ object

Returns extended API interface as defined in FTN9 IF AuditLogService

Kind: instance method of SimpleCCM

simpleCCM.cache() ⇒ object

Returns extended API interface as defined in [FTN14 Cache][]

Kind: instance method of SimpleCCM

simpleCCM.assertIface(name, ifacever)

Assert that interface registered by name matches major version and minor is not less than required. This function must generate fatal error and forbid any further execution

Kind: instance method of SimpleCCM

ParamTypeDescription
namestringunique identifier in scope of CCM instance
ifaceverstringinterface identifier and its version separated by colon

simpleCCM.alias(name, alias)

Alias interface name with another name

Kind: instance method of SimpleCCM
Emits: register

ParamTypeDescription
namestringunique identifier in scope of CCM instance
aliasstringalternative name for registered interface

simpleCCM.close()

Shutdown CCM (close all active comms)

Kind: instance method of SimpleCCM
Emits: close

"register"

CCM regiser event. Fired on new interface registration. ( name, ifacever, info )

Kind: event emitted by SimpleCCM

"unregister"

CCM regiser event. Fired on interface unregistration. ( name, info )

Kind: event emitted by SimpleCCM

"close"

CCM close event. Fired on CCM shutdown.

Kind: event emitted by SimpleCCM

SimpleCCM.SAFE_PAYLOAD_LIMIT

Maximum FutoIn message payload size (not related to raw data)

Kind: static constant of SimpleCCM
Default: 65536

SimpleCCM.SVC_RESOLVER

Runtime iface resolution v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_AUTH

AuthService v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_DEFENSE

Defense system v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_ACL

Access Control system v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_LOG

Audit Logging v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_CACHE_

cache v1.x iface name prefix

Kind: static constant of SimpleCCM

AdvancedCCM

window.AdvancedCCM - Browser-only reference to futoin-asyncsteps.AdvancedCCM

Kind: global variable

new AdvancedCCM(options)

Advanced CCM - Reference Implementation

ParamTypeDescription
optionsobjectsee AdvancedCCMOptions

advancedCCM.register(as, name, ifacever, endpoint, [credentials], [options])

Register standard MasterService end-point (adds steps to as)

Kind: instance method of AdvancedCCM
Emits: register

ParamTypeDescription
asAsyncStepsAsyncSteps instance as registration may be waiting for external resources
namestringunique identifier in scope of CCM instance
ifaceverstringinterface identifier and its version separated by colon
endpointstringURI OR any other resource identifier of function( ccmimpl, info ) returning iface implementing peer, accepted by CCM implementation OR instance of Executor
[credentials]stringoptional, authentication credentials: 'master' - enable MasterService authentication logic (Advanced CCM only) '{user}:{clear-text-password}' - send as is in the 'sec' section NOTE: some more reserved words and/or patterns can appear in the future
[options]objectfine tune global CCM options per endpoint

advancedCCM.iface(name) ⇒ NativeInterface

Get native interface wrapper for invocation of iface methods

Kind: instance method of AdvancedCCM
Returns: NativeInterface - - native interface

ParamTypeDescription
namestringsee register()

advancedCCM.unRegister(name)

Unregister previously registered interface (should not be used, unless really needed)

Kind: instance method of AdvancedCCM
Emits: unregister

ParamTypeDescription
namestringsee register()

advancedCCM.defense()

Shortcut to iface( "#defense" )

Kind: instance method of AdvancedCCM

advancedCCM.log() ⇒ object

Returns extended API interface as defined in FTN9 IF AuditLogService

Kind: instance method of AdvancedCCM

advancedCCM.cache() ⇒ object

Returns extended API interface as defined in [FTN14 Cache][]

Kind: instance method of AdvancedCCM

advancedCCM.assertIface(name, ifacever)

Assert that interface registered by name matches major version and minor is not less than required. This function must generate fatal error and forbid any further execution

Kind: instance method of AdvancedCCM

ParamTypeDescription
namestringunique identifier in scope of CCM instance
ifaceverstringinterface identifier and its version separated by colon

advancedCCM.alias(name, alias)

Alias interface name with another name

Kind: instance method of AdvancedCCM
Emits: register

ParamTypeDescription
namestringunique identifier in scope of CCM instance
aliasstringalternative name for registered interface

advancedCCM.close()

Shutdown CCM (close all active comms)

Kind: instance method of AdvancedCCM
Emits: close

"register"

CCM regiser event. Fired on new interface registration. ( name, ifacever, info )

Kind: event emitted by AdvancedCCM

"unregister"

CCM regiser event. Fired on interface unregistration. ( name, info )

Kind: event emitted by AdvancedCCM

"close"

CCM close event. Fired on CCM shutdown.

Kind: event emitted by AdvancedCCM

Invoker

futoin.Invoker - Browser-only reference to futoin-invoker module

Kind: global variable

FutoInInvoker

window.FutoInInvoker - Browser-only reference to futoin-invoker module

Kind: global variable

SimpleCCM

window.SimpleCCM - Browser-only reference to futoin-asyncsteps.SimpleCCM

Kind: global variable

new SimpleCCM([options])

Simple CCM - Reference Implementation

Base Connection and Credentials Manager with limited error control

ParamTypeDescription
[options]objectmap of options

simpleCCM.register(as, name, ifacever, endpoint, [credentials], [options])

Register standard MasterService end-point (adds steps to as)

Kind: instance method of SimpleCCM
Emits: register

ParamTypeDescription
asAsyncStepsAsyncSteps instance as registration may be waiting for external resources
namestringunique identifier in scope of CCM instance
ifaceverstringinterface identifier and its version separated by colon
endpointstringURI OR any other resource identifier of function( ccmimpl, info ) returning iface implementing peer, accepted by CCM implementation OR instance of Executor
[credentials]stringoptional, authentication credentials: 'master' - enable MasterService authentication logic (Advanced CCM only) '{user}:{clear-text-password}' - send as is in the 'sec' section NOTE: some more reserved words and/or patterns can appear in the future
[options]objectfine tune global CCM options per endpoint

simpleCCM.iface(name) ⇒ NativeInterface

Get native interface wrapper for invocation of iface methods

Kind: instance method of SimpleCCM
Returns: NativeInterface - - native interface

ParamTypeDescription
namestringsee register()

simpleCCM.unRegister(name)

Unregister previously registered interface (should not be used, unless really needed)

Kind: instance method of SimpleCCM
Emits: unregister

ParamTypeDescription
namestringsee register()

simpleCCM.defense()

Shortcut to iface( "#defense" )

Kind: instance method of SimpleCCM

simpleCCM.log() ⇒ object

Returns extended API interface as defined in FTN9 IF AuditLogService

Kind: instance method of SimpleCCM

simpleCCM.cache() ⇒ object

Returns extended API interface as defined in [FTN14 Cache][]

Kind: instance method of SimpleCCM

simpleCCM.assertIface(name, ifacever)

Assert that interface registered by name matches major version and minor is not less than required. This function must generate fatal error and forbid any further execution

Kind: instance method of SimpleCCM

ParamTypeDescription
namestringunique identifier in scope of CCM instance
ifaceverstringinterface identifier and its version separated by colon

simpleCCM.alias(name, alias)

Alias interface name with another name

Kind: instance method of SimpleCCM
Emits: register

ParamTypeDescription
namestringunique identifier in scope of CCM instance
aliasstringalternative name for registered interface

simpleCCM.close()

Shutdown CCM (close all active comms)

Kind: instance method of SimpleCCM
Emits: close

"register"

CCM regiser event. Fired on new interface registration. ( name, ifacever, info )

Kind: event emitted by SimpleCCM

"unregister"

CCM regiser event. Fired on interface unregistration. ( name, info )

Kind: event emitted by SimpleCCM

"close"

CCM close event. Fired on CCM shutdown.

Kind: event emitted by SimpleCCM

SimpleCCM.SAFE_PAYLOAD_LIMIT

Maximum FutoIn message payload size (not related to raw data)

Kind: static constant of SimpleCCM
Default: 65536

SimpleCCM.SVC_RESOLVER

Runtime iface resolution v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_AUTH

AuthService v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_DEFENSE

Defense system v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_ACL

Access Control system v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_LOG

Audit Logging v1.x

Kind: static constant of SimpleCCM

SimpleCCM.SVC_CACHE_

cache v1.x iface name prefix

Kind: static constant of SimpleCCM

documented by jsdoc-to-markdown.

Keywords

FAQs

Package last updated on 06 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc