@itwin/core-mobile 4.0.0-dev.1 → 4.0.0-dev.100

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 (64) hide show
  1. package/CHANGELOG.md +58 -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.d.ts.map +1 -1
  14. package/lib/cjs/backend/MobileAuthorizationBackend.js +54 -46
  15. package/lib/cjs/backend/MobileAuthorizationBackend.js.map +1 -1
  16. package/lib/cjs/backend/MobileFileHandler.d.ts +112 -112
  17. package/lib/cjs/backend/MobileFileHandler.d.ts.map +1 -1
  18. package/lib/cjs/backend/MobileFileHandler.js +263 -263
  19. package/lib/cjs/backend/MobileFileHandler.js.map +1 -1
  20. package/lib/cjs/backend/MobileHost.d.ts +72 -72
  21. package/lib/cjs/backend/MobileHost.d.ts.map +1 -1
  22. package/lib/cjs/backend/MobileHost.js +151 -156
  23. package/lib/cjs/backend/MobileHost.js.map +1 -1
  24. package/lib/cjs/backend/MobileRpcServer.d.ts +21 -19
  25. package/lib/cjs/backend/MobileRpcServer.d.ts.map +1 -1
  26. package/lib/cjs/backend/MobileRpcServer.js +179 -156
  27. package/lib/cjs/backend/MobileRpcServer.js.map +1 -1
  28. package/lib/cjs/backend/Request.d.ts +117 -149
  29. package/lib/cjs/backend/Request.d.ts.map +1 -1
  30. package/lib/cjs/backend/Request.js +255 -267
  31. package/lib/cjs/backend/Request.js.map +1 -1
  32. package/lib/cjs/common/MobileAppChannel.d.ts +4 -4
  33. package/lib/cjs/common/MobileAppChannel.js +11 -11
  34. package/lib/cjs/common/MobileAppProps.d.ts +35 -35
  35. package/lib/cjs/common/MobileAppProps.d.ts.map +1 -1
  36. package/lib/cjs/common/MobileAppProps.js +26 -26
  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/MobilePush.d.ts +20 -20
  43. package/lib/cjs/common/MobilePush.js +53 -53
  44. package/lib/cjs/common/MobilePush.js.map +1 -1
  45. package/lib/cjs/common/MobileRpcManager.d.ts +40 -40
  46. package/lib/cjs/common/MobileRpcManager.js +110 -110
  47. package/lib/cjs/common/MobileRpcManager.js.map +1 -1
  48. package/lib/cjs/common/MobileRpcProtocol.d.ts +58 -58
  49. package/lib/cjs/common/MobileRpcProtocol.d.ts.map +1 -1
  50. package/lib/cjs/common/MobileRpcProtocol.js +277 -277
  51. package/lib/cjs/common/MobileRpcProtocol.js.map +1 -1
  52. package/lib/cjs/common/MobileRpcRequest.d.ts +20 -20
  53. package/lib/cjs/common/MobileRpcRequest.js +50 -50
  54. package/lib/cjs/frontend/MobileApp.d.ts +23 -23
  55. package/lib/cjs/frontend/MobileApp.d.ts.map +1 -1
  56. package/lib/cjs/frontend/MobileApp.js +79 -80
  57. package/lib/cjs/frontend/MobileApp.js.map +1 -1
  58. package/lib/cjs/frontend/MobileAuthorizationFrontend.d.ts +17 -17
  59. package/lib/cjs/frontend/MobileAuthorizationFrontend.d.ts.map +1 -1
  60. package/lib/cjs/frontend/MobileAuthorizationFrontend.js +54 -46
  61. package/lib/cjs/frontend/MobileAuthorizationFrontend.js.map +1 -1
  62. package/lib/cjs/test/ios/MobilePlatform.test.d.ts +1 -1
  63. package/lib/cjs/test/ios/MobilePlatform.test.js +84 -84
  64. package/package.json +18 -27
