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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/README.md +1 -1
  3. package/lib/cjs/MobileBackend.d.ts +7 -7
  4. package/lib/cjs/MobileBackend.js +28 -24
  5. package/lib/cjs/MobileBackend.js.map +1 -1
  6. package/lib/cjs/MobileFrontend.d.ts +5 -5
  7. package/lib/cjs/MobileFrontend.js +25 -21
  8. package/lib/cjs/MobileFrontend.js.map +1 -1
  9. package/lib/cjs/__DOC_ONLY__.d.ts +33 -33
  10. package/lib/cjs/__DOC_ONLY__.js +56 -52
  11. package/lib/cjs/__DOC_ONLY__.js.map +1 -1
  12. package/lib/cjs/backend/MobileAuthorizationBackend.d.ts +17 -17
  13. package/lib/cjs/backend/MobileAuthorizationBackend.js +46 -46
  14. package/lib/cjs/backend/MobileAuthorizationBackend.js.map +1 -1
  15. package/lib/cjs/backend/MobileFileHandler.d.ts +112 -112
  16. package/lib/cjs/backend/MobileFileHandler.d.ts.map +1 -1
  17. package/lib/cjs/backend/MobileFileHandler.js +263 -263
  18. package/lib/cjs/backend/MobileFileHandler.js.map +1 -1
  19. package/lib/cjs/backend/MobileHost.d.ts +72 -72
  20. package/lib/cjs/backend/MobileHost.d.ts.map +1 -1
  21. package/lib/cjs/backend/MobileHost.js +149 -156
  22. package/lib/cjs/backend/MobileHost.js.map +1 -1
  23. package/lib/cjs/backend/MobileRpcServer.d.ts +19 -19
  24. package/lib/cjs/backend/MobileRpcServer.js +156 -156
  25. package/lib/cjs/backend/MobileRpcServer.js.map +1 -1
  26. package/lib/cjs/backend/Request.d.ts +117 -149
  27. package/lib/cjs/backend/Request.d.ts.map +1 -1
  28. package/lib/cjs/backend/Request.js +255 -267
  29. package/lib/cjs/backend/Request.js.map +1 -1
  30. package/lib/cjs/common/MobileAppChannel.d.ts +4 -4
  31. package/lib/cjs/common/MobileAppChannel.js +11 -11
  32. package/lib/cjs/common/MobileAppChannel.js.map +1 -1
  33. package/lib/cjs/common/MobileAppProps.d.ts +35 -35
  34. package/lib/cjs/common/MobileAppProps.d.ts.map +1 -1
  35. package/lib/cjs/common/MobileAppProps.js +26 -26
  36. package/lib/cjs/common/MobileAppProps.js.map +1 -1
  37. package/lib/cjs/common/MobileEventLoop.d.ts +11 -11
  38. package/lib/cjs/common/MobileEventLoop.js +30 -30
  39. package/lib/cjs/common/MobileEventLoop.js.map +1 -1
  40. package/lib/cjs/common/MobileIpc.d.ts +17 -17
  41. package/lib/cjs/common/MobileIpc.js +70 -70
  42. package/lib/cjs/common/MobileIpc.js.map +1 -1
  43. package/lib/cjs/common/MobilePush.d.ts +20 -20
  44. package/lib/cjs/common/MobilePush.js +53 -53
  45. package/lib/cjs/common/MobilePush.js.map +1 -1
  46. package/lib/cjs/common/MobileRpcManager.d.ts +40 -40
  47. package/lib/cjs/common/MobileRpcManager.js +110 -110
  48. package/lib/cjs/common/MobileRpcManager.js.map +1 -1
  49. package/lib/cjs/common/MobileRpcProtocol.d.ts +58 -58
  50. package/lib/cjs/common/MobileRpcProtocol.d.ts.map +1 -1
  51. package/lib/cjs/common/MobileRpcProtocol.js +277 -277
  52. package/lib/cjs/common/MobileRpcProtocol.js.map +1 -1
  53. package/lib/cjs/common/MobileRpcRequest.d.ts +20 -20
  54. package/lib/cjs/common/MobileRpcRequest.js +50 -50
  55. package/lib/cjs/common/MobileRpcRequest.js.map +1 -1
  56. package/lib/cjs/frontend/MobileApp.d.ts +23 -23
  57. package/lib/cjs/frontend/MobileApp.d.ts.map +1 -1
  58. package/lib/cjs/frontend/MobileApp.js +79 -80
  59. package/lib/cjs/frontend/MobileApp.js.map +1 -1
  60. package/lib/cjs/frontend/MobileAuthorizationFrontend.d.ts +17 -17
  61. package/lib/cjs/frontend/MobileAuthorizationFrontend.d.ts.map +1 -1
  62. package/lib/cjs/frontend/MobileAuthorizationFrontend.js +54 -46
  63. package/lib/cjs/frontend/MobileAuthorizationFrontend.js.map +1 -1
  64. package/lib/cjs/test/ios/MobilePlatform.test.d.ts +1 -1
  65. package/lib/cjs/test/ios/MobilePlatform.test.js +84 -84
  66. package/lib/cjs/test/ios/MobilePlatform.test.js.map +1 -1
  67. package/package.json +18 -26
