@itwin/core-electron 4.0.0-dev.22 → 4.0.0-dev.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/ElectronBackend.d.ts +1 -1
- package/lib/cjs/ElectronBackend.js +17 -17
- package/lib/cjs/ElectronBackend.js.map +1 -1
- package/lib/cjs/ElectronFrontend.d.ts +1 -1
- package/lib/cjs/ElectronFrontend.js +17 -17
- package/lib/cjs/ElectronFrontend.js.map +1 -1
- package/lib/cjs/__DOC_ONLY__.d.ts +3 -3
- package/lib/cjs/__DOC_ONLY__.js +22 -22
- package/lib/cjs/__DOC_ONLY__.js.map +1 -1
- package/lib/cjs/backend/ElectronHost.d.ts +104 -104
- package/lib/cjs/backend/ElectronHost.js +242 -242
- package/lib/cjs/backend/ElectronPreload.d.ts +1 -1
- package/lib/cjs/backend/ElectronPreload.js +39 -39
- package/lib/cjs/backend/ElectronPreload.js.map +1 -1
- package/lib/cjs/common/ElectronIpcInterface.d.ts +7 -7
- package/lib/cjs/common/ElectronIpcInterface.js +5 -5
- package/lib/cjs/common/ElectronIpcInterface.js.map +1 -1
- package/lib/cjs/common/ElectronIpcTransport.d.ts +44 -44
- package/lib/cjs/common/ElectronIpcTransport.js +186 -186
- package/lib/cjs/common/ElectronIpcTransport.js.map +1 -1
- package/lib/cjs/common/ElectronManagerLoggerCategory.d.ts +10 -10
- package/lib/cjs/common/ElectronManagerLoggerCategory.js +18 -18
- package/lib/cjs/common/ElectronManagerLoggerCategory.js.map +1 -1
- package/lib/cjs/common/ElectronPush.d.ts +20 -20
- package/lib/cjs/common/ElectronPush.js +48 -48
- package/lib/cjs/common/ElectronPush.js.map +1 -1
- package/lib/cjs/common/ElectronRpcManager.d.ts +26 -26
- package/lib/cjs/common/ElectronRpcManager.js +65 -65
- package/lib/cjs/common/ElectronRpcManager.js.map +1 -1
- package/lib/cjs/common/ElectronRpcProtocol.d.ts +34 -34
- package/lib/cjs/common/ElectronRpcProtocol.js +58 -58
- package/lib/cjs/common/ElectronRpcProtocol.js.map +1 -1
- package/lib/cjs/common/ElectronRpcRequest.d.ts +19 -19
- package/lib/cjs/common/ElectronRpcRequest.js +56 -56
- package/lib/cjs/common/ElectronRpcRequest.js.map +1 -1
- package/lib/cjs/common/ITwinElectronApi.d.ts +10 -10
- package/lib/cjs/common/ITwinElectronApi.js +6 -6
- package/lib/cjs/common/ITwinElectronApi.js.map +1 -1
- package/lib/cjs/frontend/ElectronApp.d.ts +35 -35
- package/lib/cjs/frontend/ElectronApp.js +75 -75
- package/lib/cjs/frontend/ElectronApp.js.map +1 -1
- package/package.json +14 -14
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module RpcInterface
|
|
3
|
-
*/
|
|
4
|
-
import { RpcPushChannel, RpcPushConnection, RpcPushTransport, RpcRequestFulfillment } from "@itwin/core-common";
|
|
5
|
-
import { BackendIpcTransport, FrontendIpcTransport } from "./ElectronIpcTransport";
|
|
6
|
-
/** @internal */
|
|
7
|
-
export declare class ElectronPushTransport extends RpcPushTransport {
|
|
8
|
-
private _ipc;
|
|
9
|
-
private _last;
|
|
10
|
-
get last(): number;
|
|
11
|
-
constructor(ipc: FrontendIpcTransport);
|
|
12
|
-
consume(response: RpcRequestFulfillment): boolean;
|
|
13
|
-
}
|
|
14
|
-
/** @internal */
|
|
15
|
-
export declare class ElectronPushConnection<T> extends RpcPushConnection<T> {
|
|
16
|
-
private _ipc;
|
|
17
|
-
private _next;
|
|
18
|
-
constructor(channel: RpcPushChannel<T>, client: unknown, ipc: BackendIpcTransport);
|
|
19
|
-
send(messageData: any): Promise<void>;
|
|
20
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module RpcInterface
|
|
3
|
+
*/
|
|
4
|
+
import { RpcPushChannel, RpcPushConnection, RpcPushTransport, RpcRequestFulfillment } from "@itwin/core-common";
|
|
5
|
+
import { BackendIpcTransport, FrontendIpcTransport } from "./ElectronIpcTransport";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare class ElectronPushTransport extends RpcPushTransport {
|
|
8
|
+
private _ipc;
|
|
9
|
+
private _last;
|
|
10
|
+
get last(): number;
|
|
11
|
+
constructor(ipc: FrontendIpcTransport);
|
|
12
|
+
consume(response: RpcRequestFulfillment): boolean;
|
|
13
|
+
}
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare class ElectronPushConnection<T> extends RpcPushConnection<T> {
|
|
16
|
+
private _ipc;
|
|
17
|
+
private _next;
|
|
18
|
+
constructor(channel: RpcPushChannel<T>, client: unknown, ipc: BackendIpcTransport);
|
|
19
|
+
send(messageData: any): Promise<void>;
|
|
20
|
+
}
|
|
21
21
|
//# sourceMappingURL=ElectronPush.d.ts.map
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module RpcInterface
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ElectronPushConnection = exports.ElectronPushTransport = void 0;
|
|
11
|
-
const core_common_1 = require("@itwin/core-common");
|
|
12
|
-
/* eslint-disable deprecation/deprecation */
|
|
13
|
-
const PUSH = "__push__";
|
|
14
|
-
/** @internal */
|
|
15
|
-
class ElectronPushTransport extends core_common_1.RpcPushTransport {
|
|
16
|
-
constructor(ipc) {
|
|
17
|
-
super();
|
|
18
|
-
this._last = -1;
|
|
19
|
-
this._ipc = ipc;
|
|
20
|
-
}
|
|
21
|
-
get last() { return this._last; }
|
|
22
|
-
consume(response) {
|
|
23
|
-
if (response.interfaceName !== PUSH) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
this._last = response.status;
|
|
27
|
-
if (this.onMessage) {
|
|
28
|
-
const messageData = core_common_1.RpcMarshaling.deserialize(this._ipc.protocol, response.result);
|
|
29
|
-
this.onMessage(response.id, messageData);
|
|
30
|
-
}
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.ElectronPushTransport = ElectronPushTransport;
|
|
35
|
-
/** @internal */
|
|
36
|
-
class ElectronPushConnection extends core_common_1.RpcPushConnection {
|
|
37
|
-
constructor(channel, client, ipc) {
|
|
38
|
-
super(channel, client);
|
|
39
|
-
this._next = -1;
|
|
40
|
-
this._ipc = ipc;
|
|
41
|
-
}
|
|
42
|
-
async send(messageData) {
|
|
43
|
-
const result = await core_common_1.RpcMarshaling.serialize(this._ipc.protocol, messageData);
|
|
44
|
-
const fulfillment = { result, rawResult: messageData, interfaceName: PUSH, id: this.channel.id, status: ++this._next };
|
|
45
|
-
this._ipc.sendResponse(fulfillment, undefined);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.ElectronPushConnection = ElectronPushConnection;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module RpcInterface
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ElectronPushConnection = exports.ElectronPushTransport = void 0;
|
|
11
|
+
const core_common_1 = require("@itwin/core-common");
|
|
12
|
+
/* eslint-disable deprecation/deprecation */
|
|
13
|
+
const PUSH = "__push__";
|
|
14
|
+
/** @internal */
|
|
15
|
+
class ElectronPushTransport extends core_common_1.RpcPushTransport {
|
|
16
|
+
constructor(ipc) {
|
|
17
|
+
super();
|
|
18
|
+
this._last = -1;
|
|
19
|
+
this._ipc = ipc;
|
|
20
|
+
}
|
|
21
|
+
get last() { return this._last; }
|
|
22
|
+
consume(response) {
|
|
23
|
+
if (response.interfaceName !== PUSH) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
this._last = response.status;
|
|
27
|
+
if (this.onMessage) {
|
|
28
|
+
const messageData = core_common_1.RpcMarshaling.deserialize(this._ipc.protocol, response.result);
|
|
29
|
+
this.onMessage(response.id, messageData);
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ElectronPushTransport = ElectronPushTransport;
|
|
35
|
+
/** @internal */
|
|
36
|
+
class ElectronPushConnection extends core_common_1.RpcPushConnection {
|
|
37
|
+
constructor(channel, client, ipc) {
|
|
38
|
+
super(channel, client);
|
|
39
|
+
this._next = -1;
|
|
40
|
+
this._ipc = ipc;
|
|
41
|
+
}
|
|
42
|
+
async send(messageData) {
|
|
43
|
+
const result = await core_common_1.RpcMarshaling.serialize(this._ipc.protocol, messageData);
|
|
44
|
+
const fulfillment = { result, rawResult: messageData, interfaceName: PUSH, id: this.channel.id, status: ++this._next };
|
|
45
|
+
this._ipc.sendResponse(fulfillment, undefined);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.ElectronPushConnection = ElectronPushConnection;
|
|
49
49
|
//# sourceMappingURL=ElectronPush.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElectronPush.js","sourceRoot":"","sources":["../../../src/common/ElectronPush.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAA+H;AAG/H,4CAA4C;AAE5C,MAAM,IAAI,GAAG,UAAU,CAAC;AAExB,gBAAgB;AAChB,MAAa,qBAAsB,SAAQ,8BAAgB;IAMzD,YAAmB,GAAyB;QAC1C,KAAK,EAAE,CAAC;QALF,UAAK,GAAW,CAAC,CAAC,CAAC;QAMzB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IALD,IAAW,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAOjC,OAAO,CAAC,QAA+B;QAC5C,IAAI,QAAQ,CAAC,aAAa,KAAK,IAAI,EAAE;YACnC,OAAO,KAAK,CAAC;SACd;QAED,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC;QAE7B,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,MAAM,WAAW,GAAG,2BAAa,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;YACnF,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;SAC1C;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAzBD,sDAyBC;AAED,gBAAgB;AAChB,MAAa,sBAA0B,SAAQ,+BAAoB;IAIjE,YAAmB,OAA0B,EAAE,MAAe,EAAE,GAAwB;QACtF,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAHjB,UAAK,GAAW,CAAC,CAAC,CAAC;QAIzB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,WAAgB;QAChC,MAAM,MAAM,GAAG,MAAM,2BAAa,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC9E,MAAM,WAAW,GAA0B,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9I,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACjD,CAAC;CACF;AAdD,wDAcC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"ElectronPush.js","sourceRoot":"","sources":["../../../src/common/ElectronPush.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAA+H;AAG/H,4CAA4C;AAE5C,MAAM,IAAI,GAAG,UAAU,CAAC;AAExB,gBAAgB;AAChB,MAAa,qBAAsB,SAAQ,8BAAgB;IAMzD,YAAmB,GAAyB;QAC1C,KAAK,EAAE,CAAC;QALF,UAAK,GAAW,CAAC,CAAC,CAAC;QAMzB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IALD,IAAW,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAOjC,OAAO,CAAC,QAA+B;QAC5C,IAAI,QAAQ,CAAC,aAAa,KAAK,IAAI,EAAE;YACnC,OAAO,KAAK,CAAC;SACd;QAED,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC;QAE7B,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,MAAM,WAAW,GAAG,2BAAa,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;YACnF,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;SAC1C;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAzBD,sDAyBC;AAED,gBAAgB;AAChB,MAAa,sBAA0B,SAAQ,+BAAoB;IAIjE,YAAmB,OAA0B,EAAE,MAAe,EAAE,GAAwB;QACtF,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAHjB,UAAK,GAAW,CAAC,CAAC,CAAC;QAIzB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,WAAgB;QAChC,MAAM,MAAM,GAAG,MAAM,2BAAa,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC9E,MAAM,WAAW,GAA0B,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9I,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACjD,CAAC;CACF;AAdD,wDAcC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { RpcMarshaling, RpcPushChannel, RpcPushConnection, RpcPushTransport, RpcRequestFulfillment } from \"@itwin/core-common\";\nimport { BackendIpcTransport, FrontendIpcTransport } from \"./ElectronIpcTransport\";\n\n/* eslint-disable deprecation/deprecation */\n\nconst PUSH = \"__push__\";\n\n/** @internal */\nexport class ElectronPushTransport extends RpcPushTransport {\n private _ipc: FrontendIpcTransport;\n private _last: number = -1;\n\n public get last() { return this._last; }\n\n public constructor(ipc: FrontendIpcTransport) {\n super();\n this._ipc = ipc;\n }\n\n public consume(response: RpcRequestFulfillment): boolean {\n if (response.interfaceName !== PUSH) {\n return false;\n }\n\n this._last = response.status;\n\n if (this.onMessage) {\n const messageData = RpcMarshaling.deserialize(this._ipc.protocol, response.result);\n this.onMessage(response.id, messageData);\n }\n\n return true;\n }\n}\n\n/** @internal */\nexport class ElectronPushConnection<T> extends RpcPushConnection<T> {\n private _ipc: BackendIpcTransport;\n private _next: number = -1;\n\n public constructor(channel: RpcPushChannel<T>, client: unknown, ipc: BackendIpcTransport) {\n super(channel, client);\n this._ipc = ipc;\n }\n\n public async send(messageData: any) {\n const result = await RpcMarshaling.serialize(this._ipc.protocol, messageData);\n const fulfillment: RpcRequestFulfillment = { result, rawResult: messageData, interfaceName: PUSH, id: this.channel.id, status: ++this._next };\n this._ipc.sendResponse(fulfillment, undefined);\n }\n}\n"]}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module RpcInterface
|
|
3
|
-
*/
|
|
4
|
-
import { IpcSocketBackend, IpcSocketFrontend, RpcConfiguration, RpcInterfaceDefinition, RpcManager } from "@itwin/core-common";
|
|
5
|
-
import { ElectronRpcProtocol } from "./ElectronRpcProtocol";
|
|
6
|
-
/** RPC interface configuration for an Electron-based application.
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export declare abstract class ElectronRpcConfiguration extends RpcConfiguration {
|
|
10
|
-
static targetWindowId?: number;
|
|
11
|
-
/** The protocol of the configuration. */
|
|
12
|
-
abstract protocol: ElectronRpcProtocol;
|
|
13
|
-
}
|
|
14
|
-
/** Coordinates usage of RPC interfaces for an Electron-based application.
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export declare class ElectronRpcManager extends RpcManager {
|
|
18
|
-
/** Initializes ElectronRpcManager for the frontend of an application. */
|
|
19
|
-
static initializeFrontend(ipcFrontend: IpcSocketFrontend, interfaces?: RpcInterfaceDefinition[]): ElectronRpcConfiguration;
|
|
20
|
-
/** Initializes ElectronRpcManager for the backend of an application. */
|
|
21
|
-
static initializeBackend(ipcBackend: IpcSocketBackend, interfaces?: RpcInterfaceDefinition[]): ElectronRpcConfiguration;
|
|
22
|
-
private static performInitialization;
|
|
23
|
-
/** Terminates ElectronRpcManager for the frontend of an application. */
|
|
24
|
-
static terminateFrontend(): void;
|
|
25
|
-
private static performTermination;
|
|
26
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module RpcInterface
|
|
3
|
+
*/
|
|
4
|
+
import { IpcSocketBackend, IpcSocketFrontend, RpcConfiguration, RpcInterfaceDefinition, RpcManager } from "@itwin/core-common";
|
|
5
|
+
import { ElectronRpcProtocol } from "./ElectronRpcProtocol";
|
|
6
|
+
/** RPC interface configuration for an Electron-based application.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class ElectronRpcConfiguration extends RpcConfiguration {
|
|
10
|
+
static targetWindowId?: number;
|
|
11
|
+
/** The protocol of the configuration. */
|
|
12
|
+
abstract protocol: ElectronRpcProtocol;
|
|
13
|
+
}
|
|
14
|
+
/** Coordinates usage of RPC interfaces for an Electron-based application.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare class ElectronRpcManager extends RpcManager {
|
|
18
|
+
/** Initializes ElectronRpcManager for the frontend of an application. */
|
|
19
|
+
static initializeFrontend(ipcFrontend: IpcSocketFrontend, interfaces?: RpcInterfaceDefinition[]): ElectronRpcConfiguration;
|
|
20
|
+
/** Initializes ElectronRpcManager for the backend of an application. */
|
|
21
|
+
static initializeBackend(ipcBackend: IpcSocketBackend, interfaces?: RpcInterfaceDefinition[]): ElectronRpcConfiguration;
|
|
22
|
+
private static performInitialization;
|
|
23
|
+
/** Terminates ElectronRpcManager for the frontend of an application. */
|
|
24
|
+
static terminateFrontend(): void;
|
|
25
|
+
private static performTermination;
|
|
26
|
+
}
|
|
27
27
|
//# sourceMappingURL=ElectronRpcManager.d.ts.map
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module RpcInterface
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ElectronRpcManager = exports.ElectronRpcConfiguration = void 0;
|
|
11
|
-
const core_common_1 = require("@itwin/core-common");
|
|
12
|
-
const presentation_common_1 = require("@itwin/presentation-common");
|
|
13
|
-
const ElectronRpcProtocol_1 = require("./ElectronRpcProtocol");
|
|
14
|
-
/* eslint-disable deprecation/deprecation */
|
|
15
|
-
/** RPC interface configuration for an Electron-based application.
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
class ElectronRpcConfiguration extends core_common_1.RpcConfiguration {
|
|
19
|
-
}
|
|
20
|
-
exports.ElectronRpcConfiguration = ElectronRpcConfiguration;
|
|
21
|
-
/** Coordinates usage of RPC interfaces for an Electron-based application.
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
class ElectronRpcManager extends core_common_1.RpcManager {
|
|
25
|
-
/** Initializes ElectronRpcManager for the frontend of an application. */
|
|
26
|
-
static initializeFrontend(ipcFrontend, interfaces) {
|
|
27
|
-
return ElectronRpcManager.performInitialization(ipcFrontend, interfaces);
|
|
28
|
-
}
|
|
29
|
-
/** Initializes ElectronRpcManager for the backend of an application. */
|
|
30
|
-
static initializeBackend(ipcBackend, interfaces) {
|
|
31
|
-
return ElectronRpcManager.performInitialization(ipcBackend, interfaces);
|
|
32
|
-
}
|
|
33
|
-
static performInitialization(ipcSocket, rpcs) {
|
|
34
|
-
const interfaces = rpcs !== null && rpcs !== void 0 ? rpcs : [
|
|
35
|
-
core_common_1.IModelReadRpcInterface,
|
|
36
|
-
core_common_1.IModelTileRpcInterface,
|
|
37
|
-
core_common_1.SnapshotIModelRpcInterface,
|
|
38
|
-
presentation_common_1.PresentationRpcInterface,
|
|
39
|
-
];
|
|
40
|
-
const config = class extends ElectronRpcConfiguration {
|
|
41
|
-
constructor() {
|
|
42
|
-
super(...arguments);
|
|
43
|
-
this.interfaces = () => interfaces;
|
|
44
|
-
this.protocol = new ElectronRpcProtocol_1.ElectronRpcProtocol(this, ipcSocket);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
for (const def of interfaces) {
|
|
48
|
-
core_common_1.RpcConfiguration.assign(def, () => config);
|
|
49
|
-
}
|
|
50
|
-
const instance = core_common_1.RpcConfiguration.obtain(config);
|
|
51
|
-
core_common_1.RpcConfiguration.initializeInterfaces(instance);
|
|
52
|
-
return instance;
|
|
53
|
-
}
|
|
54
|
-
/** Terminates ElectronRpcManager for the frontend of an application. */
|
|
55
|
-
static terminateFrontend() {
|
|
56
|
-
return ElectronRpcManager.performTermination();
|
|
57
|
-
}
|
|
58
|
-
static performTermination() {
|
|
59
|
-
const definitions = core_common_1.RpcRegistry.instance.definitionClasses;
|
|
60
|
-
for (const [, interfaceDef] of definitions) {
|
|
61
|
-
core_common_1.RpcManager.terminateInterface(interfaceDef);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.ElectronRpcManager = ElectronRpcManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module RpcInterface
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ElectronRpcManager = exports.ElectronRpcConfiguration = void 0;
|
|
11
|
+
const core_common_1 = require("@itwin/core-common");
|
|
12
|
+
const presentation_common_1 = require("@itwin/presentation-common");
|
|
13
|
+
const ElectronRpcProtocol_1 = require("./ElectronRpcProtocol");
|
|
14
|
+
/* eslint-disable deprecation/deprecation */
|
|
15
|
+
/** RPC interface configuration for an Electron-based application.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
class ElectronRpcConfiguration extends core_common_1.RpcConfiguration {
|
|
19
|
+
}
|
|
20
|
+
exports.ElectronRpcConfiguration = ElectronRpcConfiguration;
|
|
21
|
+
/** Coordinates usage of RPC interfaces for an Electron-based application.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
class ElectronRpcManager extends core_common_1.RpcManager {
|
|
25
|
+
/** Initializes ElectronRpcManager for the frontend of an application. */
|
|
26
|
+
static initializeFrontend(ipcFrontend, interfaces) {
|
|
27
|
+
return ElectronRpcManager.performInitialization(ipcFrontend, interfaces);
|
|
28
|
+
}
|
|
29
|
+
/** Initializes ElectronRpcManager for the backend of an application. */
|
|
30
|
+
static initializeBackend(ipcBackend, interfaces) {
|
|
31
|
+
return ElectronRpcManager.performInitialization(ipcBackend, interfaces);
|
|
32
|
+
}
|
|
33
|
+
static performInitialization(ipcSocket, rpcs) {
|
|
34
|
+
const interfaces = rpcs !== null && rpcs !== void 0 ? rpcs : [
|
|
35
|
+
core_common_1.IModelReadRpcInterface,
|
|
36
|
+
core_common_1.IModelTileRpcInterface,
|
|
37
|
+
core_common_1.SnapshotIModelRpcInterface,
|
|
38
|
+
presentation_common_1.PresentationRpcInterface,
|
|
39
|
+
];
|
|
40
|
+
const config = class extends ElectronRpcConfiguration {
|
|
41
|
+
constructor() {
|
|
42
|
+
super(...arguments);
|
|
43
|
+
this.interfaces = () => interfaces;
|
|
44
|
+
this.protocol = new ElectronRpcProtocol_1.ElectronRpcProtocol(this, ipcSocket);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
for (const def of interfaces) {
|
|
48
|
+
core_common_1.RpcConfiguration.assign(def, () => config);
|
|
49
|
+
}
|
|
50
|
+
const instance = core_common_1.RpcConfiguration.obtain(config);
|
|
51
|
+
core_common_1.RpcConfiguration.initializeInterfaces(instance);
|
|
52
|
+
return instance;
|
|
53
|
+
}
|
|
54
|
+
/** Terminates ElectronRpcManager for the frontend of an application. */
|
|
55
|
+
static terminateFrontend() {
|
|
56
|
+
return ElectronRpcManager.performTermination();
|
|
57
|
+
}
|
|
58
|
+
static performTermination() {
|
|
59
|
+
const definitions = core_common_1.RpcRegistry.instance.definitionClasses;
|
|
60
|
+
for (const [, interfaceDef] of definitions) {
|
|
61
|
+
core_common_1.RpcManager.terminateInterface(interfaceDef);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.ElectronRpcManager = ElectronRpcManager;
|
|
66
66
|
//# sourceMappingURL=ElectronRpcManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElectronRpcManager.js","sourceRoot":"","sources":["../../../src/common/ElectronRpcManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAmO;AACnO,oEAAsE;AACtE,+DAA4D;AAE5D,4CAA4C;AAE5C;;GAEG;AACH,MAAsB,wBAAyB,SAAQ,8BAAgB;CAMtE;AAND,4DAMC;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,wBAAU;IAChD,yEAAyE;IAClE,MAAM,CAAC,kBAAkB,CAAC,WAA8B,EAAE,UAAqC;QACpG,OAAO,kBAAkB,CAAC,qBAAqB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;IAED,wEAAwE;IACjE,MAAM,CAAC,iBAAiB,CAAC,UAA4B,EAAE,UAAqC;QACjG,OAAO,kBAAkB,CAAC,qBAAqB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC1E,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,SAAoB,EAAE,IAA+B;QACxF,MAAM,UAAU,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI;YACzB,oCAAsB;YACtB,oCAAsB;YACtB,wCAA0B;YAC1B,8CAAwB;SACzB,CAAC;QACF,MAAM,MAAM,GAAG,KAAM,SAAQ,wBAAwB;YAAtC;;gBACN,eAAU,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC;gBAC9B,aAAQ,GAAwB,IAAI,yCAAmB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAClF,CAAC;SAAA,CAAC;QAEF,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;YAC5B,8BAAgB,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;SAC5C;QAED,MAAM,QAAQ,GAAG,8BAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACjD,8BAAgB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAEhD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,wEAAwE;IACjE,MAAM,CAAC,iBAAiB;QAC7B,OAAO,kBAAkB,CAAC,kBAAkB,EAAE,CAAC;IACjD,CAAC;IAEO,MAAM,CAAC,kBAAkB;QAC/B,MAAM,WAAW,GAAG,yBAAW,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAE3D,KAAK,MAAM,CAAC,EAAE,YAAY,CAAC,IAAI,WAAW,EAAE;YAC1C,wBAAU,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;SAC7C;IACH,CAAC;CACF;AA7CD,gDA6CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"ElectronRpcManager.js","sourceRoot":"","sources":["../../../src/common/ElectronRpcManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAmO;AACnO,oEAAsE;AACtE,+DAA4D;AAE5D,4CAA4C;AAE5C;;GAEG;AACH,MAAsB,wBAAyB,SAAQ,8BAAgB;CAMtE;AAND,4DAMC;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,wBAAU;IAChD,yEAAyE;IAClE,MAAM,CAAC,kBAAkB,CAAC,WAA8B,EAAE,UAAqC;QACpG,OAAO,kBAAkB,CAAC,qBAAqB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;IAED,wEAAwE;IACjE,MAAM,CAAC,iBAAiB,CAAC,UAA4B,EAAE,UAAqC;QACjG,OAAO,kBAAkB,CAAC,qBAAqB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC1E,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,SAAoB,EAAE,IAA+B;QACxF,MAAM,UAAU,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI;YACzB,oCAAsB;YACtB,oCAAsB;YACtB,wCAA0B;YAC1B,8CAAwB;SACzB,CAAC;QACF,MAAM,MAAM,GAAG,KAAM,SAAQ,wBAAwB;YAAtC;;gBACN,eAAU,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC;gBAC9B,aAAQ,GAAwB,IAAI,yCAAmB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAClF,CAAC;SAAA,CAAC;QAEF,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;YAC5B,8BAAgB,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;SAC5C;QAED,MAAM,QAAQ,GAAG,8BAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACjD,8BAAgB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAEhD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,wEAAwE;IACjE,MAAM,CAAC,iBAAiB;QAC7B,OAAO,kBAAkB,CAAC,kBAAkB,EAAE,CAAC;IACjD,CAAC;IAEO,MAAM,CAAC,kBAAkB;QAC/B,MAAM,WAAW,GAAG,yBAAW,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAE3D,KAAK,MAAM,CAAC,EAAE,YAAY,CAAC,IAAI,WAAW,EAAE;YAC1C,wBAAU,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;SAC7C;IACH,CAAC;CACF;AA7CD,gDA6CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { IModelReadRpcInterface, IModelTileRpcInterface, IpcSocket, IpcSocketBackend, IpcSocketFrontend, RpcConfiguration, RpcInterfaceDefinition, RpcManager, RpcRegistry, SnapshotIModelRpcInterface } from \"@itwin/core-common\";\nimport { PresentationRpcInterface } from \"@itwin/presentation-common\";\nimport { ElectronRpcProtocol } from \"./ElectronRpcProtocol\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** RPC interface configuration for an Electron-based application.\n * @internal\n */\nexport abstract class ElectronRpcConfiguration extends RpcConfiguration {\n\n public static targetWindowId?: number;\n\n /** The protocol of the configuration. */\n public abstract override protocol: ElectronRpcProtocol;\n}\n\n/** Coordinates usage of RPC interfaces for an Electron-based application.\n * @internal\n */\nexport class ElectronRpcManager extends RpcManager {\n /** Initializes ElectronRpcManager for the frontend of an application. */\n public static initializeFrontend(ipcFrontend: IpcSocketFrontend, interfaces?: RpcInterfaceDefinition[]): ElectronRpcConfiguration {\n return ElectronRpcManager.performInitialization(ipcFrontend, interfaces);\n }\n\n /** Initializes ElectronRpcManager for the backend of an application. */\n public static initializeBackend(ipcBackend: IpcSocketBackend, interfaces?: RpcInterfaceDefinition[]): ElectronRpcConfiguration {\n return ElectronRpcManager.performInitialization(ipcBackend, interfaces);\n }\n\n private static performInitialization(ipcSocket: IpcSocket, rpcs?: RpcInterfaceDefinition[]): ElectronRpcConfiguration {\n const interfaces = rpcs ?? [\n IModelReadRpcInterface,\n IModelTileRpcInterface,\n SnapshotIModelRpcInterface,\n PresentationRpcInterface,\n ];\n const config = class extends ElectronRpcConfiguration {\n public interfaces = () => interfaces;\n public protocol: ElectronRpcProtocol = new ElectronRpcProtocol(this, ipcSocket);\n };\n\n for (const def of interfaces) {\n RpcConfiguration.assign(def, () => config);\n }\n\n const instance = RpcConfiguration.obtain(config);\n RpcConfiguration.initializeInterfaces(instance);\n\n return instance;\n }\n\n /** Terminates ElectronRpcManager for the frontend of an application. */\n public static terminateFrontend() {\n return ElectronRpcManager.performTermination();\n }\n\n private static performTermination() {\n const definitions = RpcRegistry.instance.definitionClasses;\n\n for (const [, interfaceDef] of definitions) {\n RpcManager.terminateInterface(interfaceDef);\n }\n }\n}\n"]}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module RpcInterface
|
|
3
|
-
*/
|
|
4
|
-
import { IpcSocket, RpcInterface, RpcInterfaceDefinition, RpcProtocol } from "@itwin/core-common";
|
|
5
|
-
import { ElectronIpcTransport, IpcTransportMessage } from "./ElectronIpcTransport";
|
|
6
|
-
import { ElectronRpcConfiguration } from "./ElectronRpcManager";
|
|
7
|
-
import { ElectronRpcRequest } from "./ElectronRpcRequest";
|
|
8
|
-
/** RPC interface protocol for an Electron-based application.
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export declare class ElectronRpcProtocol extends RpcProtocol {
|
|
12
|
-
static instances: Map<string, ElectronRpcProtocol>;
|
|
13
|
-
ipcSocket: IpcSocket;
|
|
14
|
-
/** The RPC request class for this protocol. */
|
|
15
|
-
readonly requestType: typeof ElectronRpcRequest;
|
|
16
|
-
/** Specifies where to break large binary request payloads. */
|
|
17
|
-
transferChunkThreshold: number;
|
|
18
|
-
/** @internal */
|
|
19
|
-
requests: Map<string, ElectronRpcRequest>;
|
|
20
|
-
/** @internal */
|
|
21
|
-
readonly transport: ElectronIpcTransport<IpcTransportMessage, IpcTransportMessage>;
|
|
22
|
-
/** Constructs an Electron protocol. */
|
|
23
|
-
constructor(configuration: ElectronRpcConfiguration, ipcSocket: IpcSocket);
|
|
24
|
-
/** @internal */
|
|
25
|
-
onRpcClientInitialized(definition: RpcInterfaceDefinition, _client: RpcInterface): void;
|
|
26
|
-
/** @internal */
|
|
27
|
-
onRpcImplInitialized(definition: RpcInterfaceDefinition, _impl: RpcInterface): void;
|
|
28
|
-
/** @internal */
|
|
29
|
-
onRpcClientTerminated(definition: RpcInterfaceDefinition, _client: RpcInterface): void;
|
|
30
|
-
/** @internal */
|
|
31
|
-
onRpcImplTerminated(definition: RpcInterfaceDefinition, _impl: RpcInterface): void;
|
|
32
|
-
private registerInterface;
|
|
33
|
-
private purgeInterface;
|
|
34
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module RpcInterface
|
|
3
|
+
*/
|
|
4
|
+
import { IpcSocket, RpcInterface, RpcInterfaceDefinition, RpcProtocol } from "@itwin/core-common";
|
|
5
|
+
import { ElectronIpcTransport, IpcTransportMessage } from "./ElectronIpcTransport";
|
|
6
|
+
import { ElectronRpcConfiguration } from "./ElectronRpcManager";
|
|
7
|
+
import { ElectronRpcRequest } from "./ElectronRpcRequest";
|
|
8
|
+
/** RPC interface protocol for an Electron-based application.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class ElectronRpcProtocol extends RpcProtocol {
|
|
12
|
+
static instances: Map<string, ElectronRpcProtocol>;
|
|
13
|
+
ipcSocket: IpcSocket;
|
|
14
|
+
/** The RPC request class for this protocol. */
|
|
15
|
+
readonly requestType: typeof ElectronRpcRequest;
|
|
16
|
+
/** Specifies where to break large binary request payloads. */
|
|
17
|
+
transferChunkThreshold: number;
|
|
18
|
+
/** @internal */
|
|
19
|
+
requests: Map<string, ElectronRpcRequest>;
|
|
20
|
+
/** @internal */
|
|
21
|
+
readonly transport: ElectronIpcTransport<IpcTransportMessage, IpcTransportMessage>;
|
|
22
|
+
/** Constructs an Electron protocol. */
|
|
23
|
+
constructor(configuration: ElectronRpcConfiguration, ipcSocket: IpcSocket);
|
|
24
|
+
/** @internal */
|
|
25
|
+
onRpcClientInitialized(definition: RpcInterfaceDefinition, _client: RpcInterface): void;
|
|
26
|
+
/** @internal */
|
|
27
|
+
onRpcImplInitialized(definition: RpcInterfaceDefinition, _impl: RpcInterface): void;
|
|
28
|
+
/** @internal */
|
|
29
|
+
onRpcClientTerminated(definition: RpcInterfaceDefinition, _client: RpcInterface): void;
|
|
30
|
+
/** @internal */
|
|
31
|
+
onRpcImplTerminated(definition: RpcInterfaceDefinition, _impl: RpcInterface): void;
|
|
32
|
+
private registerInterface;
|
|
33
|
+
private purgeInterface;
|
|
34
|
+
}
|
|
35
35
|
//# sourceMappingURL=ElectronRpcProtocol.d.ts.map
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module RpcInterface
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ElectronRpcProtocol = void 0;
|
|
11
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
-
const core_common_1 = require("@itwin/core-common");
|
|
13
|
-
const ElectronIpcTransport_1 = require("./ElectronIpcTransport");
|
|
14
|
-
const ElectronRpcRequest_1 = require("./ElectronRpcRequest");
|
|
15
|
-
/* eslint-disable deprecation/deprecation */
|
|
16
|
-
/** RPC interface protocol for an Electron-based application.
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
class ElectronRpcProtocol extends core_common_1.RpcProtocol {
|
|
20
|
-
/** Constructs an Electron protocol. */
|
|
21
|
-
constructor(configuration, ipcSocket) {
|
|
22
|
-
super(configuration);
|
|
23
|
-
/** The RPC request class for this protocol. */
|
|
24
|
-
this.requestType = ElectronRpcRequest_1.ElectronRpcRequest;
|
|
25
|
-
/** Specifies where to break large binary request payloads. */
|
|
26
|
-
this.transferChunkThreshold = 48 * 1024 * 1024;
|
|
27
|
-
/** @internal */
|
|
28
|
-
this.requests = new Map();
|
|
29
|
-
this.ipcSocket = ipcSocket;
|
|
30
|
-
this.transport = (0, ElectronIpcTransport_1.initializeIpc)(this);
|
|
31
|
-
}
|
|
32
|
-
/** @internal */
|
|
33
|
-
onRpcClientInitialized(definition, _client) {
|
|
34
|
-
this.registerInterface(definition);
|
|
35
|
-
}
|
|
36
|
-
/** @internal */
|
|
37
|
-
onRpcImplInitialized(definition, _impl) {
|
|
38
|
-
this.registerInterface(definition);
|
|
39
|
-
}
|
|
40
|
-
/** @internal */
|
|
41
|
-
onRpcClientTerminated(definition, _client) {
|
|
42
|
-
this.purgeInterface(definition);
|
|
43
|
-
}
|
|
44
|
-
/** @internal */
|
|
45
|
-
onRpcImplTerminated(definition, _impl) {
|
|
46
|
-
this.purgeInterface(definition);
|
|
47
|
-
}
|
|
48
|
-
registerInterface(definition) {
|
|
49
|
-
if (ElectronRpcProtocol.instances.has(definition.interfaceName))
|
|
50
|
-
throw new core_common_1.IModelError(core_bentley_1.BentleyStatus.ERROR, `RPC interface "${definition.interfaceName}"" is already associated with a protocol.`);
|
|
51
|
-
ElectronRpcProtocol.instances.set(definition.interfaceName, this);
|
|
52
|
-
}
|
|
53
|
-
purgeInterface(definition) {
|
|
54
|
-
ElectronRpcProtocol.instances.delete(definition.interfaceName);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.ElectronRpcProtocol = ElectronRpcProtocol;
|
|
58
|
-
ElectronRpcProtocol.instances = new Map();
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module RpcInterface
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ElectronRpcProtocol = void 0;
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
+
const core_common_1 = require("@itwin/core-common");
|
|
13
|
+
const ElectronIpcTransport_1 = require("./ElectronIpcTransport");
|
|
14
|
+
const ElectronRpcRequest_1 = require("./ElectronRpcRequest");
|
|
15
|
+
/* eslint-disable deprecation/deprecation */
|
|
16
|
+
/** RPC interface protocol for an Electron-based application.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
class ElectronRpcProtocol extends core_common_1.RpcProtocol {
|
|
20
|
+
/** Constructs an Electron protocol. */
|
|
21
|
+
constructor(configuration, ipcSocket) {
|
|
22
|
+
super(configuration);
|
|
23
|
+
/** The RPC request class for this protocol. */
|
|
24
|
+
this.requestType = ElectronRpcRequest_1.ElectronRpcRequest;
|
|
25
|
+
/** Specifies where to break large binary request payloads. */
|
|
26
|
+
this.transferChunkThreshold = 48 * 1024 * 1024;
|
|
27
|
+
/** @internal */
|
|
28
|
+
this.requests = new Map();
|
|
29
|
+
this.ipcSocket = ipcSocket;
|
|
30
|
+
this.transport = (0, ElectronIpcTransport_1.initializeIpc)(this);
|
|
31
|
+
}
|
|
32
|
+
/** @internal */
|
|
33
|
+
onRpcClientInitialized(definition, _client) {
|
|
34
|
+
this.registerInterface(definition);
|
|
35
|
+
}
|
|
36
|
+
/** @internal */
|
|
37
|
+
onRpcImplInitialized(definition, _impl) {
|
|
38
|
+
this.registerInterface(definition);
|
|
39
|
+
}
|
|
40
|
+
/** @internal */
|
|
41
|
+
onRpcClientTerminated(definition, _client) {
|
|
42
|
+
this.purgeInterface(definition);
|
|
43
|
+
}
|
|
44
|
+
/** @internal */
|
|
45
|
+
onRpcImplTerminated(definition, _impl) {
|
|
46
|
+
this.purgeInterface(definition);
|
|
47
|
+
}
|
|
48
|
+
registerInterface(definition) {
|
|
49
|
+
if (ElectronRpcProtocol.instances.has(definition.interfaceName))
|
|
50
|
+
throw new core_common_1.IModelError(core_bentley_1.BentleyStatus.ERROR, `RPC interface "${definition.interfaceName}"" is already associated with a protocol.`);
|
|
51
|
+
ElectronRpcProtocol.instances.set(definition.interfaceName, this);
|
|
52
|
+
}
|
|
53
|
+
purgeInterface(definition) {
|
|
54
|
+
ElectronRpcProtocol.instances.delete(definition.interfaceName);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.ElectronRpcProtocol = ElectronRpcProtocol;
|
|
58
|
+
ElectronRpcProtocol.instances = new Map();
|
|
59
59
|
//# sourceMappingURL=ElectronRpcProtocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElectronRpcProtocol.js","sourceRoot":"","sources":["../../../src/common/ElectronRpcProtocol.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoD;AACpD,oDAA+G;AAC/G,iEAAkG;AAElG,6DAA0D;AAE1D,4CAA4C;AAE5C;;GAEG;AACH,MAAa,mBAAoB,SAAQ,yBAAW;IAgBlD,uCAAuC;IACvC,YAAmB,aAAuC,EAAE,SAAoB;QAC9E,KAAK,CAAC,aAAa,CAAC,CAAC;QAdvB,+CAA+C;QAC/B,gBAAW,GAAG,uCAAkB,CAAC;QAEjD,8DAA8D;QAC9C,2BAAsB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;QAE1D,gBAAgB;QACT,aAAQ,GAAoC,IAAI,GAAG,EAAE,CAAC;QAQ3D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAA,oCAAa,EAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,gBAAgB;IACA,sBAAsB,CAAC,UAAkC,EAAE,OAAqB;QAC9F,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAED,gBAAgB;IACA,oBAAoB,CAAC,UAAkC,EAAE,KAAmB;QAC1F,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAED,gBAAgB;IACA,qBAAqB,CAAC,UAAkC,EAAE,OAAqB;QAC7F,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAED,gBAAgB;IACA,mBAAmB,CAAC,UAAkC,EAAE,KAAmB;QACzF,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAEO,iBAAiB,CAAC,UAAkC;QAC1D,IAAI,mBAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC;YAC7D,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,kBAAkB,UAAU,CAAC,aAAa,2CAA2C,CAAC,CAAC;QAEpI,mBAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;IAEO,cAAc,CAAC,UAAkC;QACvD,mBAAmB,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,CAAC;;AApDH,kDAqDC;AApDe,6BAAS,GAAqC,IAAI,GAAG,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"ElectronRpcProtocol.js","sourceRoot":"","sources":["../../../src/common/ElectronRpcProtocol.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoD;AACpD,oDAA+G;AAC/G,iEAAkG;AAElG,6DAA0D;AAE1D,4CAA4C;AAE5C;;GAEG;AACH,MAAa,mBAAoB,SAAQ,yBAAW;IAgBlD,uCAAuC;IACvC,YAAmB,aAAuC,EAAE,SAAoB;QAC9E,KAAK,CAAC,aAAa,CAAC,CAAC;QAdvB,+CAA+C;QAC/B,gBAAW,GAAG,uCAAkB,CAAC;QAEjD,8DAA8D;QAC9C,2BAAsB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;QAE1D,gBAAgB;QACT,aAAQ,GAAoC,IAAI,GAAG,EAAE,CAAC;QAQ3D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAA,oCAAa,EAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,gBAAgB;IACA,sBAAsB,CAAC,UAAkC,EAAE,OAAqB;QAC9F,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAED,gBAAgB;IACA,oBAAoB,CAAC,UAAkC,EAAE,KAAmB;QAC1F,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAED,gBAAgB;IACA,qBAAqB,CAAC,UAAkC,EAAE,OAAqB;QAC7F,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAED,gBAAgB;IACA,mBAAmB,CAAC,UAAkC,EAAE,KAAmB;QACzF,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAEO,iBAAiB,CAAC,UAAkC;QAC1D,IAAI,mBAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC;YAC7D,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,kBAAkB,UAAU,CAAC,aAAa,2CAA2C,CAAC,CAAC;QAEpI,mBAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;IAEO,cAAc,CAAC,UAAkC;QACvD,mBAAmB,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,CAAC;;AApDH,kDAqDC;AApDe,6BAAS,GAAqC,IAAI,GAAG,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyStatus } from \"@itwin/core-bentley\";\nimport { IModelError, IpcSocket, RpcInterface, RpcInterfaceDefinition, RpcProtocol } from \"@itwin/core-common\";\nimport { ElectronIpcTransport, initializeIpc, IpcTransportMessage } from \"./ElectronIpcTransport\";\nimport { ElectronRpcConfiguration } from \"./ElectronRpcManager\";\nimport { ElectronRpcRequest } from \"./ElectronRpcRequest\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** RPC interface protocol for an Electron-based application.\n * @internal\n */\nexport class ElectronRpcProtocol extends RpcProtocol {\n public static instances: Map<string, ElectronRpcProtocol> = new Map();\n public ipcSocket: IpcSocket;\n\n /** The RPC request class for this protocol. */\n public readonly requestType = ElectronRpcRequest;\n\n /** Specifies where to break large binary request payloads. */\n public override transferChunkThreshold = 48 * 1024 * 1024;\n\n /** @internal */\n public requests: Map<string, ElectronRpcRequest> = new Map();\n\n /** @internal */\n public readonly transport: ElectronIpcTransport<IpcTransportMessage, IpcTransportMessage>;\n\n /** Constructs an Electron protocol. */\n public constructor(configuration: ElectronRpcConfiguration, ipcSocket: IpcSocket) {\n super(configuration);\n this.ipcSocket = ipcSocket;\n this.transport = initializeIpc(this);\n }\n\n /** @internal */\n public override onRpcClientInitialized(definition: RpcInterfaceDefinition, _client: RpcInterface): void {\n this.registerInterface(definition);\n }\n\n /** @internal */\n public override onRpcImplInitialized(definition: RpcInterfaceDefinition, _impl: RpcInterface): void {\n this.registerInterface(definition);\n }\n\n /** @internal */\n public override onRpcClientTerminated(definition: RpcInterfaceDefinition, _client: RpcInterface): void {\n this.purgeInterface(definition);\n }\n\n /** @internal */\n public override onRpcImplTerminated(definition: RpcInterfaceDefinition, _impl: RpcInterface): void {\n this.purgeInterface(definition);\n }\n\n private registerInterface(definition: RpcInterfaceDefinition) {\n if (ElectronRpcProtocol.instances.has(definition.interfaceName))\n throw new IModelError(BentleyStatus.ERROR, `RPC interface \"${definition.interfaceName}\"\" is already associated with a protocol.`);\n\n ElectronRpcProtocol.instances.set(definition.interfaceName, this);\n }\n\n private purgeInterface(definition: RpcInterfaceDefinition) {\n ElectronRpcProtocol.instances.delete(definition.interfaceName);\n }\n}\n"]}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { RpcRequest, RpcRequestFulfillment } from "@itwin/core-common";
|
|
2
|
-
import { ElectronRpcProtocol } from "./ElectronRpcProtocol";
|
|
3
|
-
/** @internal */
|
|
4
|
-
export declare class ElectronRpcRequest extends RpcRequest {
|
|
5
|
-
private _res;
|
|
6
|
-
private _fulfillment;
|
|
7
|
-
/** Convenience access to the protocol of this request. */
|
|
8
|
-
readonly protocol: ElectronRpcProtocol;
|
|
9
|
-
/** Sends the request. */
|
|
10
|
-
protected send(): Promise<number>;
|
|
11
|
-
/** Loads the request. */
|
|
12
|
-
protected load(): Promise<import("@itwin/core-common").RpcSerializedValue>;
|
|
13
|
-
/** Sets request header values. */
|
|
14
|
-
protected setHeader(_name: string, _value: string): void;
|
|
15
|
-
/** @internal */
|
|
16
|
-
notifyResponse(fulfillment: RpcRequestFulfillment): void;
|
|
17
|
-
/** @internal */
|
|
18
|
-
dispose(): void;
|
|
19
|
-
}
|
|
1
|
+
import { RpcRequest, RpcRequestFulfillment } from "@itwin/core-common";
|
|
2
|
+
import { ElectronRpcProtocol } from "./ElectronRpcProtocol";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare class ElectronRpcRequest extends RpcRequest {
|
|
5
|
+
private _res;
|
|
6
|
+
private _fulfillment;
|
|
7
|
+
/** Convenience access to the protocol of this request. */
|
|
8
|
+
readonly protocol: ElectronRpcProtocol;
|
|
9
|
+
/** Sends the request. */
|
|
10
|
+
protected send(): Promise<number>;
|
|
11
|
+
/** Loads the request. */
|
|
12
|
+
protected load(): Promise<import("@itwin/core-common").RpcSerializedValue>;
|
|
13
|
+
/** Sets request header values. */
|
|
14
|
+
protected setHeader(_name: string, _value: string): void;
|
|
15
|
+
/** @internal */
|
|
16
|
+
notifyResponse(fulfillment: RpcRequestFulfillment): void;
|
|
17
|
+
/** @internal */
|
|
18
|
+
dispose(): void;
|
|
19
|
+
}
|
|
20
20
|
//# sourceMappingURL=ElectronRpcRequest.d.ts.map
|