Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static initializeRpcBackend() {
if (TestbedConfig.useDirect) {
// N/A -- only for testing code within frontend bundle
} else if (TestbedConfig.useIPC) {
ElectronRpcManager.initializeImpl({}, TestbedConfig.rpcInterfaces);
} else {
TestbedConfig.cloudRpc = BentleyCloudRpcManager.initializeImpl(TestbedConfig.cloudRpcParams, TestbedConfig.rpcInterfaces);
TestbedConfig.initializeBentleyCloudCommon();
}
ElectronRpcManager.initializeImpl({}, [TestRpcInterface3]);
// RPC transport testing
RpcManager.registerImpl(RpcWebTransportTest, RpcTransportTestImpl);
RpcManager.registerImpl(RpcElectronTransportTest, RpcTransportTestImpl);
RpcManager.registerImpl(RpcMobileTransportTest, RpcTransportTestImpl);
BentleyCloudRpcManager.initializeImpl(TestbedConfig.cloudRpcParams, [RpcWebTransportTest]);
ElectronRpcManager.initializeImpl({}, [RpcElectronTransportTest]);
MobileRpcManager.initializeImpl([RpcMobileTransportTest]);
}
TestbedConfig.initializeBentleyCloudCommon();
}
ElectronRpcManager.initializeClient({}, [TestRpcInterface3]);
// RPC transport testing
window.location.hash = TestbedConfig.mobilePort.toString();
const webClient = BentleyCloudRpcManager.initializeClient(TestbedConfig.cloudRpcParams, [RpcWebTransportTest]);
webClient.protocol.pathPrefix = TestbedConfig.localServerUrlPrefix;
RpcOperation.forEach(RpcWebTransportTest, (operation) => operation.policy.token = (_request) => new IModelToken("test", "test", "test", "test", OpenMode.Readonly));
ElectronRpcManager.initializeClient({}, [RpcElectronTransportTest]);
RpcManager.initializeInterface(RpcDirectTransportTest);
RpcManager.registerImpl(RpcDirectTransportTest, RpcTransportTestImpl);
MobileRpcManager.initializeClient([RpcMobileTransportTest]);
}
public static initializeRpcBackend() {
if (TestbedConfig.useDirect) {
// N/A -- only for testing code within frontend bundle
} else if (TestbedConfig.useIPC) {
ElectronRpcManager.initializeImpl({}, TestbedConfig.rpcInterfaces);
} else {
TestbedConfig.cloudRpc = BentleyCloudRpcManager.initializeImpl(TestbedConfig.cloudRpcParams, TestbedConfig.rpcInterfaces);
TestbedConfig.initializeBentleyCloudCommon();
}
ElectronRpcManager.initializeImpl({}, [TestRpcInterface3]);
// RPC transport testing
RpcManager.registerImpl(RpcWebTransportTest, RpcTransportTestImpl);
RpcManager.registerImpl(RpcElectronTransportTest, RpcTransportTestImpl);
RpcManager.registerImpl(RpcMobileTransportTest, RpcTransportTestImpl);
BentleyCloudRpcManager.initializeImpl(TestbedConfig.cloudRpcParams, [RpcWebTransportTest]);
ElectronRpcManager.initializeImpl({}, [RpcElectronTransportTest]);
MobileRpcManager.initializeImpl([RpcMobileTransportTest]);
}
private static registerImpls() {
// __PUBLISH_EXTRACT_START__ RpcInterface.registerImpls
RpcManager.registerImpl(RobotWorldReadRpcInterface, RobotWorldReadRpcImpl);
// __PUBLISH_EXTRACT_END__
}
public static initialize(props?: PresentationProps): void {
try {
RpcManager.registerImpl(PresentationRpcInterface, PresentationRpcImpl);
} catch (_e) {
// note: RpcManager.registerImpl throws when called more than once with the same
// rpc interface. However, it doesn't provide any way to unregister a, interface so we end up
// using the one registered first. At least we can avoid an exception...
}
this._initProps = props || {};
this._shutdownListener = IModelHost.onBeforeShutdown.addListener(Presentation.terminate);
this._requestTimeout = (props && props.requestTimeout !== undefined)
? props.requestTimeout
: defaultRequestTimeout;
this._clientsStorage = new TemporaryStorage({
factory: this.createClientManager,
cleanupHandler: this.disposeClientManager,
// cleanup unused managers every minute
cleanupInterval: 60 * 1000,
// by default, manager is disposed after 1 hour of being unused
public static register() {
RpcManager.registerImpl(TestRpcInterface, TestRpcImpl);
}
}
public static register() {
RpcManager.registerImpl(RpcTransportTest, RpcTransportTestImpl);
}
public static register() {
RpcManager.registerImpl(TestRpcInterface, TestRpcImpl);
}
public async readExternalSavedViews(bimfileName: string): Promise {
const esvFileName = this.createEsvFilename(bimfileName);
if (!IModelJsFs.existsSync(esvFileName)) {
return "";
}
const jsonStr = IModelJsFs.readFileSync(esvFileName).toString();
if (undefined === jsonStr)
return "";
return jsonStr;
}
}
/** Auto-register the impl when this file is included. */
RpcManager.registerImpl(DisplayPerfRpcInterface, DisplayPerfRpcImpl);
public static register() { RpcManager.registerImpl(WipRpcInterface, WipRpcImpl); }
public async placeholder(_tokenProps: IModelTokenProps): Promise { return "placeholder"; }