@@ -1,47 +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
- return Promise.reject(); // short-circuits any recursive use of this function
27
- }
28
- if (this._accessToken && !this._hasExpired) {
29
- return this._accessToken;
30
- }
31
- else {
32
- this._fetchingToken = true;
33
- const result = await MobileApp_1.MobileApp.callBackend("getAccessToken");
34
- this._accessToken = result[0];
35
- if (result[1])
36
- this._expirationDate = new Date(result[1]);
37
- this._fetchingToken = false;
38
- return this._accessToken;
39
- }
40
- }
41
- setAccessToken(accessToken, expirationDate) {
42
- this._accessToken = accessToken !== null && accessToken !== void 0 ? accessToken : "";
43
- this._expirationDate = expirationDate ? new Date(expirationDate) : undefined;
44
- }
45
- }
46
- 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;
47
55
  //# sourceMappingURL=MobileAuthorizationFrontend.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MobileAuthorizationFrontend.js","sourceRoot":"","sources":["../../../src/frontend/MobileAuthorizationFrontend.ts"],"names":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I,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,CAAC;CACF;AAhCD,kEAgCC","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 OIDC\r\n */\r\n\r\nimport { AccessToken } from \"@itwin/core-bentley\";\r\nimport { AuthorizationClient } from \"@itwin/core-common\";\r\nimport { MobileApp } from \"./MobileApp\";\r\n\r\n/** Utility to provide and cache auth tokens from native mobile apps to IModelApp.\r\n * @internal\r\n */\r\nexport class MobileAuthorizationFrontend implements AuthorizationClient {\r\n private _accessToken: AccessToken = \"\";\r\n private _expirationDate: Date | undefined;\r\n private _expiryBuffer = 60 * 10; // ten minutes\r\n private _fetchingToken = false;\r\n\r\n private get _hasExpired(): boolean {\r\n return this._expirationDate !== undefined && this._expirationDate.getTime() - Date.now() <= this._expiryBuffer * 1000;\r\n }\r\n\r\n public async getAccessToken(): Promise<AccessToken> {\r\n if (this._fetchingToken) {\r\n return Promise.reject(); // short-circuits any recursive use of this function\r\n }\r\n\r\n if (this._accessToken && !this._hasExpired) {\r\n return this._accessToken;\r\n } else {\r\n this._fetchingToken = true;\r\n const result = await MobileApp.callBackend(\"getAccessToken\");\r\n this._accessToken = result[0];\r\n if (result[1])\r\n this._expirationDate = new Date(result[1]);\r\n this._fetchingToken = false;\r\n return this._accessToken;\r\n }\r\n }\r\n\r\n public setAccessToken(accessToken?: string, expirationDate?: string) {\r\n this._accessToken = accessToken ?? \"\";\r\n this._expirationDate = expirationDate ? new Date(expirationDate) : undefined;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"MobileAuthorizationFrontend.js","sourceRoot":"","sources":["../../../src/frontend/MobileAuthorizationFrontend.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,2CAAwC;A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,CAAC,eAAe,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,CAAC;CACF;AAtCD,kEAsCC","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 OIDC\n */\n\nimport { AccessToken } from \"@itwin/core-bentley\";\nimport { AuthorizationClient } from \"@itwin/core-common\";\nimport { MobileApp } from \"./MobileApp\";\n\n/** Utility to provide and cache auth tokens from native mobile apps to IModelApp.\n * @internal\n */\nexport class MobileAuthorizationFrontend implements AuthorizationClient {\n private _accessToken: AccessToken = \"\";\n private _expirationDate: Date | undefined;\n private _expiryBuffer = 60 * 10; // ten minutes\n private _fetchingToken = false;\n\n private get _hasExpired(): boolean {\n return this._expirationDate !== undefined && this._expirationDate.getTime() - Date.now() <= this._expiryBuffer * 1000;\n }\n\n public async getAccessToken(): Promise<AccessToken> {\n if (this._fetchingToken) {\n // NOTE: This function is from the AuthorizationClient interface. That interface documents\n // this function to return an empty string if no token is available, NOT throw an exception.\n return \"\"; // short-circuits any recursive use of this function\n }\n\n if (this._accessToken && !this._hasExpired) {\n return this._accessToken;\n } else {\n try {\n this._fetchingToken = true;\n const result = await MobileApp.callBackend(\"getAccessToken\");\n this._accessToken = result[0];\n this._expirationDate = result[1] ? new Date(result[1]) : undefined;\n return this._accessToken;\n } catch (_ex) {\n return \"\";\n } finally {\n this._fetchingToken = false;\n }\n }\n }\n\n public setAccessToken(accessToken?: string, expirationDate?: string) {\n this._accessToken = accessToken ?? \"\";\n this._expirationDate = expirationDate ? new Date(expirationDate) : undefined;\n }\n}\n"]}
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"MobilePlatform.test.js","sourceRoot":"","sources":["../../../../src/test/ios/MobilePlatform.test.ts"],"names":[],"mappings":";;AAAA;;;+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QAAQ,CAAC,CAAC;QACxB,aAAM,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH;;;;;;;;;;;;;;;8EAe0E;AAE5E,CAAC,CAAC,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\nimport { assert } from \"chai\";\r\nimport * as fs from \"fs-extra\";\r\nimport * as os from \"os\";\r\nimport * as path from \"path\";\r\n\r\nconst outputDir = path.join(os.tmpdir(), \"output\");\r\n\r\ndescribe(\"IOS Platform Test\", () => {\r\n it(\"Filesystem (Uint8Array) - writeFileSync, appendFileSync and readFileSync\", () => {\r\n const testDir = path.join(outputDir, \"mobile-introp\");\r\n const testFile = path.join(testDir, \"test.bin\");\r\n if (fs.existsSync(testDir)) {\r\n fs.unlinkSync(testDir);\r\n }\r\n fs.mkdirSync(testDir);\r\n assert.isTrue(fs.existsSync(testDir));\r\n\r\n const testArray = new Uint8Array(1024);\r\n for (let i = 0; i < testArray.length; i++) {\r\n testArray[i] = i % 255;\r\n }\r\n\r\n fs.writeFileSync(testFile, testArray);\r\n // binary test\r\n const outArray = fs.readFileSync(testFile, { encoding: null });\r\n assert.equal(outArray.length, testArray.length, \"array size must match\");\r\n for (let i = 0; i < testArray.length; i++) {\r\n assert.equal(testArray[i], outArray[i], `content at offset ${i} missmatch`);\r\n }\r\n\r\n assert.equal(fs.lstatSync(testFile).size, testArray.length, \"file size must match\");\r\n\r\n fs.appendFileSync(testFile, testArray);\r\n\r\n // binary test\r\n const outArrayx2 = fs.readFileSync(testFile, { encoding: null });\r\n assert.equal(outArrayx2.length, testArray.length * 2, \"array size must match after append\");\r\n for (let i = 0; i < testArray.length; i++) {\r\n assert.equal(testArray[i], outArrayx2[i], `content at offset ${i} missmatch after append`);\r\n }\r\n // check append\r\n for (let k = 0; k < testArray.length; k++) {\r\n assert.equal(testArray[k], outArrayx2[k + testArray.length], `content at offset ${k} missmatch after append`);\r\n }\r\n assert.equal(fs.lstatSync(testFile).size, testArray.length * 2, \"file size must match after append\");\r\n\r\n fs.unlinkSync(testFile);\r\n assert.isFalse(fs.existsSync(testFile));\r\n });\r\n\r\n it(\"Filesystem (string) - writeFileSync, appendFileSync and readFileSync\", () => {\r\n const testDir = path.join(outputDir, \"mobile-introp\");\r\n const testFile = path.join(testDir, \"test.bin\");\r\n if (fs.existsSync(testDir)) {\r\n fs.unlinkSync(testDir);\r\n }\r\n\r\n fs.mkdirSync(testDir);\r\n assert.isTrue(fs.existsSync(testDir));\r\n\r\n const testString = \"*\".repeat(1024);\r\n fs.writeFileSync(testFile, testString);\r\n\r\n // string test\r\n const outString = fs.readFileSync(testFile, { encoding: \"utf-8\" });\r\n assert.equal(testString, outString);\r\n\r\n fs.appendFileSync(testFile, testString);\r\n\r\n const outStringx2 = fs.readFileSync(testFile, { encoding: \"utf-8\" });\r\n assert.equal(testString.length * 2, outStringx2.length);\r\n assert.equal(testString + testString, outStringx2);\r\n\r\n fs.unlinkSync(testFile);\r\n assert.isFalse(fs.existsSync(testFile));\r\n });\r\n\r\n /*\r\n- (bool) existsSync: (NSString*)path;\r\n- (void) unlinkSync: (NSString*)path;\r\n- (void) removeSync: (NSString*)path;\r\n- (void) mkdirSync: (NSString*)path;\r\n- (void) rmdirSync: (NSString*)path;\r\n- (void) appendFileSync: (NSString*)path :(JSValue*)data;\r\n- (NSArray<NSString*>*) readdirSync: (NSString*)path;\r\n- (void) writeFileSync: (NSString*)path :(JSValue*)content;\r\n- (void) copySync: (NSString*)fromPath :(NSString*)toPath;\r\n- (JSValue*) lstatSync: (JSValue*)path;\r\n- (JSValue*) readFileSync: (JSValue*)path :(JSValue*)options;\r\n- (JSValue*) istatSync: (JSValue*)path;\r\n- (NSString*) realpathSync: (JSValue*)path :(JSValue*)options;\r\n- (void) closeSync: (JSValue*)fd;\r\n- (JSValue*) openSync: (NSString*)path :(NSString*)flags :(JSValue*)mode; */\r\n\r\n});\r\n"]}
1
+ {"version":3,"file":"MobilePlatform.test.js","sourceRoot":"","sources":["../../../../src/test/ios/MobilePlatform.test.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,+BAA8B;AAC9B,+BAA+B;AAC/B,yBAAyB;AACzB,6BAA6B;AAE7B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAC;AAEnD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,0EAA0E,EAAE,GAAG,EAAE;QAClF,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAChD,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YAC1B,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;SACxB;QACD,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACtB,aAAM,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;QAEtC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACzC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;SACxB;QAED,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QACtC,cAAc;QACd,MAAM,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,C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AM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QACxD,aAAM,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU,EAAE,WAAW,CAAC,CAAC;QAEnD,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACxB,aAAM,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH;;;;;;;;;;;;;;;8EAe0E;AAE5E,CAAC,CAAC,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*--------------------------------------------------------------------------------------------*/\nimport { assert } from \"chai\";\nimport * as fs from \"fs-extra\";\nimport * as os from \"os\";\nimport * as path from \"path\";\n\nconst outputDir = path.join(os.tmpdir(), \"output\");\n\ndescribe(\"IOS Platform Test\", () => {\n it(\"Filesystem (Uint8Array) - writeFileSync, appendFileSync and readFileSync\", () => {\n const testDir = path.join(outputDir, \"mobile-introp\");\n const testFile = path.join(testDir, \"test.bin\");\n if (fs.existsSync(testDir)) {\n fs.unlinkSync(testDir);\n }\n fs.mkdirSync(testDir);\n assert.isTrue(fs.existsSync(testDir));\n\n const testArray = new Uint8Array(1024);\n for (let i = 0; i < testArray.length; i++) {\n testArray[i] = i % 255;\n }\n\n fs.writeFileSync(testFile, testArray);\n // binary test\n const outArray = fs.readFileSync(testFile, { encoding: null });\n assert.equal(outArray.length, testArray.length, \"array size must match\");\n for (let i = 0; i < testArray.length; i++) {\n assert.equal(testArray[i], outArray[i], `content at offset ${i} missmatch`);\n }\n\n assert.equal(fs.lstatSync(testFile).size, testArray.length, \"file size must match\");\n\n fs.appendFileSync(testFile, testArray);\n\n // binary test\n const outArrayx2 = fs.readFileSync(testFile, { encoding: null });\n assert.equal(outArrayx2.length, testArray.length * 2, \"array size must match after append\");\n for (let i = 0; i < testArray.length; i++) {\n assert.equal(testArray[i], outArrayx2[i], `content at offset ${i} missmatch after append`);\n }\n // check append\n for (let k = 0; k < testArray.length; k++) {\n assert.equal(testArray[k], outArrayx2[k + testArray.length], `content at offset ${k} missmatch after append`);\n }\n assert.equal(fs.lstatSync(testFile).size, testArray.length * 2, \"file size must match after append\");\n\n fs.unlinkSync(testFile);\n assert.isFalse(fs.existsSync(testFile));\n });\n\n it(\"Filesystem (string) - writeFileSync, appendFileSync and readFileSync\", () => {\n const testDir = path.join(outputDir, \"mobile-introp\");\n const testFile = path.join(testDir, \"test.bin\");\n if (fs.existsSync(testDir)) {\n fs.unlinkSync(testDir);\n }\n\n fs.mkdirSync(testDir);\n assert.isTrue(fs.existsSync(testDir));\n\n const testString = \"*\".repeat(1024);\n fs.writeFileSync(testFile, testString);\n\n // string test\n const outString = fs.readFileSync(testFile, { encoding: \"utf-8\" });\n assert.equal(testString, outString);\n\n fs.appendFileSync(testFile, testString);\n\n const outStringx2 = fs.readFileSync(testFile, { encoding: \"utf-8\" });\n assert.equal(testString.length * 2, outStringx2.length);\n assert.equal(testString + testString, outStringx2);\n\n fs.unlinkSync(testFile);\n assert.isFalse(fs.existsSync(testFile));\n });\n\n /*\n- (bool) existsSync: (NSString*)path;\n- (void) unlinkSync: (NSString*)path;\n- (void) removeSync: (NSString*)path;\n- (void) mkdirSync: (NSString*)path;\n- (void) rmdirSync: (NSString*)path;\n- (void) appendFileSync: (NSString*)path :(JSValue*)data;\n- (NSArray<NSString*>*) readdirSync: (NSString*)path;\n- (void) writeFileSync: (NSString*)path :(JSValue*)content;\n- (void) copySync: (NSString*)fromPath :(NSString*)toPath;\n- (JSValue*) lstatSync: (JSValue*)path;\n- (JSValue*) readFileSync: (JSValue*)path :(JSValue*)options;\n- (JSValue*) istatSync: (JSValue*)path;\n- (NSString*) realpathSync: (JSValue*)path :(JSValue*)options;\n- (void) closeSync: (JSValue*)fd;\n- (JSValue*) openSync: (NSString*)path :(NSString*)flags :(JSValue*)mode; */\n\n});\n"]}
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@itwin/core-mobile",
3
- "version": "4.0.0-dev.8",
3
+ "version": "4.0.0-dev.81",
4
4
  "description": "iTwin.js MobileHost and MobileApp",
