@itwin/core-mobile 4.0.0-dev.8 → 4.0.0-dev.81

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/README.md +1 -1
  3. package/lib/cjs/MobileBackend.d.ts +7 -7
  4. package/lib/cjs/MobileBackend.js +28 -24
  5. package/lib/cjs/MobileBackend.js.map +1 -1
  6. package/lib/cjs/MobileFrontend.d.ts +5 -5
  7. package/lib/cjs/MobileFrontend.js +25 -21
  8. package/lib/cjs/MobileFrontend.js.map +1 -1
  9. package/lib/cjs/__DOC_ONLY__.d.ts +33 -33
  10. package/lib/cjs/__DOC_ONLY__.js +56 -52
  11. package/lib/cjs/__DOC_ONLY__.js.map +1 -1
  12. package/lib/cjs/backend/MobileAuthorizationBackend.d.ts +17 -17
  13. package/lib/cjs/backend/MobileAuthorizationBackend.js +46 -46
  14. package/lib/cjs/backend/MobileAuthorizationBackend.js.map +1 -1
  15. package/lib/cjs/backend/MobileFileHandler.d.ts +112 -112
  16. package/lib/cjs/backend/MobileFileHandler.d.ts.map +1 -1
  17. package/lib/cjs/backend/MobileFileHandler.js +263 -263
  18. package/lib/cjs/backend/MobileFileHandler.js.map +1 -1
  19. package/lib/cjs/backend/MobileHost.d.ts +72 -72
  20. package/lib/cjs/backend/MobileHost.d.ts.map +1 -1
  21. package/lib/cjs/backend/MobileHost.js +149 -156
  22. package/lib/cjs/backend/MobileHost.js.map +1 -1
  23. package/lib/cjs/backend/MobileRpcServer.d.ts +19 -19
  24. package/lib/cjs/backend/MobileRpcServer.js +156 -156
  25. package/lib/cjs/backend/MobileRpcServer.js.map +1 -1
  26. package/lib/cjs/backend/Request.d.ts +117 -149
  27. package/lib/cjs/backend/Request.d.ts.map +1 -1
  28. package/lib/cjs/backend/Request.js +255 -267
  29. package/lib/cjs/backend/Request.js.map +1 -1
  30. package/lib/cjs/common/MobileAppChannel.d.ts +4 -4
  31. package/lib/cjs/common/MobileAppChannel.js +11 -11
  32. package/lib/cjs/common/MobileAppChannel.js.map +1 -1
  33. package/lib/cjs/common/MobileAppProps.d.ts +35 -35
  34. package/lib/cjs/common/MobileAppProps.d.ts.map +1 -1
  35. package/lib/cjs/common/MobileAppProps.js +26 -26
  36. package/lib/cjs/common/MobileAppProps.js.map +1 -1
  37. package/lib/cjs/common/MobileEventLoop.d.ts +11 -11
  38. package/lib/cjs/common/MobileEventLoop.js +30 -30
  39. package/lib/cjs/common/MobileEventLoop.js.map +1 -1
  40. package/lib/cjs/common/MobileIpc.d.ts +17 -17
  41. package/lib/cjs/common/MobileIpc.js +70 -70
  42. package/lib/cjs/common/MobileIpc.js.map +1 -1
  43. package/lib/cjs/common/MobilePush.d.ts +20 -20
  44. package/lib/cjs/common/MobilePush.js +53 -53
  45. package/lib/cjs/common/MobilePush.js.map +1 -1
  46. package/lib/cjs/common/MobileRpcManager.d.ts +40 -40
  47. package/lib/cjs/common/MobileRpcManager.js +110 -110
  48. package/lib/cjs/common/MobileRpcManager.js.map +1 -1
  49. package/lib/cjs/common/MobileRpcProtocol.d.ts +58 -58
  50. package/lib/cjs/common/MobileRpcProtocol.d.ts.map +1 -1
  51. package/lib/cjs/common/MobileRpcProtocol.js +277 -277
  52. package/lib/cjs/common/MobileRpcProtocol.js.map +1 -1
  53. package/lib/cjs/common/MobileRpcRequest.d.ts +20 -20
  54. package/lib/cjs/common/MobileRpcRequest.js +50 -50
  55. package/lib/cjs/common/MobileRpcRequest.js.map +1 -1
  56. package/lib/cjs/frontend/MobileApp.d.ts +23 -23
  57. package/lib/cjs/frontend/MobileApp.d.ts.map +1 -1
  58. package/lib/cjs/frontend/MobileApp.js +79 -80
  59. package/lib/cjs/frontend/MobileApp.js.map +1 -1
  60. package/lib/cjs/frontend/MobileAuthorizationFrontend.d.ts +17 -17
  61. package/lib/cjs/frontend/MobileAuthorizationFrontend.d.ts.map +1 -1
  62. package/lib/cjs/frontend/MobileAuthorizationFrontend.js +54 -46
  63. package/lib/cjs/frontend/MobileAuthorizationFrontend.js.map +1 -1
  64. package/lib/cjs/test/ios/MobilePlatform.test.d.ts +1 -1
  65. package/lib/cjs/test/ios/MobilePlatform.test.js +84 -84
  66. package/lib/cjs/test/ios/MobilePlatform.test.js.map +1 -1
  67. package/package.json +18 -26
