@itwin/core-mobile 4.0.0-dev.48 → 4.0.0-dev.50
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/MobileBackend.d.ts +7 -7
- package/lib/cjs/MobileBackend.js +24 -24
- package/lib/cjs/MobileBackend.js.map +1 -1
- package/lib/cjs/MobileFrontend.d.ts +5 -5
- package/lib/cjs/MobileFrontend.js +21 -21
- package/lib/cjs/MobileFrontend.js.map +1 -1
- package/lib/cjs/__DOC_ONLY__.d.ts +33 -33
- package/lib/cjs/__DOC_ONLY__.js +52 -52
- package/lib/cjs/__DOC_ONLY__.js.map +1 -1
- package/lib/cjs/backend/MobileAuthorizationBackend.d.ts +17 -17
- package/lib/cjs/backend/MobileAuthorizationBackend.js +46 -46
- package/lib/cjs/backend/MobileAuthorizationBackend.js.map +1 -1
- package/lib/cjs/backend/MobileFileHandler.d.ts +112 -112
- package/lib/cjs/backend/MobileFileHandler.js +263 -263
- package/lib/cjs/backend/MobileFileHandler.js.map +1 -1
- package/lib/cjs/backend/MobileHost.d.ts +72 -72
- package/lib/cjs/backend/MobileHost.js +155 -155
- package/lib/cjs/backend/MobileHost.js.map +1 -1
- package/lib/cjs/backend/MobileRpcServer.d.ts +19 -19
- package/lib/cjs/backend/MobileRpcServer.js +156 -156
- package/lib/cjs/backend/MobileRpcServer.js.map +1 -1
- package/lib/cjs/backend/Request.d.ts +149 -149
- package/lib/cjs/backend/Request.js +267 -267
- package/lib/cjs/backend/Request.js.map +1 -1
- package/lib/cjs/common/MobileAppChannel.d.ts +4 -4
- package/lib/cjs/common/MobileAppChannel.js +11 -11
- package/lib/cjs/common/MobileAppChannel.js.map +1 -1
- package/lib/cjs/common/MobileAppProps.d.ts +35 -35
- package/lib/cjs/common/MobileAppProps.js +26 -26
- package/lib/cjs/common/MobileAppProps.js.map +1 -1
- package/lib/cjs/common/MobileEventLoop.d.ts +11 -11
- package/lib/cjs/common/MobileEventLoop.js +30 -30
- package/lib/cjs/common/MobileEventLoop.js.map +1 -1
- package/lib/cjs/common/MobileIpc.d.ts +17 -17
- package/lib/cjs/common/MobileIpc.js +70 -70
- package/lib/cjs/common/MobileIpc.js.map +1 -1
- package/lib/cjs/common/MobilePush.d.ts +20 -20
- package/lib/cjs/common/MobilePush.js +53 -53
- package/lib/cjs/common/MobilePush.js.map +1 -1
- package/lib/cjs/common/MobileRpcManager.d.ts +40 -40
- package/lib/cjs/common/MobileRpcManager.js +110 -110
- package/lib/cjs/common/MobileRpcManager.js.map +1 -1
- package/lib/cjs/common/MobileRpcProtocol.d.ts +58 -58
- package/lib/cjs/common/MobileRpcProtocol.js +277 -277
- package/lib/cjs/common/MobileRpcProtocol.js.map +1 -1
- package/lib/cjs/common/MobileRpcRequest.d.ts +20 -20
- package/lib/cjs/common/MobileRpcRequest.js +50 -50
- package/lib/cjs/common/MobileRpcRequest.js.map +1 -1
- package/lib/cjs/frontend/MobileApp.d.ts +23 -23
- package/lib/cjs/frontend/MobileApp.js +79 -79
- package/lib/cjs/frontend/MobileApp.js.map +1 -1
- package/lib/cjs/frontend/MobileAuthorizationFrontend.d.ts +17 -17
- package/lib/cjs/frontend/MobileAuthorizationFrontend.d.ts.map +1 -1
- package/lib/cjs/frontend/MobileAuthorizationFrontend.js +54 -46
- package/lib/cjs/frontend/MobileAuthorizationFrontend.js.map +1 -1
- package/lib/cjs/test/ios/MobilePlatform.test.d.ts +1 -1
- package/lib/cjs/test/ios/MobilePlatform.test.js +84 -84
- package/lib/cjs/test/ios/MobilePlatform.test.js.map +1 -1
- package/package.json +12 -12
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileAppChannel.js","sourceRoot":"","sources":["../../../src/common/MobileAppChannel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,gBAAgB;AACH,QAAA,gBAAgB,GAAG,WAAW,CAAC;AAC5C,gBAAgB;AACH,QAAA,eAAe,GAAG,kBAAkB,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\n/** @internal */\nexport const mobileAppChannel = \"mobileApp\";\n/** @internal */\nexport const mobileAppNotify = \"mobileApp-notify\";\n"]}
|
|
1
|
+
{"version":3,"file":"MobileAppChannel.js","sourceRoot":"","sources":["../../../src/common/MobileAppChannel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,gBAAgB;AACH,QAAA,gBAAgB,GAAG,WAAW,CAAC;AAC5C,gBAAgB;AACH,QAAA,eAAe,GAAG,kBAAkB,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\r\n/** @internal */\r\nexport const mobileAppChannel = \"mobileApp\";\r\n/** @internal */\r\nexport const mobileAppNotify = \"mobileApp-notify\";\r\n"]}
|
|
@@ -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 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
|
+
}
|
|
36
36
|
//# sourceMappingURL=MobileAppProps.d.ts.map
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileAppProps.js","sourceRoot":"","sources":["../../../src/common/MobileAppProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAI/F,YAAY;AACZ,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,mDAAW,CAAA;IACX,qDAAc,CAAA;IACd,yEAAwB,CAAA;IACxB,+DAAmB,CAAA;IACnB,iEAAoB,CAAA;IACpB,kDAAa,CAAA;IACb,sDAAe,CAAA;AACjB,CAAC,EARW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAQtB;AAED,YAAY;AACZ,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,qDAAW,CAAA;IACX,yDAAa,CAAA;IACb,uDAAY,CAAA;IACZ,+CAAQ,CAAA;AACV,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB","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 { AccessToken } from \"@itwin/core-bentley\";\n\n/** @beta */\nexport enum Orientation {\n Unknown = 0,\n Portrait = 0x1,\n PortraitUpsideDown = 0x2,\n LandscapeLeft = 0x4,\n LandscapeRight = 0x8,\n FaceUp = 0x10,\n FaceDown = 0x20,\n}\n\n/** @beta */\nexport enum BatteryState {\n Unknown = 0,\n Unplugged = 1,\n Charging = 2,\n Full = 3,\n}\n\n/** @beta */\nexport interface MobileNotifications {\n notifyMemoryWarning: () => void;\n notifyOrientationChanged: () => void;\n notifyWillTerminate: () => void;\n notifyAuthAccessTokenChanged: (accessToken: string | undefined, expirationDate: string | undefined) => void;\n}\n\n/** @beta */\nexport type DeviceEvents = \"memoryWarning\" | \"orientationChanged\" | \"enterForeground\" | \"enterBackground\" | \"willTerminate\" | \"authAccessTokenChanged\";\n\n/**\n* The methods that may be invoked via Ipc from the frontend of a Mobile App that are implemented on its backend.\n* @beta\n*/\nexport interface MobileAppFunctions {\n reconnect: (connection: number) => Promise<void>;\n getAccessToken: () => Promise<[AccessToken, string]>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MobileAppProps.js","sourceRoot":"","sources":["../../../src/common/MobileAppProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAI/F,YAAY;AACZ,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,mDAAW,CAAA;IACX,qDAAc,CAAA;IACd,yEAAwB,CAAA;IACxB,+DAAmB,CAAA;IACnB,iEAAoB,CAAA;IACpB,kDAAa,CAAA;IACb,sDAAe,CAAA;AACjB,CAAC,EARW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAQtB;AAED,YAAY;AACZ,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,qDAAW,CAAA;IACX,yDAAa,CAAA;IACb,uDAAY,CAAA;IACZ,+CAAQ,CAAA;AACV,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB","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 { AccessToken } from \"@itwin/core-bentley\";\r\n\r\n/** @beta */\r\nexport enum Orientation {\r\n Unknown = 0,\r\n Portrait = 0x1,\r\n PortraitUpsideDown = 0x2,\r\n LandscapeLeft = 0x4,\r\n LandscapeRight = 0x8,\r\n FaceUp = 0x10,\r\n FaceDown = 0x20,\r\n}\r\n\r\n/** @beta */\r\nexport enum BatteryState {\r\n Unknown = 0,\r\n Unplugged = 1,\r\n Charging = 2,\r\n Full = 3,\r\n}\r\n\r\n/** @beta */\r\nexport interface MobileNotifications {\r\n notifyMemoryWarning: () => void;\r\n notifyOrientationChanged: () => void;\r\n notifyWillTerminate: () => void;\r\n notifyAuthAccessTokenChanged: (accessToken: string | undefined, expirationDate: string | undefined) => void;\r\n}\r\n\r\n/** @beta */\r\nexport type DeviceEvents = \"memoryWarning\" | \"orientationChanged\" | \"enterForeground\" | \"enterBackground\" | \"willTerminate\" | \"authAccessTokenChanged\";\r\n\r\n/**\r\n* The methods that may be invoked via Ipc from the frontend of a Mobile App that are implemented on its backend.\r\n* @beta\r\n*/\r\nexport interface MobileAppFunctions {\r\n reconnect: (connection: number) => Promise<void>;\r\n getAccessToken: () => Promise<[AccessToken, string]>;\r\n}\r\n"]}
|
|
@@ -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
|
+
exports.MobileEventLoop = MobileEventLoop;
|
|
29
|
+
MobileEventLoop._activeTasks = 0;
|
|
30
|
+
MobileEventLoop._idleCallback = null;
|
|
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":["/*---------------------------------------------------------------------------------------------\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\n/** @internal */\nexport class MobileEventLoop {\n private static _activeTasks = 0;\n private static _idleCallback: NodeJS.Timer | null = null;\n\n public static addTask() {\n ++this._activeTasks;\n\n if (this._idleCallback === null) {\n this._idleCallback = setInterval(() => this._idleHandler());\n }\n }\n\n public static removeTask() {\n --this._activeTasks;\n\n if (this._activeTasks === 0 && this._idleCallback !== null) {\n clearInterval(this._idleCallback);\n this._idleCallback = null;\n }\n }\n\n private static _idleHandler() { }\n}\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;;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,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileIpc.js","sourceRoot":"","sources":["../../../src/common/MobileIpc.ts"],"names":[],"mappings":"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","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 {\n IpcWebSocket, IpcWebSocketMessage, IpcWebSocketMessageType, IpcWebSocketTransport, RpcInterface, RpcManager, RpcMarshaling, RpcRequestFulfillment,\n SerializedRpcRequest,\n} from \"@itwin/core-common\";\nimport { MobileEventLoop } from \"./MobileEventLoop\";\nimport { MobileRpcProtocol } from \"./MobileRpcProtocol\";\nimport { MobileRpcRequest } from \"./MobileRpcRequest\";\n\nconst IPC = \"__ipc__\";\n\nclass IpcInterface extends RpcInterface { // eslint-disable-line deprecation/deprecation\n public static interfaceName = IPC;\n public static interfaceVersion = \"0.0.0\";\n public async send() { }\n}\n\n/** @internal */\nexport class MobileIpcTransport extends IpcWebSocketTransport {\n private _protocol: MobileRpcProtocol;\n private _client: IpcInterface;\n\n public constructor(protocol: MobileRpcProtocol) {\n super();\n this._protocol = protocol;\n\n RpcManager.initializeInterface(IpcInterface);\n this._client = RpcManager.getClientForInterface(IpcInterface);\n }\n\n public send(message: IpcWebSocketMessage): void {\n if (message.type === IpcWebSocketMessageType.Send || message.type === IpcWebSocketMessageType.Invoke) {\n this.sendToBackend(message); // eslint-disable-line @typescript-eslint/no-floating-promises\n } else if (message.type === IpcWebSocketMessageType.Push || message.type === IpcWebSocketMessageType.Response) {\n this.sendToFrontend(message); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n public consumeRequest(request: SerializedRpcRequest): boolean {\n if (request.operation.interfaceDefinition !== IPC)\n return false;\n\n const message = RpcMarshaling.deserialize(this._protocol, request.parameters)[0] as IpcWebSocketMessage;\n this.broadcast({} as Event, message);\n return true;\n }\n\n public consumeResponse(response: RpcRequestFulfillment): boolean {\n if (response.interfaceName !== IPC)\n return false;\n\n const message = RpcMarshaling.deserialize(this._protocol, response.result) as IpcWebSocketMessage;\n this.broadcast({} as Event, message);\n return true;\n }\n\n private async sendToBackend(message: IpcWebSocketMessage) {\n const request = new MobileRpcRequest(this._client, \"send\", [message]);\n const encoded = await MobileRpcProtocol.encodeRequest(request);\n this._protocol.sendToBackend(encoded);\n request.dispose();\n }\n\n private async sendToFrontend(message: IpcWebSocketMessage) {\n MobileEventLoop.addTask();\n const result = await RpcMarshaling.serialize(this._protocol, message);\n MobileEventLoop.removeTask();\n\n const fulfillment: RpcRequestFulfillment = { result, rawResult: message, interfaceName: IPC, id: message.channel, status: 0 };\n const encoded = MobileRpcProtocol.encodeResponse(fulfillment);\n this._protocol.sendToFrontend(encoded);\n }\n\n private broadcast(evt: Event, message: IpcWebSocketMessage) {\n for (const listener of IpcWebSocket.receivers)\n listener(evt, message);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MobileIpc.js","sourceRoot":"","sources":["../../../src/common/MobileIpc.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAG4B;AAC5B,uDAAoD;AACpD,2DAAwD;AACxD,yDAAsD;AAEtD,MAAM,GAAG,GAAG,SAAS,CAAC;AAEtB,MAAM,YAAa,SAAQ,0BAAY;IAG9B,KAAK,CAAC,IAAI,KAAK,CAAC;;AAFT,0BAAa,GAAG,GAAG,CAAC;AACpB,6BAAgB,GAAG,OAAO,CAAC;AAI3C,gBAAgB;AAChB,MAAa,kBAAmB,SAAQ,mCAAqB;IAI3D,YAAmB,QAA2B;QAC5C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,wBAAU,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,wBAAU,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAChE,CAAC;IAEM,IAAI,CAAC,OAA4B;QACtC,IAAI,OAAO,CAAC,IAAI,KAAK,qCAAuB,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,qCAAuB,CAAC,MAAM,EAAE;YACpG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,8DAA8D;SAC5F;aAAM,IAAI,OAAO,CAAC,IAAI,KAAK,qCAAuB,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,qCAAuB,CAAC,QAAQ,EAAE;YAC7G,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,8DAA8D;SAC7F;IACH,CAAC;IAEM,cAAc,CAAC,OAA6B;QACjD,IAAI,OAAO,CAAC,SAAS,CAAC,mBAAmB,KAAK,GAAG;YAC/C,OAAO,KAAK,CAAC;QAEf,MAAM,OAAO,GAAG,2BAAa,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAwB,CAAC;QACxG,IAAI,CAAC,SAAS,CAAC,EAAW,EAAE,OAAO,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,eAAe,CAAC,QAA+B;QACpD,IAAI,QAAQ,CAAC,aAAa,KAAK,GAAG;YAChC,OAAO,KAAK,CAAC;QAEf,MAAM,OAAO,GAAG,2BAAa,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAwB,CAAC;QAClG,IAAI,CAAC,SAAS,CAAC,EAAW,EAAE,OAAO,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,OAA4B;QACtD,MAAM,OAAO,GAAG,IAAI,mCAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QACtE,MAAM,OAAO,GAAG,MAAM,qCAAiB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC/D,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACtC,OAAO,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,OAA4B;QACvD,iCAAe,CAAC,OAAO,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,MAAM,2BAAa,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACtE,iCAAe,CAAC,UAAU,EAAE,CAAC;QAE7B,MAAM,WAAW,GAA0B,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAC9H,MAAM,OAAO,GAAG,qCAAiB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAC9D,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEO,SAAS,CAAC,GAAU,EAAE,OAA4B;QACxD,KAAK,MAAM,QAAQ,IAAI,0BAAY,CAAC,SAAS;YAC3C,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3B,CAAC;CACF;AA3DD,gDA2DC","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 {\r\n IpcWebSocket, IpcWebSocketMessage, IpcWebSocketMessageType, IpcWebSocketTransport, RpcInterface, RpcManager, RpcMarshaling, RpcRequestFulfillment,\r\n SerializedRpcRequest,\r\n} from \"@itwin/core-common\";\r\nimport { MobileEventLoop } from \"./MobileEventLoop\";\r\nimport { MobileRpcProtocol } from \"./MobileRpcProtocol\";\r\nimport { MobileRpcRequest } from \"./MobileRpcRequest\";\r\n\r\nconst IPC = \"__ipc__\";\r\n\r\nclass IpcInterface extends RpcInterface { // eslint-disable-line deprecation/deprecation\r\n public static interfaceName = IPC;\r\n public static interfaceVersion = \"0.0.0\";\r\n public async send() { }\r\n}\r\n\r\n/** @internal */\r\nexport class MobileIpcTransport extends IpcWebSocketTransport {\r\n private _protocol: MobileRpcProtocol;\r\n private _client: IpcInterface;\r\n\r\n public constructor(protocol: MobileRpcProtocol) {\r\n super();\r\n this._protocol = protocol;\r\n\r\n RpcManager.initializeInterface(IpcInterface);\r\n this._client = RpcManager.getClientForInterface(IpcInterface);\r\n }\r\n\r\n public send(message: IpcWebSocketMessage): void {\r\n if (message.type === IpcWebSocketMessageType.Send || message.type === IpcWebSocketMessageType.Invoke) {\r\n this.sendToBackend(message); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n } else if (message.type === IpcWebSocketMessageType.Push || message.type === IpcWebSocketMessageType.Response) {\r\n this.sendToFrontend(message); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n }\r\n\r\n public consumeRequest(request: SerializedRpcRequest): boolean {\r\n if (request.operation.interfaceDefinition !== IPC)\r\n return false;\r\n\r\n const message = RpcMarshaling.deserialize(this._protocol, request.parameters)[0] as IpcWebSocketMessage;\r\n this.broadcast({} as Event, message);\r\n return true;\r\n }\r\n\r\n public consumeResponse(response: RpcRequestFulfillment): boolean {\r\n if (response.interfaceName !== IPC)\r\n return false;\r\n\r\n const message = RpcMarshaling.deserialize(this._protocol, response.result) as IpcWebSocketMessage;\r\n this.broadcast({} as Event, message);\r\n return true;\r\n }\r\n\r\n private async sendToBackend(message: IpcWebSocketMessage) {\r\n const request = new MobileRpcRequest(this._client, \"send\", [message]);\r\n const encoded = await MobileRpcProtocol.encodeRequest(request);\r\n this._protocol.sendToBackend(encoded);\r\n request.dispose();\r\n }\r\n\r\n private async sendToFrontend(message: IpcWebSocketMessage) {\r\n MobileEventLoop.addTask();\r\n const result = await RpcMarshaling.serialize(this._protocol, message);\r\n MobileEventLoop.removeTask();\r\n\r\n const fulfillment: RpcRequestFulfillment = { result, rawResult: message, interfaceName: IPC, id: message.channel, status: 0 };\r\n const encoded = MobileRpcProtocol.encodeResponse(fulfillment);\r\n this._protocol.sendToFrontend(encoded);\r\n }\r\n\r\n private broadcast(evt: Event, message: IpcWebSocketMessage) {\r\n for (const listener of IpcWebSocket.receivers)\r\n listener(evt, message);\r\n }\r\n}\r\n"]}
|
|
@@ -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
|
+
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;
|
|
54
54
|
//# sourceMappingURL=MobilePush.js.map
|