5
5
  "license": "MIT",
6
6
  "engines": {
7
- "node": ">=16.13.0 < 19.0"
7
+ "node": "^18.0.0"
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/iTwin/itwinjs-core/tree/master/core/core-mobile"
11
+ "url": "https://github.com/iTwin/itwinjs-core.git",
12
+ "directory": "core/mobile"
12
13
  },
13
14
  "keywords": [
14
15
  "Bentley",
@@ -21,46 +22,38 @@
21
22
  "url": "http://www.bentley.com"
22
23
  },
23
24
  "peerDependencies": {
24
- "@itwin/core-backend": "^4.0.0-dev.8",
25
- "@itwin/core-bentley": "^4.0.0-dev.8",
26
- "@itwin/core-common": "^4.0.0-dev.8",
27
- "@itwin/core-frontend": "^4.0.0-dev.8",
28
- "@itwin/presentation-common": "^4.0.0-dev.8"
25
+ "@itwin/core-backend": "^4.0.0-dev.81",
26
+ "@itwin/core-bentley": "^4.0.0-dev.81",
27
+ "@itwin/core-common": "^4.0.0-dev.81",
28
+ "@itwin/core-frontend": "^4.0.0-dev.81"
29
29
  },
30
30
  "dependencies": {
31
- "deep-assign": "^2.0.0",
32
31
  "lodash": "^4.17.10",
33
- "js-base64": "^3.6.1",
34
- "qs": "^6.5.3",
35
32
  "superagent": "^7.1.5",
36
33
  "ws": "^7.5.3"
37
34
  },