@@ -1,21 +1,21 @@
1
- /** @packageDocumentation
2
- * @module RpcInterface
3
- */
4
- import { RpcPushChannel, RpcPushConnection, RpcPushTransport, RpcRequestFulfillment } from "@itwin/core-common";
5
- import { MobileRpcProtocol } from "./MobileRpcProtocol";
6
- /** @internal */
7
- export declare class MobilePushTransport extends RpcPushTransport {
8
- private _protocol;
9
- private _last;
10
- get last(): number;
11
- constructor(protocol: MobileRpcProtocol);
12
- consume(response: RpcRequestFulfillment): boolean;
13
- }
14
- /** @internal */
15
- export declare class MobilePushConnection<T> extends RpcPushConnection<T> {
16
- private _protocol;
17
- private _next;
18
- constructor(channel: RpcPushChannel<T>, client: unknown, protocol: MobileRpcProtocol);
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 { MobileRpcProtocol } from "./MobileRpcProtocol";
6
+ /** @internal */
7
+ export declare class MobilePushTransport extends RpcPushTransport {
8
+ private _protocol;
9
+ private _last;
10
+ get last(): number;
11
+ constructor(protocol: MobileRpcProtocol);
12
+ consume(response: RpcRequestFulfillment): boolean;
13
+ }
14
+ /** @internal */
15
+ export declare class MobilePushConnection<T> extends RpcPushConnection<T> {
16
+ private _protocol;
17
+ private _next;
18
+ constructor(channel: RpcPushChannel<T>, client: unknown, protocol: MobileRpcProtocol);
19
+ send(messageData: any): Promise<void>;
20
+ }
21
21
  //# sourceMappingURL=MobilePush.d.ts.map
@@ -1,54 +1,54 @@
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.MobilePushConnection = exports.MobilePushTransport = void 0;
11
- const core_common_1 = require("@itwin/core-common");
12
- const MobileEventLoop_1 = require("./MobileEventLoop");
13
- const MobileRpcProtocol_1 = require("./MobileRpcProtocol");
14
- /* eslint-disable deprecation/deprecation */
15
- const PUSH = "__push__";
16
- /** @internal */
17
- class MobilePushTransport extends core_common_1.RpcPushTransport {
18
- constructor(protocol) {
19
- super();
20
- this._last = -1;
21
- this._protocol = protocol;
22
- }
23
- get last() { return this._last; }
24
- consume(response) {
25
- if (response.interfaceName !== PUSH) {
26
- return false;
27
- }
28
- this._last = response.status;
29
- if (this.onMessage) {
30
- const messageData = core_common_1.RpcMarshaling.deserialize(this._protocol, response.result);
31
- this.onMessage(response.id, messageData);
32
- }
33
- return true;
34
- }
35
- }
36
- exports.MobilePushTransport = MobilePushTransport;
37
- /** @internal */
38
- class MobilePushConnection extends core_common_1.RpcPushConnection {
39
- constructor(channel, client, protocol) {
40
- super(channel, client);
41
- this._next = -1;
42
- this._protocol = protocol;
43
- }
44
- async send(messageData) {
45
- MobileEventLoop_1.MobileEventLoop.addTask();
46
- const result = await core_common_1.RpcMarshaling.serialize(this._protocol, messageData);
47
- MobileEventLoop_1.MobileEventLoop.removeTask();
48
- const fulfillment = { result, rawResult: messageData, interfaceName: PUSH, id: this.channel.id, status: ++this._next };
49
- const encoded = MobileRpcProtocol_1.MobileRpcProtocol.encodeResponse(fulfillment);
50
- this._protocol.sendToFrontend(encoded);
51
- }
52
- }
53
- exports.MobilePushConnection = MobilePushConnection;
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.MobilePushConnection = exports.MobilePushTransport = void 0;
11
+ const core_common_1 = require("@itwin/core-common");
12
+ const MobileEventLoop_1 = require("./MobileEventLoop");
13
+ const MobileRpcProtocol_1 = require("./MobileRpcProtocol");
14
+ /* eslint-disable deprecation/deprecation */
15
+ const PUSH = "__push__";
16
+ /** @internal */
17
+ class MobilePushTransport extends core_common_1.RpcPushTransport {
18
+ get last() { return this._last; }
19
+ constructor(protocol) {
20
+ super();
21
+ this._last = -1;
22
+ this._protocol = protocol;
23
+ }
24
+ consume(response) {
25
+ if (response.interfaceName !== PUSH) {
26
+ return false;
27
+ }
28
+ this._last = response.status;
29
+ if (this.onMessage) {
30
+ const messageData = core_common_1.RpcMarshaling.deserialize(this._protocol, response.result);
31
+ this.onMessage(response.id, messageData);
32
+ }
33
+ return true;
34
+ }
35
+ }
36
+ exports.MobilePushTransport = MobilePushTransport;
37
+ /** @internal */
38
+ class MobilePushConnection extends core_common_1.RpcPushConnection {
39
+ constructor(channel, client, protocol) {
40
+ super(channel, client);
41
+ this._next = -1;
42
+ this._protocol = protocol;
43
+ }
44
+ async send(messageData) {
45
+ MobileEventLoop_1.MobileEventLoop.addTask();
46
+ const result = await core_common_1.RpcMarshaling.serialize(this._protocol, messageData);
47
+ MobileEventLoop_1.MobileEventLoop.removeTask();
48
+ const fulfillment = { result, rawResult: messageData, interfaceName: PUSH, id: this.channel.id, status: ++this._next };
49
+ const encoded = MobileRpcProtocol_1.MobileRpcProtocol.encodeResponse(fulfillment);
50
+ this._protocol.sendToFrontend(encoded);
51
+ }
52
+ }
53
+ exports.MobilePushConnection = MobilePushConnection;
54
54
  //# sourceMappingURL=MobilePush.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MobilePush.js","sourceRoot":"","sources":["../../../src/common/MobilePush.ts"],"names":[],"mappings":";AAAA;;;+FA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CAAe,CAAC,UAAU,EAAE,CAAC;QAE7B,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,MAAM,OAAO,GAAG,qCAAiB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAC9D,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACF;AAlBD,oDAkBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { RpcMarshaling, RpcPushChannel, RpcPushConnection, RpcPushTransport, RpcRequestFulfillment } from \"@itwin/core-common\";\r\nimport { MobileEventLoop } from \"./MobileEventLoop\";\r\nimport { MobileRpcProtocol } from \"./MobileRpcProtocol\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\nconst PUSH = \"__push__\";\r\n\r\n/** @internal */\r\nexport class MobilePushTransport extends RpcPushTransport {\r\n private _protocol: MobileRpcProtocol;\r\n private _last: number = -1;\r\n\r\n public get last() { return this._last; }\r\n\r\n public constructor(protocol: MobileRpcProtocol) {\r\n super();\r\n this._protocol = protocol;\r\n }\r\n\r\n public consume(response: RpcRequestFulfillment): boolean {\r\n if (response.interfaceName !== PUSH) {\r\n return false;\r\n }\r\n\r\n this._last = response.status;\r\n\r\n if (this.onMessage) {\r\n const messageData = RpcMarshaling.deserialize(this._protocol, response.result);\r\n this.onMessage(response.id, messageData);\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class MobilePushConnection<T> extends RpcPushConnection<T> {\r\n private _protocol: MobileRpcProtocol;\r\n private _next: number = -1;\r\n\r\n public constructor(channel: RpcPushChannel<T>, client: unknown, protocol: MobileRpcProtocol) {\r\n super(channel, client);\r\n this._protocol = protocol;\r\n }\r\n\r\n public async send(messageData: any) {\r\n MobileEventLoop.addTask();\r\n const result = await RpcMarshaling.serialize(this._protocol, messageData);\r\n MobileEventLoop.removeTask();\r\n\r\n const fulfillment: RpcRequestFulfillment = { result, rawResult: messageData, interfaceName: PUSH, id: this.channel.id, status: ++this._next };\r\n const encoded = MobileRpcProtocol.encodeResponse(fulfillment);\r\n this._protocol.sendToFrontend(encoded);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"MobilePush.js","sourceRoot":"","sources":["../../../src/common/MobilePush.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAA+H;AAC/H,uDAAoD;AACpD,2DAAwD;AAExD,4CAA4C;AAE5C,MAAM,IAAI,GAAG,UAAU,CAAC;AAExB,gBAAgB;AAChB,MAAa,mBAAoB,SAAQ,8BAAgB;IAIvD,IAAW,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAExC,YAAmB,QAA2B;QAC5C,KAAK,EAAE,CAAC;QALF,UAAK,GAAW,CAAC,CAAC,CAAC;QAMzB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAEM,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,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC/E,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;SAC1C;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAzBD,kDAyBC;AAED,gBAAgB;AAChB,MAAa,oBAAwB,SAAQ,+BAAoB;IAI/D,YAAmB,OAA0B,EAAE,MAAe,EAAE,QAA2B;QACzF,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAHjB,UAAK,GAAW,CAAC,CAAC,CAAC;QAIzB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,WAAgB;QAChC,iCAAe,CAAC,OAAO,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,MAAM,2BAAa,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC1E,iCAAe,CAAC,UAAU,EAAE,CAAC;QAE7B,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,MAAM,OAAO,GAAG,qCAAiB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAC9D,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACF;AAlBD,oDAkBC","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 { MobileEventLoop } from \"./MobileEventLoop\";\nimport { MobileRpcProtocol } from \"./MobileRpcProtocol\";\n\n/* eslint-disable deprecation/deprecation */\n\nconst PUSH = \"__push__\";\n\n/** @internal */\nexport class MobilePushTransport extends RpcPushTransport {\n private _protocol: MobileRpcProtocol;\n private _last: number = -1;\n\n public get last() { return this._last; }\n\n public constructor(protocol: MobileRpcProtocol) {\n super();\n this._protocol = protocol;\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._protocol, response.result);\n this.onMessage(response.id, messageData);\n }\n\n return true;\n }\n}\n\n/** @internal */\nexport class MobilePushConnection<T> extends RpcPushConnection<T> {\n private _protocol: MobileRpcProtocol;\n private _next: number = -1;\n\n public constructor(channel: RpcPushChannel<T>, client: unknown, protocol: MobileRpcProtocol) {\n super(channel, client);\n this._protocol = protocol;\n }\n\n public async send(messageData: any) {\n MobileEventLoop.addTask();\n const result = await RpcMarshaling.serialize(this._protocol, messageData);\n MobileEventLoop.removeTask();\n\n const fulfillment: RpcRequestFulfillment = { result, rawResult: messageData, interfaceName: PUSH, id: this.channel.id, status: ++this._next };\n const encoded = MobileRpcProtocol.encodeResponse(fulfillment);\n this._protocol.sendToFrontend(encoded);\n }\n}\n"]}
@@ -1,41 +1,41 @@
1
- import { RpcConfiguration, RpcInterfaceDefinition } from "@itwin/core-common";
2
- import { MobileRpcProtocol } from "./MobileRpcProtocol";
3
- /** RPC supported mobile platforms.
4
- * @internal
5
- */
6
- export declare enum RpcMobilePlatform {
7
- Unknown = 0,
8
- Android = 1,
9
- iOS = 2
10
- }
11
- /** Holds configuration for the RpcInterfaces used by the application.
12
- * @internal
13
- */
14
- export declare abstract class MobileRpcConfiguration extends RpcConfiguration {
15
- /** @internal */
16
- static setup: {
17
- obtainPort: () => number;
18
- checkPlatform: () => boolean;
19
- };
20
- abstract protocol: MobileRpcProtocol;
21
- private static _args;
22
- private static getArgs;
23
- private static getMobilePlatform;
24
- /** Read the mobile rpc args */
25
- static get args(): any;
26
- /** Return type of mobile platform using browser userAgent */
27
- static get platform(): RpcMobilePlatform;
28
- }
29
- /** Coordinates usage of RPC interfaces for an Mobile-based application.
30
- * @internal
31
- */
32
- export declare class MobileRpcManager {
33
- /** @internal */
34
- static ready(): Promise<void>;
35
- private static performInitialization;
36
- /** Initializes MobileRpcManager for the frontend of an application. */
37
- static initializeClient(interfaces: RpcInterfaceDefinition[]): MobileRpcConfiguration;
38
- /** Initializes MobileRpcManager for the backend of an application. */
39
- static initializeImpl(interfaces: RpcInterfaceDefinition[]): MobileRpcConfiguration;
40
- }
1
+ import { RpcConfiguration, RpcInterfaceDefinition } from "@itwin/core-common";
2
+ import { MobileRpcProtocol } from "./MobileRpcProtocol";
3
+ /** RPC supported mobile platforms.
4
+ * @internal
5
+ */
6
+ export declare enum RpcMobilePlatform {
7
+ Unknown = 0,
8
+ Android = 1,
9
+ iOS = 2
10
+ }
11
+ /** Holds configuration for the RpcInterfaces used by the application.
12
+ * @internal
13
+ */
14
+ export declare abstract class MobileRpcConfiguration extends RpcConfiguration {
15
+ /** @internal */
16
+ static setup: {
17
+ obtainPort: () => number;
18
+ checkPlatform: () => boolean;
19
+ };
20
+ abstract protocol: MobileRpcProtocol;
21
+ private static _args;
22
+ private static getArgs;
23
+ private static getMobilePlatform;
24
+ /** Read the mobile rpc args */
25
+ static get args(): any;
26
+ /** Return type of mobile platform using browser userAgent */
27
+ static get platform(): RpcMobilePlatform;
28
+ }
29
+ /** Coordinates usage of RPC interfaces for an Mobile-based application.
30
+ * @internal
31
+ */
32
+ export declare class MobileRpcManager {
33
+ /** @internal */
34
+ static ready(): Promise<void>;
35
+ private static performInitialization;
36
+ /** Initializes MobileRpcManager for the frontend of an application. */
37
+ static initializeClient(interfaces: RpcInterfaceDefinition[]): MobileRpcConfiguration;
38
+ /** Initializes MobileRpcManager for the backend of an application. */
39
+ static initializeImpl(interfaces: RpcInterfaceDefinition[]): MobileRpcConfiguration;
40
+ }
41
41
  //# sourceMappingURL=MobileRpcManager.d.ts.map
@@ -1,111 +1,111 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.MobileRpcManager = exports.MobileRpcConfiguration = exports.RpcMobilePlatform = void 0;
8
- const core_common_1 = require("@itwin/core-common");
9
- const MobileRpcProtocol_1 = require("./MobileRpcProtocol");
10
- /* eslint-disable deprecation/deprecation */
11
- /** RPC supported mobile platforms.
12
- * @internal
13
- */
14
- var RpcMobilePlatform;
15
- (function (RpcMobilePlatform) {
16
- RpcMobilePlatform[RpcMobilePlatform["Unknown"] = 0] = "Unknown";
17
- RpcMobilePlatform[RpcMobilePlatform["Android"] = 1] = "Android";
18
- RpcMobilePlatform[RpcMobilePlatform["iOS"] = 2] = "iOS";
19
- })(RpcMobilePlatform = exports.RpcMobilePlatform || (exports.RpcMobilePlatform = {}));
20
- /** Holds configuration for the RpcInterfaces used by the application.
21
- * @internal
22
- */
23
- class MobileRpcConfiguration extends core_common_1.RpcConfiguration {
24
- static getArgs() {
25
- if (typeof window !== "object" || typeof window.location !== "object" || typeof window.location.hash !== "string") {
26
- return Object.freeze({});
27
- }
28
- const queryArgs = {};
29
- try {
30
- const matches = window.location.hash.match(/([^#=&]+)(=([^&]*))?/g);
31
- if (matches) {
32
- for (const comp of matches) {
33
- const array = comp.split("=");
34
- if (array.length === 2) {
35
- const key = decodeURIComponent(array[0]);
36
- const val = decodeURIComponent(array[1]);
37
- queryArgs[key] = val;
38
- }
39
- }
40
- }
41
- }
42
- catch { }
43
- return Object.freeze(queryArgs);
44
- }
45
- static getMobilePlatform() {
46
- if (!MobileRpcConfiguration.args.platform)
47
- return RpcMobilePlatform.Unknown;
48
- const win = window;
49
- if (/android/i.test(MobileRpcConfiguration.args.platform)) {
50
- return RpcMobilePlatform.Android;
51
- }
52
- if (/iOS|iPadOS/i.test(MobileRpcConfiguration.args.platform) && !win.MSStream) {
53
- return RpcMobilePlatform.iOS;
54
- }
55
- return RpcMobilePlatform.Unknown;
56
- }
57
- /** Read the mobile rpc args */
58
- static get args() {
59
- if (!this._args) {
60
- this._args = MobileRpcConfiguration.getArgs();
61
- }
62
- return this._args;
63
- }
64
- /** Return type of mobile platform using browser userAgent */
65
- static get platform() { return MobileRpcConfiguration.getMobilePlatform(); }
66
- }
67
- exports.MobileRpcConfiguration = MobileRpcConfiguration;
68
- /** @internal */
69
- MobileRpcConfiguration.setup = {
70
- obtainPort: () => 0,
71
- checkPlatform: () => typeof (process) !== "undefined" && process.platform === "ios",
72
- };
73
- /** Coordinates usage of RPC interfaces for an Mobile-based application.
74
- * @internal
75
- */
76
- class MobileRpcManager {
77
- /** @internal */
78
- static async ready() {
79
- return new Promise(async (resolve) => {
80
- while (!global.__iTwinJsRpcReady) {
81
- await new Promise((r) => setTimeout(r));
82
- }
83
- resolve();
84
- });
85
- }
86
- static performInitialization(interfaces, endPoint) {
87
- const config = class extends MobileRpcConfiguration {
88
- constructor() {
89
- super(...arguments);
90
- this.interfaces = () => interfaces;
91
- this.protocol = new MobileRpcProtocol_1.MobileRpcProtocol(this, endPoint);
92
- }
93
- };
94
- for (const def of interfaces) {
95
- core_common_1.RpcConfiguration.assign(def, () => config);
96
- }
97
- const instance = core_common_1.RpcConfiguration.obtain(config);
98
- core_common_1.RpcConfiguration.initializeInterfaces(instance);
99
- return instance;
100
- }
101
- /** Initializes MobileRpcManager for the frontend of an application. */
102
- static initializeClient(interfaces) {
103
- return MobileRpcManager.performInitialization(interfaces, core_common_1.RpcEndpoint.Frontend);
104
- }
105
- /** Initializes MobileRpcManager for the backend of an application. */
106
- static initializeImpl(interfaces) {
107
- return MobileRpcManager.performInitialization(interfaces, core_common_1.RpcEndpoint.Backend);
108
- }
109
- }
110
- exports.MobileRpcManager = MobileRpcManager;
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
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.MobileRpcManager = exports.MobileRpcConfiguration = exports.RpcMobilePlatform = void 0;
8
+ const core_common_1 = require("@itwin/core-common");
9
+ const MobileRpcProtocol_1 = require("./MobileRpcProtocol");
10
+ /* eslint-disable deprecation/deprecation */
11
+ /** RPC supported mobile platforms.
12
+ * @internal
13
+ */
14
+ var RpcMobilePlatform;
15
+ (function (RpcMobilePlatform) {
16
+ RpcMobilePlatform[RpcMobilePlatform["Unknown"] = 0] = "Unknown";
17
+ RpcMobilePlatform[RpcMobilePlatform["Android"] = 1] = "Android";
18
+ RpcMobilePlatform[RpcMobilePlatform["iOS"] = 2] = "iOS";
19
+ })(RpcMobilePlatform = exports.RpcMobilePlatform || (exports.RpcMobilePlatform = {}));
20
+ /** Holds configuration for the RpcInterfaces used by the application.
21
+ * @internal
22
+ */
23
+ class MobileRpcConfiguration extends core_common_1.RpcConfiguration {
24
+ static getArgs() {
25
+ if (typeof window !== "object" || typeof window.location !== "object" || typeof window.location.hash !== "string") {
26
+ return Object.freeze({});
27
+ }
28
+ const queryArgs = {};
29
+ try {
30
+ const matches = window.location.hash.match(/([^#=&]+)(=([^&]*))?/g);
31
+ if (matches) {
32
+ for (const comp of matches) {
33
+ const array = comp.split("=");
34
+ if (array.length === 2) {
35
+ const key = decodeURIComponent(array[0]);
36
+ const val = decodeURIComponent(array[1]);
37
+ queryArgs[key] = val;
38
+ }
39
+ }
40
+ }
41
+ }
42
+ catch { }
43
+ return Object.freeze(queryArgs);
44
+ }
45
+ static getMobilePlatform() {
46
+ if (!MobileRpcConfiguration.args.platform)
47
+ return RpcMobilePlatform.Unknown;
48
+ const win = window;
49
+ if (/android/i.test(MobileRpcConfiguration.args.platform)) {
50
+ return RpcMobilePlatform.Android;
51
+ }
52
+ if (/iOS|iPadOS/i.test(MobileRpcConfiguration.args.platform) && !win.MSStream) {
53
+ return RpcMobilePlatform.iOS;
54
+ }
55
+ return RpcMobilePlatform.Unknown;
56
+ }
57
+ /** Read the mobile rpc args */
58
+ static get args() {
59
+ if (!this._args) {
60
+ this._args = MobileRpcConfiguration.getArgs();
61
+ }
62
+ return this._args;
63
+ }
64
+ /** Return type of mobile platform using browser userAgent */
65
+ static get platform() { return MobileRpcConfiguration.getMobilePlatform(); }
66
+ }
67
+ /** @internal */
68
+ MobileRpcConfiguration.setup = {
69
+ obtainPort: () => 0,
70
+ checkPlatform: () => typeof (process) !== "undefined" && process.platform === "ios",
71
+ };
72
+ exports.MobileRpcConfiguration = MobileRpcConfiguration;
73
+ /** Coordinates usage of RPC interfaces for an Mobile-based application.
74
+ * @internal
75
+ */
76
+ class MobileRpcManager {
77
+ /** @internal */
78
+ static async ready() {
79
+ return new Promise(async (resolve) => {
80
+ while (!global.__iTwinJsRpcReady) {
81
+ await new Promise((r) => setTimeout(r));
82
+ }
83
+ resolve();
84
+ });
85
+ }
86
+ static performInitialization(interfaces, endPoint) {
87
+ const config = class extends MobileRpcConfiguration {
88
+ constructor() {
89
+ super(...arguments);
90
+ this.interfaces = () => interfaces;
91
+ this.protocol = new MobileRpcProtocol_1.MobileRpcProtocol(this, endPoint);
92
+ }
93
+ };
94
+ for (const def of interfaces) {
95
+ core_common_1.RpcConfiguration.assign(def, () => config);
96
+ }
97
+ const instance = core_common_1.RpcConfiguration.obtain(config);
98
+ core_common_1.RpcConfiguration.initializeInterfaces(instance);
99
+ return instance;
100
+ }
101
+ /** Initializes MobileRpcManager for the frontend of an application. */
102
+ static initializeClient(interfaces) {
103
+ return MobileRpcManager.performInitialization(interfaces, core_common_1.RpcEndpoint.Frontend);
104
+ }
105
+ /** Initializes MobileRpcManager for the backend of an application. */
106
+ static initializeImpl(interfaces) {
107
+ return MobileRpcManager.performInitialization(interfaces, core_common_1.RpcEndpoint.Backend);
108
+ }
109
+ }
110
+ exports.MobileRpcManager = MobileRpcManager;
111
111
  //# sourceMapping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AM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;aACzC;YAED,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,UAAoC,EAAE,QAAqB;QAC9F,MAAM,MAAM,GAAG,KAAM,SAAQ,sBAAsB;YAApC;;gBACN,eAAU,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC;gBAC9B,aAAQ,GAAsB,IAAI,qCAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC7E,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,uEAAuE;IAChE,MAAM,CAAC,gBAAgB,CAAC,UAAoC;QACjE,OAAO,gBAAgB,CAAC,qBAAqB,CAAC,UAAU,EAAE,yBAAW,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IACD,sEAAsE;IAC/D,MAAM,CAAC,cAAc,CAAC,UAAoC;QAC/D,OAAO,gBAAgB,CAAC,qBAAqB,CAAC,UAAU,EAAE,yBAAW,CAAC,OAAO,CAAC,CAAC;IACjF,CAAC;CACF;AApCD,4CAoCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { RpcConfiguration, RpcEndpoint, RpcInterfaceDefinition } from \"@itwin/core-common\";\r\nimport { MobileRpcProtocol } from \"./MobileRpcProtocol\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** RPC supported mobile platforms.\r\n * @internal\r\n */\r\nexport enum RpcMobilePlatform {\r\n Unknown,\r\n Android,\r\n iOS,\r\n}\r\n\r\n/** Holds configuration for the RpcInterfaces used by the application.\r\n * @internal\r\n */\r\nexport abstract class MobileRpcConfiguration extends RpcConfiguration {\r\n /** @internal */\r\n public static setup = {\r\n obtainPort: () => 0,\r\n checkPlatform: () => typeof (process) !== \"undefined\" && (process.platform as any) === \"ios\",\r\n };\r\n\r\n public abstract override protocol: MobileRpcProtocol;\r\n private static _args: any;\r\n private static getArgs(): any {\r\n if (typeof window !== \"object\" || typeof window.location !== \"object\" || typeof window.location.hash !== \"string\") {\r\n return Object.freeze({});\r\n }\r\n const queryArgs: any = {};\r\n try {\r\n const matches = window.location.hash.match(/([^#=&]+)(=([^&]*))?/g);\r\n if (matches) {\r\n for (const comp of matches) {\r\n const array = comp.split(\"=\");\r\n if (array.length === 2) {\r\n const key = decodeURIComponent(array[0]);\r\n const val = decodeURIComponent(array[1]);\r\n queryArgs[key] = val;\r\n }\r\n }\r\n }\r\n } catch { }\r\n return Object.freeze(queryArgs);\r\n }\r\n private static getMobilePlatform(): RpcMobilePlatform {\r\n if (!MobileRpcConfiguration.args.platform)\r\n return RpcMobilePlatform.Unknown;\r\n\r\n const win: any = window;\r\n if (/android/i.test(MobileRpcConfiguration.args.platform)) {\r\n return RpcMobilePlatform.Android;\r\n }\r\n\r\n if (/iOS|iPadOS/i.test(MobileRpcConfiguration.args.platform) && !win.MSStream) {\r\n return RpcMobilePlatform.iOS;\r\n }\r\n\r\n return RpcMobilePlatform.Unknown;\r\n }\r\n /** Read the mobile rpc args */\r\n public static get args(): any {\r\n if (!this._args) {\r\n this._args = MobileRpcConfiguration.getArgs();\r\n }\r\n return this._args;\r\n }\r\n\r\n /** Return type of mobile platform using browser userAgent */\r\n public static get platform(): RpcMobilePlatform { return MobileRpcConfiguration.getMobilePlatform(); }\r\n}\r\n\r\n/** Coordinates usage of RPC interfaces for an Mobile-based application.\r\n * @internal\r\n */\r\nexport class MobileRpcManager {\r\n /** @internal */\r\n public static async ready() {\r\n return new Promise<void>(async (resolve) => {\r\n while (!(global as any).__iTwinJsRpcReady) {\r\n await new Promise((r) => setTimeout(r));\r\n }\r\n\r\n resolve();\r\n });\r\n }\r\n\r\n private static performInitialization(interfaces: RpcInterfaceDefinition[], endPoint: RpcEndpoint): MobileRpcConfiguration {\r\n const config = class extends MobileRpcConfiguration {\r\n public interfaces = () => interfaces;\r\n public protocol: MobileRpcProtocol = new MobileRpcProtocol(this, endPoint);\r\n };\r\n\r\n for (const def of interfaces) {\r\n RpcConfiguration.assign(def, () => config);\r\n }\r\n\r\n const instance = RpcConfiguration.obtain(config);\r\n RpcConfiguration.initializeInterfaces(instance);\r\n\r\n return instance;\r\n }\r\n\r\n /** Initializes MobileRpcManager for the frontend of an application. */\r\n public static initializeClient(interfaces: RpcInterfaceDefinition[]): MobileRpcConfiguration {\r\n return MobileRpcManager.performInitialization(interfaces, RpcEndpoint.Frontend);\r\n }\r\n /** Initializes MobileRpcManager for the backend of an application. */\r\n public static initializeImpl(interfaces: RpcInterfaceDefinition[]): MobileRpcConfiguration {\r\n return MobileRpcManager.performInitialization(interfaces, RpcEndpoint.Backend);\r\n }\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"MobileRpcManager.js","sourceRoot":"","sources":["../../../src/common/MobileRpcManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,oDAA2F;AAC3F,2DAAwD;AAExD,4CAA4C;AAE5C;;GAEG;AACH,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,+DAAO,CAAA;IACP,+DAAO,CAAA;IACP,uDAAG,CAAA;AACL,CAAC,EAJW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAI5B;AAED;;GAEG;AACH,MAAsB,sBAAuB,SAAQ,8BAAgB;IAS3D,MA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,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,uEAAuE;IAChE,MAAM,CAAC,gBAAgB,CAAC,UAAoC;QACjE,OAAO,gBAAgB,CAAC,qBAAqB,CAAC,UAAU,EAAE,yBAAW,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IACD,sEAAsE;IAC/D,MAAM,CAAC,cAAc,CAAC,UAAoC;QAC/D,OAAO,gBAAgB,CAAC,qBAAqB,CAAC,UAAU,EAAE,yBAAW,CAAC,OAAO,CAAC,CAAC;IACjF,CAAC;CACF;AApCD,4CAoCC","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\nimport { RpcConfiguration, RpcEndpoint, RpcInterfaceDefinition } from \"@itwin/core-common\";\nimport { MobileRpcProtocol } from \"./MobileRpcProtocol\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** RPC supported mobile platforms.\n * @internal\n */\nexport enum RpcMobilePlatform {\n Unknown,\n Android,\n iOS,\n}\n\n/** Holds configuration for the RpcInterfaces used by the application.\n * @internal\n */\nexport abstract class MobileRpcConfiguration extends RpcConfiguration {\n /** @internal */\n public static setup = {\n obtainPort: () => 0,\n checkPlatform: () => typeof (process) !== \"undefined\" && (process.platform as any) === \"ios\",\n };\n\n public abstract override protocol: MobileRpcProtocol;\n private static _args: any;\n private static getArgs(): any {\n if (typeof window !== \"object\" || typeof window.location !== \"object\" || typeof window.location.hash !== \"string\") {\n return Object.freeze({});\n }\n const queryArgs: any = {};\n try {\n const matches = window.location.hash.match(/([^#=&]+)(=([^&]*))?/g);\n if (matches) {\n for (const comp of matches) {\n const array = comp.split(\"=\");\n if (array.length === 2) {\n const key = decodeURIComponent(array[0]);\n const val = decodeURIComponent(array[1]);\n queryArgs[key] = val;\n }\n }\n }\n } catch { }\n return Object.freeze(queryArgs);\n }\n private static getMobilePlatform(): RpcMobilePlatform {\n if (!MobileRpcConfiguration.args.platform)\n return RpcMobilePlatform.Unknown;\n\n const win: any = window;\n if (/android/i.test(MobileRpcConfiguration.args.platform)) {\n return RpcMobilePlatform.Android;\n }\n\n if (/iOS|iPadOS/i.test(MobileRpcConfiguration.args.platform) && !win.MSStream) {\n return RpcMobilePlatform.iOS;\n }\n\n return RpcMobilePlatform.Unknown;\n }\n /** Read the mobile rpc args */\n public static get args(): any {\n if (!this._args) {\n this._args = MobileRpcConfiguration.getArgs();\n }\n return this._args;\n }\n\n /** Return type of mobile platform using browser userAgent */\n public static get platform(): RpcMobilePlatform { return MobileRpcConfiguration.getMobilePlatform(); }\n}\n\n/** Coordinates usage of RPC interfaces for an Mobile-based application.\n * @internal\n */\nexport class MobileRpcManager {\n /** @internal */\n public static async ready() {\n return new Promise<void>(async (resolve) => {\n while (!(global as any).__iTwinJsRpcReady) {\n await new Promise((r) => setTimeout(r));\n }\n\n resolve();\n });\n }\n\n private static performInitialization(interfaces: RpcInterfaceDefinition[], endPoint: RpcEndpoint): MobileRpcConfiguration {\n const config = class extends MobileRpcConfiguration {\n public interfaces = () => interfaces;\n public protocol: MobileRpcProtocol = new MobileRpcProtocol(this, endPoint);\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 /** Initializes MobileRpcManager for the frontend of an application. */\n public static initializeClient(interfaces: RpcInterfaceDefinition[]): MobileRpcConfiguration {\n return MobileRpcManager.performInitialization(interfaces, RpcEndpoint.Frontend);\n }\n /** Initializes MobileRpcManager for the backend of an application. */\n public static initializeImpl(interfaces: RpcInterfaceDefinition[]): MobileRpcConfiguration {\n return MobileRpcManager.performInitialization(interfaces, RpcEndpoint.Backend);\n }\n}\n\n"]}
@@ -1,59 +1,59 @@
1
- /** @packageDocumentation
2
- * @module RpcInterface
3
- */
4
- import { RpcEndpoint, RpcProtocol, RpcRequestFulfillment } from "@itwin/core-common";
5
- import { MobileRpcConfiguration } from "./MobileRpcManager";
6
- import { MobileRpcRequest } from "./MobileRpcRequest";
7
- /** @internal */
8
- export declare type MobileRpcChunks = Array<string | Uint8Array>;
9
- /** @internal */
10
- export interface MobileRpcGateway {
11
- handler: (payload: ArrayBuffer | string, connectionId: number) => void;
12
- sendString: (message: string, connectionId: number) => void;
13
- sendBinary: (message: Uint8Array, connectionId: number) => void;
14
- port: number;
15
- connectionId: number;
16
- }
17
- /** RPC interface protocol for an Mobile-based application.
18
- * @internal
19
- */
20
- export declare class MobileRpcProtocol extends RpcProtocol {
21
- socket: WebSocket;
22
- requests: Map<string, MobileRpcRequest>;
23
- private _pending;
24
- private _capacity;
25
- private _sendInterval;
26
- private _sendIntervalHandler;
27
- readonly requestType: typeof MobileRpcRequest;
28
- private _partialRequest;
29
- private _partialFulfillment;
30
- private _partialData;
31
- private _port;
32
- private _transport?;
33
- private _ipc;
34
- static obtainInterop(): MobileRpcGateway;
35
- static encodeRequest(request: MobileRpcRequest): Promise<MobileRpcChunks>;
36
- static encodeResponse(fulfillment: RpcRequestFulfillment): MobileRpcChunks;
37
- constructor(configuration: MobileRpcConfiguration, endPoint: RpcEndpoint);
38
- private initializeFrontend;
39
- private connect;
40
- private connectMessageHandler;
41
- private connectOpenHandler;
42
- private connectErrorHandler;
43
- private reset;
44
- private scheduleSend;
45
- private trySend;
46
- private handleMessageFromBackend;
47
- private handleStringFromBackend;
48
- private handleBinaryFromBackend;
49
- private notifyResponse;
50
- private consumePartialData;
51
- private initializeBackend;
52
- private handleMessageFromFrontend;
53
- private handleStringFromFrontend;
54
- private handleBinaryFromFrontend;
55
- private notifyRequest;
56
- sendToBackend(message: MobileRpcChunks): void;
57
- sendToFrontend(message: MobileRpcChunks, connection?: number): void;
58
- }
1
+ /** @packageDocumentation
2
+ * @module RpcInterface
3
+ */
4
+ import { RpcEndpoint, RpcProtocol, RpcRequestFulfillment } from "@itwin/core-common";
5
+ import { MobileRpcConfiguration } from "./MobileRpcManager";
6
+ import { MobileRpcRequest } from "./MobileRpcRequest";
7
+ /** @internal */
8
+ export type MobileRpcChunks = Array<string | Uint8Array>;
9
+ /** @internal */
10
+ export interface MobileRpcGateway {
11
+ handler: (payload: ArrayBuffer | string, connectionId: number) => void;
12
+ sendString: (message: string, connectionId: number) => void;
13
+ sendBinary: (message: Uint8Array, connectionId: number) => void;
14
+ port: number;
15
+ connectionId: number;
16
+ }
17
+ /** RPC interface protocol for an Mobile-based application.
18
+ * @internal
19
+ */
20
+ export declare class MobileRpcProtocol extends RpcProtocol {
21
+ socket: WebSocket;
22
+ requests: Map<string, MobileRpcRequest>;
23
+ private _pending;
24
+ private _capacity;
25
+ private _sendInterval;
26
+ private _sendIntervalHandler;
27
+ readonly requestType: typeof MobileRpcRequest;
28
+ private _partialRequest;
29
+ private _partialFulfillment;
30
+ private _partialData;
31
+ private _port;
32
+ private _transport?;
33
+ private _ipc;
34
+ static obtainInterop(): MobileRpcGateway;
35
+ static encodeRequest(request: MobileRpcRequest): Promise<MobileRpcChunks>;
36
+ static encodeResponse(fulfillment: RpcRequestFulfillment): MobileRpcChunks;
37
+ constructor(configuration: MobileRpcConfiguration, endPoint: RpcEndpoint);
38
+ private initializeFrontend;
39
+ private connect;
40
+ private connectMessageHandler;
41
+ private connectOpenHandler;
42
+ private connectErrorHandler;
43
+ private reset;
44
+ private scheduleSend;
45
+ private trySend;
46
+ private handleMessageFromBackend;
47
+ private handleStringFromBackend;
48
+ private handleBinaryFromBackend;
49
+ private notifyResponse;
50
+ private consumePartialData;
51
+ private initializeBackend;
52
+ private handleMessageFromFrontend;
53
+ private handleStringFromFrontend;
54
+ private handleBinaryFromFrontend;
55
+ private notifyRequest;
56
+ sendToBackend(message: MobileRpcChunks): void;
57
+ sendToFrontend(message: MobileRpcChunks, connection?: number): void;
58
+ }
59
59
  //# sourceMappingURL=MobileRpcProtocol.d.ts.map