@itwin/core-mobile 4.0.0-dev.52 → 4.0.0-dev.55

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 (54) hide show
  1. package/lib/cjs/MobileBackend.d.ts +7 -7
  2. package/lib/cjs/MobileBackend.js +28 -24
  3. package/lib/cjs/MobileBackend.js.map +1 -1
  4. package/lib/cjs/MobileFrontend.d.ts +5 -5
  5. package/lib/cjs/MobileFrontend.js +25 -21
  6. package/lib/cjs/MobileFrontend.js.map +1 -1
  7. package/lib/cjs/__DOC_ONLY__.d.ts +33 -33
  8. package/lib/cjs/__DOC_ONLY__.js +56 -52
  9. package/lib/cjs/__DOC_ONLY__.js.map +1 -1
  10. package/lib/cjs/backend/MobileAuthorizationBackend.d.ts +17 -17
  11. package/lib/cjs/backend/MobileAuthorizationBackend.js +46 -46
  12. package/lib/cjs/backend/MobileFileHandler.d.ts +112 -112
  13. package/lib/cjs/backend/MobileFileHandler.js +263 -263
  14. package/lib/cjs/backend/MobileHost.d.ts +72 -72
  15. package/lib/cjs/backend/MobileHost.d.ts.map +1 -1
  16. package/lib/cjs/backend/MobileHost.js +155 -155
  17. package/lib/cjs/backend/MobileHost.js.map +1 -1
  18. package/lib/cjs/backend/MobileRpcServer.d.ts +19 -19
  19. package/lib/cjs/backend/MobileRpcServer.js +156 -156
  20. package/lib/cjs/backend/MobileRpcServer.js.map +1 -1
  21. package/lib/cjs/backend/Request.d.ts +149 -149
  22. package/lib/cjs/backend/Request.d.ts.map +1 -1
  23. package/lib/cjs/backend/Request.js +267 -267
  24. package/lib/cjs/common/MobileAppChannel.d.ts +4 -4
  25. package/lib/cjs/common/MobileAppChannel.js +11 -11
  26. package/lib/cjs/common/MobileAppProps.d.ts +35 -35
  27. package/lib/cjs/common/MobileAppProps.d.ts.map +1 -1
  28. package/lib/cjs/common/MobileAppProps.js +26 -26
  29. package/lib/cjs/common/MobileEventLoop.d.ts +11 -11
  30. package/lib/cjs/common/MobileEventLoop.js +30 -30
  31. package/lib/cjs/common/MobileEventLoop.js.map +1 -1
  32. package/lib/cjs/common/MobileIpc.d.ts +17 -17
  33. package/lib/cjs/common/MobileIpc.js +70 -70
  34. package/lib/cjs/common/MobilePush.d.ts +20 -20
  35. package/lib/cjs/common/MobilePush.js +53 -53
  36. package/lib/cjs/common/MobilePush.js.map +1 -1
  37. package/lib/cjs/common/MobileRpcManager.d.ts +40 -40
  38. package/lib/cjs/common/MobileRpcManager.js +110 -110
  39. package/lib/cjs/common/MobileRpcManager.js.map +1 -1
  40. package/lib/cjs/common/MobileRpcProtocol.d.ts +58 -58
  41. package/lib/cjs/common/MobileRpcProtocol.d.ts.map +1 -1
  42. package/lib/cjs/common/MobileRpcProtocol.js +277 -277
  43. package/lib/cjs/common/MobileRpcProtocol.js.map +1 -1
  44. package/lib/cjs/common/MobileRpcRequest.d.ts +20 -20
  45. package/lib/cjs/common/MobileRpcRequest.js +50 -50
  46. package/lib/cjs/frontend/MobileApp.d.ts +23 -23
  47. package/lib/cjs/frontend/MobileApp.d.ts.map +1 -1
  48. package/lib/cjs/frontend/MobileApp.js +79 -79
  49. package/lib/cjs/frontend/MobileApp.js.map +1 -1
  50. package/lib/cjs/frontend/MobileAuthorizationFrontend.d.ts +17 -17
  51. package/lib/cjs/frontend/MobileAuthorizationFrontend.js +54 -54
  52. package/lib/cjs/test/ios/MobilePlatform.test.d.ts +1 -1
  53. package/lib/cjs/test/ios/MobilePlatform.test.js +84 -84
  54. package/package.json +14 -14
