Code:
exports.stratified = function(namespace, descriptor) {
    try {
        var _d = eval(descriptor);
        var _n = eval(namespace);
        var _a = _d['actions'];

        console.log(_n);

        for (action in _a) {
            
            exports[action] = {}

            for (fnc in _a[action]) {
                var name = _a[action][fnc].name, // function name
                    params = [], 
                    len = _a[action][fnc].len; // parameter count

                exports[action][name] = {};

                // create parameters
                //
                for (var i = 0; i < len; i++) params.push('_'+i);

                // create syntax
                //
                var sfn = [
                    '(function(){ return function(', params.join(', '), '){',
                        'var res = null; ',
                        'waitfor() { ',
                            'var r = resume;',
                            namespace, '.', action, '.', name, 
                                '(', (params.length>0?(params.join(', ')+', '):''), 'function(sr){ res = sr; r(); }); ',
                        '}',
                        'return res; ',
                    '} })();',
                ].join('');

                //console.log(sfn);
                
                var js = __oni_rt.c1.compile(sfn, { filename: "DirectSyncConvertCode" });
                exports[action][name] = __oni_rt.G.eval(js);
            }
        }

        return this;
    } 
    catch(e) 
    {
        console.error(e);
        /* Do nothing! */
    }
};
USAGE:

Code:
    var sRPC = require('utils/rpc').stratified('RPC.Api', 'RPC.Descriptor');
    console.log("Server Time: " + sRPC.Server.date('y-m-d G:i a'));
EXTDIRECT OUTPUT:

Code:
Ext.namespace( 'RPC.Api' );
RPC.Descriptor = {"url":"\/App\/public\/direct","type":"remoting","namespace":"RPC.Api","descriptor":"RPC.Descriptor","actions":{"Server":[{"name":"date","len":1}],"User":[{"name":"login","len":2}]}};
Ext.Direct.addProvider( RPC.Descriptor );