Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 1x 2x 2x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x | import { Remotable } from "./remotable";
export function inlineRemotable<T>(object: T): T {
@Remotable() class InlineRemotable {}
let instance = <any> new InlineRemotable();
for (let key of Object.keys(object)) {
if (typeof object[key] !== 'function')
continue;
Reflect.defineMetadata('rpc:type', 'call', InlineRemotable.prototype, key);
instance[key] = (...args) => {
let result = object[key](...args);
if (result instanceof Promise)
return result;
return Promise.resolve();
}
}
return instance;
}
/**
* Instruct Conduit to allow all method calls and event subscriptions on
* the given object. This is useful when creating custom proxies, as well
* as when passing an object from one RPC session to another (ie relaying).
* @param object
* @returns
*/
export function bypassSecurityAllowAllCalls<T>(object: T): T {
Reflect.defineMetadata('rpc:allow-all-calls', true, object);
return object;
} |