@@ -1,55 +1,55 @@
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 OIDC
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.MobileAuthorizationFrontend = void 0;
11
- const MobileApp_1 = require("./MobileApp");
12
- /** Utility to provide and cache auth tokens from native mobile apps to IModelApp.
13
- * @internal
14
- */
15
- class MobileAuthorizationFrontend {
16
- constructor() {
17
- this._accessToken = "";
18
- this._expiryBuffer = 60 * 10; // ten minutes
19
- this._fetchingToken = false;
20
- }
21
- get _hasExpired() {
22
- return this._expirationDate !== undefined && this._expirationDate.getTime() - Date.now() <= this._expiryBuffer * 1000;
23
- }
24
- async getAccessToken() {
25
- if (this._fetchingToken) {
26
- // NOTE: This function is from the AuthorizationClient interface. That interface documents
27
- // this function to return an empty string if no token is available, NOT throw an exception.
28
- return ""; // short-circuits any recursive use of this function
29
- }
30
- if (this._accessToken && !this._hasExpired) {
31
- return this._accessToken;
32
- }
33
- else {
34
- try {
35
- this._fetchingToken = true;
36
- const result = await MobileApp_1.MobileApp.callBackend("getAccessToken");
37
- this._accessToken = result[0];
38
- this._expirationDate = result[1] ? new Date(result[1]) : undefined;
39
- return this._accessToken;
40
- }
41
- catch (_ex) {
42
- return "";
43
- }
44
- finally {
45
- this._fetchingToken = false;
46
- }
47
- }
48
- }
49
- setAccessToken(accessToken, expirationDate) {
50
- this._accessToken = accessToken ?? "";
51
- this._expirationDate = expirationDate ? new Date(expirationDate) : undefined;
52
- }
53
- }
54
- exports.MobileAuthorizationFrontend = MobileAuthorizationFrontend;
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 OIDC
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.MobileAuthorizationFrontend = void 0;
11
+ const MobileApp_1 = require("./MobileApp");
12
+ /** Utility to provide and cache auth tokens from native mobile apps to IModelApp.
13
+ * @internal
14
+ */
15
+ class MobileAuthorizationFrontend {
16
+ constructor() {
17
+ this._accessToken = "";
18
+ this._expiryBuffer = 60 * 10; // ten minutes
19
+ this._fetchingToken = false;
20
+ }
21
+ get _hasExpired() {
22
+ return this._expirationDate !== undefined && this._expirationDate.getTime() - Date.now() <= this._expiryBuffer * 1000;
23
+ }
24
+ async getAccessToken() {
25
+ if (this._fetchingToken) {
26
+ // NOTE: This function is from the AuthorizationClient interface. That interface documents
27
+ // this function to return an empty string if no token is available, NOT throw an exception.
28
+ return ""; // short-circuits any recursive use of this function
29
+ }
30
+ if (this._accessToken && !this._hasExpired) {
31
+ return this._accessToken;
32
+ }
33
+ else {
34
+ try {
35
+ this._fetchingToken = true;
36
+ const result = await MobileApp_1.MobileApp.callBackend("getAccessToken");
37
+ this._accessToken = result[0];
38
+ this._expirationDate = result[1] ? new Date(result[1]) : undefined;
39
+ return this._accessToken;
40
+ }
41
+ catch (_ex) {
42
+ return "";
43
+ }
44
+ finally {
45
+ this._fetchingToken = false;
46
+ }
47
+ }
48
+ }
49
+ setAccessToken(accessToken, expirationDate) {
50
+ this._accessToken = accessToken ?? "";
51
+ this._expirationDate = expirationDate ? new Date(expirationDate) : undefined;
52
+ }
53
+ }
54
+ exports.MobileAuthorizationFrontend = MobileAuthorizationFrontend;
55
55
  //# sourceMappingURL=MobileAuthorizationFrontend.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=MobilePlatform.test.d.ts.map