@@ -1,5 +1,5 @@
1
- /** @internal */
2
- export declare const mobileAppChannel = "mobileApp";
3
- /** @internal */
4
- export declare const mobileAppNotify = "mobileApp-notify";
1
+ /** @internal */
2
+ export declare const mobileAppChannel = "mobileApp";
3
+ /** @internal */
4
+ export declare const mobileAppNotify = "mobileApp-notify";
5
5
  //# sourceMappingURL=MobileAppChannel.d.ts.map
@@ -1,12 +1,12 @@
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.mobileAppNotify = exports.mobileAppChannel = void 0;
8
- /** @internal */
9
- exports.mobileAppChannel = "mobileApp";
10
- /** @internal */
11
- exports.mobileAppNotify = "mobileApp-notify";
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.mobileAppNotify = exports.mobileAppChannel = void 0;
8
+ /** @internal */
9
+ exports.mobileAppChannel = "mobileApp";
10
+ /** @internal */
11
+ exports.mobileAppNotify = "mobileApp-notify";
12
12
  //# sourceMappingURL=MobileAppChannel.js.map
@@ -1,36 +1,36 @@
1
- import { AccessToken } from "@itwin/core-bentley";
2
- /** @beta */
3
- export declare enum Orientation {
4
- Unknown = 0,
5
- Portrait = 1,
6
- PortraitUpsideDown = 2,
7
- LandscapeLeft = 4,
8
- LandscapeRight = 8,
9
- FaceUp = 16,
10
- FaceDown = 32
11
- }
12
- /** @beta */
13
- export declare enum BatteryState {
14
- Unknown = 0,
15
- Unplugged = 1,
16
- Charging = 2,
17
- Full = 3
18
- }
19
- /** @beta */
20
- export interface MobileNotifications {
21
- notifyMemoryWarning: () => void;
22
- notifyOrientationChanged: () => void;
23
- notifyWillTerminate: () => void;
24
- notifyAuthAccessTokenChanged: (accessToken: string | undefined, expirationDate: string | undefined) => void;
25
- }
26
- /** @beta */
27
- export declare type DeviceEvents = "memoryWarning" | "orientationChanged" | "enterForeground" | "enterBackground" | "willTerminate" | "authAccessTokenChanged";
28
- /**
29
- * The methods that may be invoked via Ipc from the frontend of a Mobile App that are implemented on its backend.
30
- * @beta
31
- */
32
- export interface MobileAppFunctions {
33
- reconnect: (connection: number) => Promise<void>;
34
- getAccessToken: () => Promise<[AccessToken, string]>;
35
- }
1
+ import { AccessToken } from "@itwin/core-bentley";
2
+ /** @beta */
3
+ export declare enum Orientation {
4
+ Unknown = 0,
5
+ Portrait = 1,
6
+ PortraitUpsideDown = 2,
7
+ LandscapeLeft = 4,
8
+ LandscapeRight = 8,
9
+ FaceUp = 16,
10
+ FaceDown = 32
11
+ }
12
+ /** @beta */
13
+ export declare enum BatteryState {
14
+ Unknown = 0,
15
+ Unplugged = 1,
16
+ Charging = 2,
17
+ Full = 3
18
+ }
19
+ /** @beta */
20
+ export interface MobileNotifications {
21
+ notifyMemoryWarning: () => void;
22
+ notifyOrientationChanged: () => void;
23
+ notifyWillTerminate: () => void;
24
+ notifyAuthAccessTokenChanged: (accessToken: string | undefined, expirationDate: string | undefined) => void;
25
+ }
26
+ /** @beta */
27
+ export type DeviceEvents = "memoryWarning" | "orientationChanged" | "enterForeground" | "enterBackground" | "willTerminate" | "authAccessTokenChanged";
28
+ /**
29
+ * The methods that may be invoked via Ipc from the frontend of a Mobile App that are implemented on its backend.
30
+ * @beta
31
+ */
32
+ export interface MobileAppFunctions {
33
+ reconnect: (connection: number) => Promise<void>;
34
+ getAccessToken: () => Promise<[AccessToken, string]>;
35
+ }
36
36
  //# sourceMappingURL=MobileAppProps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MobileAppProps.d.ts","sourceRoot":"","sources":["../../../src/common/MobileAppProps.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,YAAY;AACZ,oBAAY,WAAW;IACrB,OAAO,IAAI;IACX,QAAQ,IAAM;IACd,kBAAkB,IAAM;IACxB,aAAa,IAAM;IACnB,cAAc,IAAM;IACpB,MAAM,KAAO;IACb,QAAQ,KAAO;CAChB;AAED,YAAY;AACZ,oBAAY,YAAY;IACtB,OAAO,IAAI;IACX,SAAS,IAAI;IACb,QAAQ,IAAI;IACZ,IAAI,IAAI;CACT;AAED,YAAY;AACZ,MAAM,WAAW,mBAAmB;IAClC,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,4BAA4B,EAAE,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,cAAc,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC7G;AAED,YAAY;AACZ,oBAAY,YAAY,GAAG,eAAe,GAAG,oBAAoB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,eAAe,GAAG,wBAAwB,CAAC;AAEvJ;;;EAGE;AACF,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,cAAc,EAAE,MAAM,OAAO,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;CACtD"}