38
35
  "devDependencies": {
39
- "@itwin/build-tools": "4.0.0-dev.8",
40
- "@itwin/core-backend": "4.0.0-dev.8",
41
- "@itwin/core-bentley": "4.0.0-dev.8",
42
- "@itwin/core-common": "4.0.0-dev.8",
43
- "@itwin/core-frontend": "4.0.0-dev.8",
44
- "@itwin/eslint-plugin": "4.0.0-dev.8",
45
- "@itwin/presentation-common": "4.0.0-dev.8",
36
+ "@itwin/build-tools": "4.0.0-dev.81",
37
+ "@itwin/core-backend": "4.0.0-dev.81",
38
+ "@itwin/core-bentley": "4.0.0-dev.81",
39
+ "@itwin/core-common": "4.0.0-dev.81",
40
+ "@itwin/core-frontend": "4.0.0-dev.81",
41
+ "@itwin/eslint-plugin": "^4.0.0-dev.33",
46
42
  "@types/chai": "4.3.1",
47
- "@types/deep-assign": "^0.1.0",
48
43
  "@types/fs-extra": "^4.0.7",
49
44
  "@types/lodash": "^4.14.0",
50
45
  "@types/mocha": "^8.2.2",
51
- "@types/node": "18.11.5",
52
- "@types/qs": "^6.5.0",
46
+ "@types/node": "^18.11.5",
53
47
  "@types/superagent": "^4.1.14",
54
48
  "@types/ws": "^7.0.0",
55
49
  "chai": "^4.1.2",
56
50
  "chai-as-promised": "^7",
57
51
  "dotenv": "^10.0.0",
58
52
  "dotenv-expand": "^5.1.0",
59
- "eslint": "^7.11.0",
60
- "js-base64": "^3.6.1",
53
+ "eslint": "^8.36.0",
61
54
  "mocha": "^10.0.0",
62
55
  "rimraf": "^3.0.2",
63
- "typescript": "~4.4.0"
56
+ "typescript": "~5.0.2"
64
57
  },