@@ -1,85 +1,85 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*---------------------------------------------------------------------------------------------
4
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
5
- * See LICENSE.md in the project root for license terms and full copyright notice.
6
- *--------------------------------------------------------------------------------------------*/
7
- const chai_1 = require("chai");
8
- const fs = require("fs-extra");
9
- const os = require("os");
10
- const path = require("path");
11
- const outputDir = path.join(os.tmpdir(), "output");
12
- describe("IOS Platform Test", () => {
13
- it("Filesystem (Uint8Array) - writeFileSync, appendFileSync and readFileSync", () => {
14
- const testDir = path.join(outputDir, "mobile-introp");
15
- const testFile = path.join(testDir, "test.bin");
16
- if (fs.existsSync(testDir)) {
17
- fs.unlinkSync(testDir);
18
- }
19
- fs.mkdirSync(testDir);
20
- chai_1.assert.isTrue(fs.existsSync(testDir));
21
- const testArray = new Uint8Array(1024);
22
- for (let i = 0; i < testArray.length; i++) {
23
- testArray[i] = i % 255;
24
- }
25
- fs.writeFileSync(testFile, testArray);
26
- // binary test
27
- const outArray = fs.readFileSync(testFile, { encoding: null });
28
- chai_1.assert.equal(outArray.length, testArray.length, "array size must match");
29
- for (let i = 0; i < testArray.length; i++) {
30
- chai_1.assert.equal(testArray[i], outArray[i], `content at offset ${i} missmatch`);
31
- }
32
- chai_1.assert.equal(fs.lstatSync(testFile).size, testArray.length, "file size must match");
33
- fs.appendFileSync(testFile, testArray);
34
- // binary test
35
- const outArrayx2 = fs.readFileSync(testFile, { encoding: null });
36
- chai_1.assert.equal(outArrayx2.length, testArray.length * 2, "array size must match after append");
37
- for (let i = 0; i < testArray.length; i++) {
38
- chai_1.assert.equal(testArray[i], outArrayx2[i], `content at offset ${i} missmatch after append`);
39
- }
40
- // check append
41
- for (let k = 0; k < testArray.length; k++) {
42
- chai_1.assert.equal(testArray[k], outArrayx2[k + testArray.length], `content at offset ${k} missmatch after append`);
43
- }
44
- chai_1.assert.equal(fs.lstatSync(testFile).size, testArray.length * 2, "file size must match after append");
45
- fs.unlinkSync(testFile);
46
- chai_1.assert.isFalse(fs.existsSync(testFile));
47
- });
48
- it("Filesystem (string) - writeFileSync, appendFileSync and readFileSync", () => {
49
- const testDir = path.join(outputDir, "mobile-introp");
50
- const testFile = path.join(testDir, "test.bin");
51
- if (fs.existsSync(testDir)) {
52
- fs.unlinkSync(testDir);
53
- }
54
- fs.mkdirSync(testDir);
55
- chai_1.assert.isTrue(fs.existsSync(testDir));
56
- const testString = "*".repeat(1024);
57
- fs.writeFileSync(testFile, testString);
58
- // string test
59
- const outString = fs.readFileSync(testFile, { encoding: "utf-8" });
60
- chai_1.assert.equal(testString, outString);
61
- fs.appendFileSync(testFile, testString);
62
- const outStringx2 = fs.readFileSync(testFile, { encoding: "utf-8" });
63
- chai_1.assert.equal(testString.length * 2, outStringx2.length);
64
- chai_1.assert.equal(testString + testString, outStringx2);
65
- fs.unlinkSync(testFile);
66
- chai_1.assert.isFalse(fs.existsSync(testFile));
67
- });
68
- /*
69
- - (bool) existsSync: (NSString*)path;
70
- - (void) unlinkSync: (NSString*)path;
71
- - (void) removeSync: (NSString*)path;
72
- - (void) mkdirSync: (NSString*)path;
73
- - (void) rmdirSync: (NSString*)path;
74
- - (void) appendFileSync: (NSString*)path :(JSValue*)data;
75
- - (NSArray<NSString*>*) readdirSync: (NSString*)path;
76
- - (void) writeFileSync: (NSString*)path :(JSValue*)content;
77
- - (void) copySync: (NSString*)fromPath :(NSString*)toPath;
78
- - (JSValue*) lstatSync: (JSValue*)path;
79
- - (JSValue*) readFileSync: (JSValue*)path :(JSValue*)options;
80
- - (JSValue*) istatSync: (JSValue*)path;
81
- - (NSString*) realpathSync: (JSValue*)path :(JSValue*)options;
82
- - (void) closeSync: (JSValue*)fd;
83
- - (JSValue*) openSync: (NSString*)path :(NSString*)flags :(JSValue*)mode; */
84
- });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*---------------------------------------------------------------------------------------------
4
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
5
+ * See LICENSE.md in the project root for license terms and full copyright notice.
6
+ *--------------------------------------------------------------------------------------------*/
7
+ const chai_1 = require("chai");
8
+ const fs = require("fs-extra");
9
+ const os = require("os");
10
+ const path = require("path");
11
+ const outputDir = path.join(os.tmpdir(), "output");
12
+ describe("IOS Platform Test", () => {
13
+ it("Filesystem (Uint8Array) - writeFileSync, appendFileSync and readFileSync", () => {
14
+ const testDir = path.join(outputDir, "mobile-introp");
15
+ const testFile = path.join(testDir, "test.bin");
16
+ if (fs.existsSync(testDir)) {
17
+ fs.unlinkSync(testDir);
18
+ }
19
+ fs.mkdirSync(testDir);
20
+ chai_1.assert.isTrue(fs.existsSync(testDir));
21
+ const testArray = new Uint8Array(1024);
22
+ for (let i = 0; i < testArray.length; i++) {
23
+ testArray[i] = i % 255;
24
+ }
25
+ fs.writeFileSync(testFile, testArray);
26
+ // binary test
27
+ const outArray = fs.readFileSync(testFile, { encoding: null });
28
+ chai_1.assert.equal(outArray.length, testArray.length, "array size must match");
29
+ for (let i = 0; i < testArray.length; i++) {
30
+ chai_1.assert.equal(testArray[i], outArray[i], `content at offset ${i} missmatch`);
31
+ }
32
+ chai_1.assert.equal(fs.lstatSync(testFile).size, testArray.length, "file size must match");
33
+ fs.appendFileSync(testFile, testArray);
34
+ // binary test
35
+ const outArrayx2 = fs.readFileSync(testFile, { encoding: null });
36
+ chai_1.assert.equal(outArrayx2.length, testArray.length * 2, "array size must match after append");
37
+ for (let i = 0; i < testArray.length; i++) {
38
+ chai_1.assert.equal(testArray[i], outArrayx2[i], `content at offset ${i} missmatch after append`);
39
+ }
40
+ // check append
41
+ for (let k = 0; k < testArray.length; k++) {
42
+ chai_1.assert.equal(testArray[k], outArrayx2[k + testArray.length], `content at offset ${k} missmatch after append`);
43
+ }
44
+ chai_1.assert.equal(fs.lstatSync(testFile).size, testArray.length * 2, "file size must match after append");
45
+ fs.unlinkSync(testFile);
46
+ chai_1.assert.isFalse(fs.existsSync(testFile));
47
+ });
48
+ it("Filesystem (string) - writeFileSync, appendFileSync and readFileSync", () => {
49
+ const testDir = path.join(outputDir, "mobile-introp");
50
+ const testFile = path.join(testDir, "test.bin");
51
+ if (fs.existsSync(testDir)) {
52
+ fs.unlinkSync(testDir);
53
+ }
54
+ fs.mkdirSync(testDir);
55
+ chai_1.assert.isTrue(fs.existsSync(testDir));
56
+ const testString = "*".repeat(1024);
57
+ fs.writeFileSync(testFile, testString);
58
+ // string test
59
+ const outString = fs.readFileSync(testFile, { encoding: "utf-8" });
60
+ chai_1.assert.equal(testString, outString);
61
+ fs.appendFileSync(testFile, testString);
62
+ const outStringx2 = fs.readFileSync(testFile, { encoding: "utf-8" });
63
+ chai_1.assert.equal(testString.length * 2, outStringx2.length);
64
+ chai_1.assert.equal(testString + testString, outStringx2);
65
+ fs.unlinkSync(testFile);
66
+ chai_1.assert.isFalse(fs.existsSync(testFile));
67
+ });
68
+ /*
69
+ - (bool) existsSync: (NSString*)path;
70
+ - (void) unlinkSync: (NSString*)path;
71
+ - (void) removeSync: (NSString*)path;
72
+ - (void) mkdirSync: (NSString*)path;
73
+ - (void) rmdirSync: (NSString*)path;
74
+ - (void) appendFileSync: (NSString*)path :(JSValue*)data;
75
+ - (NSArray<NSString*>*) readdirSync: (NSString*)path;
76
+ - (void) writeFileSync: (NSString*)path :(JSValue*)content;
77
+ - (void) copySync: (NSString*)fromPath :(NSString*)toPath;
78
+ - (JSValue*) lstatSync: (JSValue*)path;
79
+ - (JSValue*) readFileSync: (JSValue*)path :(JSValue*)options;
80
+ - (JSValue*) istatSync: (JSValue*)path;
81
+ - (NSString*) realpathSync: (JSValue*)path :(JSValue*)options;
82
+ - (void) closeSync: (JSValue*)fd;
83
+ - (JSValue*) openSync: (NSString*)path :(NSString*)flags :(JSValue*)mode; */
84
+ });
85
85
  //# sourceMappingURL=MobilePlatform.test.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-mobile",