1
+ {"version":3,"file":"MobileAppProps.d.ts","sourceRoot":"","sources":["../../../src/common/MobileAppProps.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,YAAY;AACZ,oBAAY,WAAW;IACrB,OAAO,IAAI;IACX,QAAQ,IAAM;IACd,kBAAkB,IAAM;IACxB,aAAa,IAAM;IACnB,cAAc,IAAM;IACpB,MAAM,KAAO;IACb,QAAQ,KAAO;CAChB;AAED,YAAY;AACZ,oBAAY,YAAY;IACtB,OAAO,IAAI;IACX,SAAS,IAAI;IACb,QAAQ,IAAI;IACZ,IAAI,IAAI;CACT;AAED,YAAY;AACZ,MAAM,WAAW,mBAAmB;IAClC,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,4BAA4B,EAAE,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,cAAc,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC7G;AAED,YAAY;AACZ,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,oBAAoB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,eAAe,GAAG,wBAAwB,CAAC;AAEvJ;;;EAGE;AACF,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,cAAc,EAAE,MAAM,OAAO,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;CACtD"}
@@ -1,27 +1,27 @@
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.BatteryState = exports.Orientation = void 0;
8
- /** @beta */
9
- var Orientation;
10
- (function (Orientation) {
11
- Orientation[Orientation["Unknown"] = 0] = "Unknown";
12
- Orientation[Orientation["Portrait"] = 1] = "Portrait";
13
- Orientation[Orientation["PortraitUpsideDown"] = 2] = "PortraitUpsideDown";
14
- Orientation[Orientation["LandscapeLeft"] = 4] = "LandscapeLeft";
15
- Orientation[Orientation["LandscapeRight"] = 8] = "LandscapeRight";
16
- Orientation[Orientation["FaceUp"] = 16] = "FaceUp";
17
- Orientation[Orientation["FaceDown"] = 32] = "FaceDown";
18
- })(Orientation = exports.Orientation || (exports.Orientation = {}));
19
- /** @beta */
20
- var BatteryState;
21
- (function (BatteryState) {
22
- BatteryState[BatteryState["Unknown"] = 0] = "Unknown";
23
- BatteryState[BatteryState["Unplugged"] = 1] = "Unplugged";
24
- BatteryState[BatteryState["Charging"] = 2] = "Charging";
25
- BatteryState[BatteryState["Full"] = 3] = "Full";
26
- })(BatteryState = exports.BatteryState || (exports.BatteryState = {}));
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.BatteryState = exports.Orientation = void 0;
8
+ /** @beta */
9
+ var Orientation;
10
+ (function (Orientation) {
11
+ Orientation[Orientation["Unknown"] = 0] = "Unknown";
12
+ Orientation[Orientation["Portrait"] = 1] = "Portrait";
13
+ Orientation[Orientation["PortraitUpsideDown"] = 2] = "PortraitUpsideDown";
14
+ Orientation[Orientation["LandscapeLeft"] = 4] = "LandscapeLeft";
15
+ Orientation[Orientation["LandscapeRight"] = 8] = "LandscapeRight";
16
+ Orientation[Orientation["FaceUp"] = 16] = "FaceUp";
17
+ Orientation[Orientation["FaceDown"] = 32] = "FaceDown";
18
+ })(Orientation = exports.Orientation || (exports.Orientation = {}));
19
+ /** @beta */
20
+ var BatteryState;
21
+ (function (BatteryState) {
22
+ BatteryState[BatteryState["Unknown"] = 0] = "Unknown";
23
+ BatteryState[BatteryState["Unplugged"] = 1] = "Unplugged";
24
+ BatteryState[BatteryState["Charging"] = 2] = "Charging";
25
+ BatteryState[BatteryState["Full"] = 3] = "Full";
26
+ })(BatteryState = exports.BatteryState || (exports.BatteryState = {}));
27
27
  //# sourceMappingURL=MobileAppProps.js.map
@@ -1,12 +1,12 @@
1
- /** @packageDocumentation
2
- * @module RpcInterface
3
- */
4
- /** @internal */
5
- export declare class MobileEventLoop {
6
- private static _activeTasks;
7
- private static _idleCallback;
8
- static addTask(): void;
9
- static removeTask(): void;
10
- private static _idleHandler;
11
- }
1
+ /** @packageDocumentation
2
+ * @module RpcInterface
3
+ */
4
+ /** @internal */
5
+ export declare class MobileEventLoop {
6
+ private static _activeTasks;
7
+ private static _idleCallback;
8
+ static addTask(): void;
9
+ static removeTask(): void;
10
+ private static _idleHandler;
11
+ }
12
12
  //# sourceMappingURL=MobileEventLoop.d.ts.map
@@ -1,31 +1,31 @@
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.MobileEventLoop = void 0;
11
- /** @internal */
12
- class MobileEventLoop {
13
- static addTask() {
14
- ++this._activeTasks;
15
- if (this._idleCallback === null) {
16
- this._idleCallback = setInterval(() => this._idleHandler());
17
- }
18
- }
19
- static removeTask() {
20
- --this._activeTasks;
21
- if (this._activeTasks === 0 && this._idleCallback !== null) {
22
- clearInterval(this._idleCallback);
23
- this._idleCallback = null;
24
- }
25
- }
26
- static _idleHandler() { }
27
- }
28
- exports.MobileEventLoop = MobileEventLoop;
29
- MobileEventLoop._activeTasks = 0;
30
- MobileEventLoop._idleCallback = null;
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.MobileEventLoop = void 0;
11
+ /** @internal */
12
+ class MobileEventLoop {
13
+ static addTask() {
14
+ ++this._activeTasks;
15
+ if (this._idleCallback === null) {
16
+ this._idleCallback = setInterval(() => this._idleHandler());
17
+ }
18
+ }
19
+ static removeTask() {
20
+ --this._activeTasks;
21
+ if (this._activeTasks === 0 && this._idleCallback !== null) {
22
+ clearInterval(this._idleCallback);
23
+ this._idleCallback = null;
24
+ }
25
+ }
26
+ static _idleHandler() { }
27
+ }
28
+ MobileEventLoop._activeTasks = 0;
29
+ MobileEventLoop._idleCallback = null;
30
+ exports.MobileEventLoop = MobileEventLoop;
31
31
  //# sourceMappingURL=MobileEventLoop.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MobileEventLoop.js","sourceRoot":"","sources":["../../../src/common/MobileEventLoop.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gBAAgB;AAChB,MAAa,eAAe;IAInB,MAAM,CAAC,OAAO;QACnB,EAAE,IAAI,CAAC,YAAY,CAAC;QAEpB,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;YAC/B,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;SAC7D;IACH,CAAC;IAEM,MAAM,CAAC,UAAU;QACtB,EAAE,IAAI,CAAC,YAAY,CAAC;QAEpB,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;YAC1D,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAClC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC3B;IACH,CAAC;IAEO,MAAM,CAAC,YAAY,KAAK,CAAC;;AArBnC,0CAsBC;AArBgB,4BAAY,GAAG,CAAC,CAAC;AACjB,6BAAa,GAAwB,IAAI,CAAC","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\n/** @internal */\r\nexport class MobileEventLoop {\r\n private static _activeTasks = 0;\r\n private static _idleCallback: NodeJS.Timer | null = null;\r\n\r\n public static addTask() {\r\n ++this._activeTasks;\r\n\r\n if (this._idleCallback === null) {\r\n this._idleCallback = setInterval(() => this._idleHandler());\r\n }\r\n }\r\n\r\n public static removeTask() {\r\n --this._activeTasks;\r\n\r\n if (this._activeTasks === 0 && this._idleCallback !== null) {\r\n clearInterval(this._idleCallback);\r\n this._idleCallback = null;\r\n }\r\n }\r\n\r\n private static _idleHandler() { }\r\n}\r\n"]}
1
+ {"version":3,"file":"MobileEventLoop.js","sourceRoot":"","sources":["../../../src/common/MobileEventLoop.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gBAAgB;AAChB,MAAa,eAAe;IAInB,MAAM,CAAC,OAAO;QACnB,EAAE,IAAI,CAAC,YAAY,CAAC;QAEpB,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;YAC/B,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;SAC7D;IACH,CAAC;IAEM,MAAM,CAAC,UAAU;QACtB,EAAE,IAAI,CAAC,YAAY,CAAC;QAEpB,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;YAC1D,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAClC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC3B;IACH,CAAC;IAEO,MAAM,CAAC,YAAY,KAAK,CAAC;;AApBlB,4BAAY,GAAG,CAAC,CAAC;AACjB,6BAAa,GAAwB,IAAI,CAAC;AAF9C,0CAAe","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\n/** @internal */\r\nexport class MobileEventLoop {\r\n private static _activeTasks = 0;\r\n private static _idleCallback: NodeJS.Timer | null = null;\r\n\r\n public static addTask() {\r\n ++this._activeTasks;\r\n\r\n if (this._idleCallback === null) {\r\n this._idleCallback = setInterval(() => this._idleHandler());\r\n }\r\n }\r\n\r\n public static removeTask() {\r\n --this._activeTasks;\r\n\r\n if (this._activeTasks === 0 && this._idleCallback !== null) {\r\n clearInterval(this._idleCallback);\r\n this._idleCallback = null;\r\n }\r\n }\r\n\r\n private static _idleHandler() { }\r\n}\r\n"]}
@@ -1,18 +1,18 @@
1
- /** @packageDocumentation
2
- * @module RpcInterface
3
- */
4
- import { IpcWebSocketMessage, IpcWebSocketTransport, RpcRequestFulfillment, SerializedRpcRequest } from "@itwin/core-common";
5
- import { MobileRpcProtocol } from "./MobileRpcProtocol";
6
- /** @internal */
7
- export declare class MobileIpcTransport extends IpcWebSocketTransport {
8
- private _protocol;
9
- private _client;
10
- constructor(protocol: MobileRpcProtocol);
11
- send(message: IpcWebSocketMessage): void;
12
- consumeRequest(request: SerializedRpcRequest): boolean;
13
- consumeResponse(response: RpcRequestFulfillment): boolean;
14
- private sendToBackend;
15
- private sendToFrontend;
16
- private broadcast;
17
- }
1
+ /** @packageDocumentation
2
+ * @module RpcInterface
3
+ */
4
+ import { IpcWebSocketMessage, IpcWebSocketTransport, RpcRequestFulfillment, SerializedRpcRequest } from "@itwin/core-common";
5
+ import { MobileRpcProtocol } from "./MobileRpcProtocol";
6
+ /** @internal */
7
+ export declare class MobileIpcTransport extends IpcWebSocketTransport {
8
+ private _protocol;
9
+ private _client;
10
+ constructor(protocol: MobileRpcProtocol);
11
+ send(message: IpcWebSocketMessage): void;
12
+ consumeRequest(request: SerializedRpcRequest): boolean;
13
+ consumeResponse(response: RpcRequestFulfillment): boolean;
14
+ private sendToBackend;
15
+ private sendToFrontend;
16
+ private broadcast;
17
+ }
18
18
  //# sourceMappingURL=MobileIpc.d.ts.map
@@ -1,71 +1,71 @@
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.MobileIpcTransport = void 0;
11
- const core_common_1 = require("@itwin/core-common");
12
- const MobileEventLoop_1 = require("./MobileEventLoop");
13
- const MobileRpcProtocol_1 = require("./MobileRpcProtocol");
14
- const MobileRpcRequest_1 = require("./MobileRpcRequest");
15
- const IPC = "__ipc__";
16
- class IpcInterface extends core_common_1.RpcInterface {
17
- async send() { }
18
- }
19
- IpcInterface.interfaceName = IPC;
20
- IpcInterface.interfaceVersion = "0.0.0";
21
- /** @internal */
22
- class MobileIpcTransport extends core_common_1.IpcWebSocketTransport {
23
- constructor(protocol) {
24
- super();
25
- this._protocol = protocol;
26
- core_common_1.RpcManager.initializeInterface(IpcInterface);
27
- this._client = core_common_1.RpcManager.getClientForInterface(IpcInterface);
28
- }
29
- send(message) {
30
- if (message.type === core_common_1.IpcWebSocketMessageType.Send || message.type === core_common_1.IpcWebSocketMessageType.Invoke) {
31
- this.sendToBackend(message); // eslint-disable-line @typescript-eslint/no-floating-promises
32
- }
33
- else if (message.type === core_common_1.IpcWebSocketMessageType.Push || message.type === core_common_1.IpcWebSocketMessageType.Response) {
34
- this.sendToFrontend(message); // eslint-disable-line @typescript-eslint/no-floating-promises
35
- }
36
- }
37
- consumeRequest(request) {
38
- if (request.operation.interfaceDefinition !== IPC)
39
- return false;
40
- const message = core_common_1.RpcMarshaling.deserialize(this._protocol, request.parameters)[0];
41
- this.broadcast({}, message);
42
- return true;
43
- }
44
- consumeResponse(response) {
45
- if (response.interfaceName !== IPC)
46
- return false;
47
- const message = core_common_1.RpcMarshaling.deserialize(this._protocol, response.result);
48
- this.broadcast({}, message);
49
- return true;
50
- }
51
- async sendToBackend(message) {
52
- const request = new MobileRpcRequest_1.MobileRpcRequest(this._client, "send", [message]);
53
- const encoded = await MobileRpcProtocol_1.MobileRpcProtocol.encodeRequest(request);
54
- this._protocol.sendToBackend(encoded);
55
- request.dispose();
56
- }
57
- async sendToFrontend(message) {
58
- MobileEventLoop_1.MobileEventLoop.addTask();
59
- const result = await core_common_1.RpcMarshaling.serialize(this._protocol, message);
60
- MobileEventLoop_1.MobileEventLoop.removeTask();
61
- const fulfillment = { result, rawResult: message, interfaceName: IPC, id: message.channel, status: 0 };
62
- const encoded = MobileRpcProtocol_1.MobileRpcProtocol.encodeResponse(fulfillment);
63
- this._protocol.sendToFrontend(encoded);
64
- }
65
- broadcast(evt, message) {
66
- for (const listener of core_common_1.IpcWebSocket.receivers)
67
- listener(evt, message);
68
- }
69
- }
70
- exports.MobileIpcTransport = MobileIpcTransport;
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.MobileIpcTransport = void 0;
11
+ const core_common_1 = require("@itwin/core-common");
12
+ const MobileEventLoop_1 = require("./MobileEventLoop");
13
+ const MobileRpcProtocol_1 = require("./MobileRpcProtocol");
14
+ const MobileRpcRequest_1 = require("./MobileRpcRequest");
15
+ const IPC = "__ipc__";
16
+ class IpcInterface extends core_common_1.RpcInterface {
17
+ async send() { }
18
+ }
19
+ IpcInterface.interfaceName = IPC;
20
+ IpcInterface.interfaceVersion = "0.0.0";
21
+ /** @internal */
22
+ class MobileIpcTransport extends core_common_1.IpcWebSocketTransport {
23
+ constructor(protocol) {
24
+ super();
25
+ this._protocol = protocol;
26
+ core_common_1.RpcManager.initializeInterface(IpcInterface);
27
+ this._client = core_common_1.RpcManager.getClientForInterface(IpcInterface);
28
+ }
29
+ send(message) {
30
+ if (message.type === core_common_1.IpcWebSocketMessageType.Send || message.type === core_common_1.IpcWebSocketMessageType.Invoke) {
31
+ this.sendToBackend(message); // eslint-disable-line @typescript-eslint/no-floating-promises
32
+ }
33
+ else if (message.type === core_common_1.IpcWebSocketMessageType.Push || message.type === core_common_1.IpcWebSocketMessageType.Response) {
34
+ this.sendToFrontend(message); // eslint-disable-line @typescript-eslint/no-floating-promises
35
+ }
36
+ }
37
+ consumeRequest(request) {
38
+ if (request.operation.interfaceDefinition !== IPC)
39
+ return false;
40
+ const message = core_common_1.RpcMarshaling.deserialize(this._protocol, request.parameters)[0];
41
+ this.broadcast({}, message);
42
+ return true;
43
+ }
44
+ consumeResponse(response) {
45
+ if (response.interfaceName !== IPC)
46
+ return false;
47
+ const message = core_common_1.RpcMarshaling.deserialize(this._protocol, response.result);
48
+ this.broadcast({}, message);
49
+ return true;
50
+ }
51
+ async sendToBackend(message) {
52
+ const request = new MobileRpcRequest_1.MobileRpcRequest(this._client, "send", [message]);
53
+ const encoded = await MobileRpcProtocol_1.MobileRpcProtocol.encodeRequest(request);
54
+ this._protocol.sendToBackend(encoded);
55
+ request.dispose();
56
+ }
57
+ async sendToFrontend(message) {
58
+ MobileEventLoop_1.MobileEventLoop.addTask();
59
+ const result = await core_common_1.RpcMarshaling.serialize(this._protocol, message);
60
+ MobileEventLoop_1.MobileEventLoop.removeTask();
61
+ const fulfillment = { result, rawResult: message, interfaceName: IPC, id: message.channel, status: 0 };
62
+ const encoded = MobileRpcProtocol_1.MobileRpcProtocol.encodeResponse(fulfillment);
63
+ this._protocol.sendToFrontend(encoded);
64
+ }
65
+ broadcast(evt, message) {
66
+ for (const listener of core_common_1.IpcWebSocket.receivers)
67
+ listener(evt, message);
68
+ }
69
+ }
70
+ exports.MobileIpcTransport = MobileIpcTransport;
71
71
  //# sourceMappingURL=MobileIpc.js.map
@@ -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;;;+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;IAMvD,YAAmB,QAA2B;QAC5C,KAAK,EAAE,CAAC;QALF,UAAK,GAAW,CAAC,CAAC,CAAC;QAMzB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,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,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":["/*---------------------------------------------------------------------------------------------\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":["/*---------------------------------------------------------------------------------------------\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"]}