65
58
  "eslintConfig": {
66
59
  "plugins": [
@@ -70,7 +63,6 @@
70
63
  },
71
64
  "scripts": {
72
65
  "build": "npm run -s build:cjs",
73
- "build:ci": "npm run -s build",
74
66
  "build:cjs": "tsc 1>&2 --outDir lib/cjs",
75
67
  "clean": "rimraf lib .rush/temp/package-deps*.json",
76
68
  "docs": "betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-mobile/file.json --tsIndexFile=./__DOC_ONLY__.ts --onlyJson",
@@ -79,5 +71,5 @@
79
71
  "test": "",
80
72
  "cover": ""
81
73
  },
82
- "readme": "# @itwin/core-mobile\r\n\r\nCopyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice. See LICENSE.md in the project root for license terms and full copyright notice.\r\n\r\n## Description\r\n\r\nThe __@itwin/core-electron__ package contains the electron utilities to write an iTwin.js application based on Electron.\r\n\r\n## Documentation\r\n\r\nSee the [iTwin.js](https://www.itwinjs.org) documentation for more information.\r\n"
74
+ "readme": "# @itwin/core-mobile\r\n\r\nCopyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice. See LICENSE.md in the project root for license terms and full copyright notice.\r\n\r\n## Description\r\n\r\nThe __@itwin/core-mobile__ package contains the mobile utilities to write an iTwin.js application for mobile devices.\r\n\r\n## Documentation\r\n\r\nSee the [iTwin.js](https://www.itwinjs.org) documentation for more information.\r\n"
83
75
  }