3
- "version": "4.0.0-dev.52",
3
+ "version": "4.0.0-dev.55",
4
4
  "description": "iTwin.js MobileHost and MobileApp",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -21,11 +21,11 @@
21
21
  "url": "http://www.bentley.com"
22
22
  },
23
23
  "peerDependencies": {
24
- "@itwin/core-backend": "^4.0.0-dev.52",
25
- "@itwin/core-bentley": "^4.0.0-dev.52",
26
- "@itwin/core-common": "^4.0.0-dev.52",
27
- "@itwin/core-frontend": "^4.0.0-dev.52",
28
- "@itwin/presentation-common": "^4.0.0-dev.52"
24
+ "@itwin/core-backend": "^4.0.0-dev.55",
25
+ "@itwin/core-bentley": "^4.0.0-dev.55",
26
+ "@itwin/core-common": "^4.0.0-dev.55",
27
+ "@itwin/core-frontend": "^4.0.0-dev.55",
28
+ "@itwin/presentation-common": "^4.0.0-dev.55"
29
29
  },
30
30
  "dependencies": {
31
31
  "deep-assign": "^2.0.0",
@@ -36,13 +36,13 @@
36
36
  "ws": "^7.5.3"
37
37
  },
38
38
  "devDependencies": {
39
- "@itwin/build-tools": "4.0.0-dev.52",
40
- "@itwin/core-backend": "4.0.0-dev.52",
41
- "@itwin/core-bentley": "4.0.0-dev.52",
42
- "@itwin/core-common": "4.0.0-dev.52",
43
- "@itwin/core-frontend": "4.0.0-dev.52",
44
- "@itwin/eslint-plugin": "nightly",
45
- "@itwin/presentation-common": "4.0.0-dev.52",
39
+ "@itwin/build-tools": "4.0.0-dev.55",
40
+ "@itwin/core-backend": "4.0.0-dev.55",
41
+ "@itwin/core-bentley": "4.0.0-dev.55",
42
+ "@itwin/core-common": "4.0.0-dev.55",
43
+ "@itwin/core-frontend": "4.0.0-dev.55",
44
+ "@itwin/eslint-plugin": "^4.0.0-dev.32",
45
+ "@itwin/presentation-common": "4.0.0-dev.55",
46
46
  "@types/chai": "4.3.1",
47
47
  "@types/deep-assign": "^0.1.0",
48
48
  "@types/fs-extra": "^4.0.7",
@@ -60,7 +60,7 @@
60
60
  "js-base64": "^3.6.1",
61
61
  "mocha": "^10.0.0",
62
62
  "rimraf": "^3.0.2",
63
- "typescript": "~4.4.0"
63
+ "typescript": "~5.0.2"
64
64
  },
65
65
  "eslintConfig": {
66
66
  "plugins": [