@itwin/ecschema-rpcinterface-tests 3.6.1 → 3.7.0-dev.2

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 (28) hide show
  1. package/lib/backend/BackendInit.d.ts +1 -1
  2. package/lib/backend/BackendInit.js +27 -27
  3. package/lib/backend/BackendInit.js.map +1 -1
  4. package/lib/common/Settings.d.ts +39 -39
  5. package/lib/common/Settings.js +106 -106
  6. package/lib/common/Settings.js.map +1 -1
  7. package/lib/common/SideChannels.d.ts +3 -3
  8. package/lib/common/SideChannels.js +19 -19
  9. package/lib/common/SideChannels.js.map +1 -1
  10. package/lib/dist/_d48c.bundled-tests.js.map +1 -1
  11. package/lib/dist/bundled-tests.js +92456 -90949
  12. package/lib/dist/bundled-tests.js.map +1 -1
  13. package/lib/dist/core_frontend_lib_esm_ApproximateTerrainHeightsProps_js.bundled-tests.js +9 -9
  14. package/lib/dist/core_frontend_lib_esm_ApproximateTerrainHeightsProps_js.bundled-tests.js.map +1 -1
  15. package/lib/dist/object-storage.bundled-tests.js.map +1 -1
  16. package/lib/dist/vendors-common_temp_node_modules_pnpm_itwin_object-storage-azure_1_4_0_node_modules_itwin_obj-3576c6.bundled-tests.js.map +1 -1
  17. package/lib/dist/vendors-common_temp_node_modules_pnpm_loaders_gl_draco_3_3_1_node_modules_loaders_gl_draco_di-d3af41.bundled-tests.js.map +1 -1
  18. package/lib/dist/vendors-common_temp_node_modules_pnpm_reflect-metadata_0_1_13_node_modules_reflect-metadata_R-610cb3.bundled-tests.js.map +1 -1
  19. package/lib/frontend/SchemaRpcInterface.test.d.ts +1 -1
  20. package/lib/frontend/SchemaRpcInterface.test.js +31 -31
  21. package/lib/frontend/SchemaRpcInterface.test.js.map +1 -1
  22. package/lib/frontend/setup/IModelSession.d.ts +13 -13
  23. package/lib/frontend/setup/IModelSession.js +78 -78
  24. package/lib/frontend/setup/IModelSession.js.map +1 -1
  25. package/lib/frontend/setup/TestContext.d.ts +15 -15
  26. package/lib/frontend/setup/TestContext.js +68 -68
  27. package/lib/frontend/setup/TestContext.js.map +1 -1
  28. package/package.json +16 -16
@@ -1,2 +1,2 @@
1
- import "@itwin/oidc-signin-tool/lib/cjs/certa/certaBackend";
1
+ import "@itwin/oidc-signin-tool/lib/cjs/certa/certaBackend";
2
2
  //# sourceMappingURL=BackendInit.d.ts.map
@@ -1,28 +1,28 @@
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 fs = require("fs");
8
- const path = require("path");
9
- // Sets up certa to allow a method on the frontend to get an access token
10
- require("@itwin/oidc-signin-tool/lib/cjs/certa/certaBackend");
11
- const SideChannels_1 = require("../common/SideChannels");
12
- /** Loads the provided `.env` file into process.env */
13
- function loadEnv(envFile) {
14
- if (!fs.existsSync(envFile))
15
- return;
16
- const dotenv = require("dotenv"); // eslint-disable-line @typescript-eslint/no-var-requires
17
- const dotenvExpand = require("dotenv-expand"); // eslint-disable-line @typescript-eslint/no-var-requires
18
- const envResult = dotenv.config({ path: envFile });
19
- if (envResult.error) {
20
- throw envResult.error;
21
- }
22
- dotenvExpand(envResult);
23
- }
24
- module.exports = (async () => {
25
- loadEnv(path.join(__dirname, "..", "..", ".env"));
26
- (0, SideChannels_1.exposeBackendCallbacks)();
27
- })();
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 fs = require("fs");
8
+ const path = require("path");
9
+ // Sets up certa to allow a method on the frontend to get an access token
10
+ require("@itwin/oidc-signin-tool/lib/cjs/certa/certaBackend");
11
+ const SideChannels_1 = require("../common/SideChannels");
12
+ /** Loads the provided `.env` file into process.env */
13
+ function loadEnv(envFile) {
14
+ if (!fs.existsSync(envFile))
15
+ return;
16
+ const dotenv = require("dotenv"); // eslint-disable-line @typescript-eslint/no-var-requires
17
+ const dotenvExpand = require("dotenv-expand"); // eslint-disable-line @typescript-eslint/no-var-requires
18
+ const envResult = dotenv.config({ path: envFile });
19
+ if (envResult.error) {
20
+ throw envResult.error;
21
+ }
22
+ dotenvExpand(envResult);
23
+ }
24
+ module.exports = (async () => {
25
+ loadEnv(path.join(__dirname, "..", "..", ".env"));
26
+ (0, SideChannels_1.exposeBackendCallbacks)();
27
+ })();
28
28
  //# sourceMappingURL=BackendInit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BackendInit.js","sourceRoot":"","sources":["../../src/backend/BackendInit.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,yBAAyB;AACzB,6BAA6B;AAC7B,yEAAyE;AACzE,8DAA4D;AAC5D,yDAAgE;AAEhE,sDAAsD;AACtD,SAAS,OAAO,CAAC,OAAe;IAC9B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;QACzB,OAAO;IAET,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,yDAAyD;IAC3F,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,yDAAyD;IACxG,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACnD,IAAI,SAAS,CAAC,KAAK,EAAE;QACnB,MAAM,SAAS,CAAC,KAAK,CAAC;KACvB;IAED,YAAY,CAAC,SAAS,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,IAAI,EAAE;IAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,IAAA,qCAAsB,GAAE,CAAC;AAC3B,CAAC,CAAC,EAAE,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 * as fs from \"fs\";\r\nimport * as path from \"path\";\r\n// Sets up certa to allow a method on the frontend to get an access token\r\nimport \"@itwin/oidc-signin-tool/lib/cjs/certa/certaBackend\";\r\nimport { exposeBackendCallbacks } from \"../common/SideChannels\";\r\n\r\n/** Loads the provided `.env` file into process.env */\r\nfunction loadEnv(envFile: string) {\r\n if (!fs.existsSync(envFile))\r\n return;\r\n\r\n const dotenv = require(\"dotenv\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n const dotenvExpand = require(\"dotenv-expand\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n const envResult = dotenv.config({ path: envFile });\r\n if (envResult.error) {\r\n throw envResult.error;\r\n }\r\n\r\n dotenvExpand(envResult);\r\n}\r\n\r\nmodule.exports = (async () => {\r\n loadEnv(path.join(__dirname, \"..\", \"..\", \".env\"));\r\n exposeBackendCallbacks();\r\n})();\r\n"]}
1
+ {"version":3,"file":"BackendInit.js","sourceRoot":"","sources":["../../src/backend/BackendInit.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,yBAAyB;AACzB,6BAA6B;AAC7B,yEAAyE;AACzE,8DAA4D;AAC5D,yDAAgE;AAEhE,sDAAsD;AACtD,SAAS,OAAO,CAAC,OAAe;IAC9B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;QACzB,OAAO;IAET,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,yDAAyD;IAC3F,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,yDAAyD;IACxG,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACnD,IAAI,SAAS,CAAC,KAAK,EAAE;QACnB,MAAM,SAAS,CAAC,KAAK,CAAC;KACvB;IAED,YAAY,CAAC,SAAS,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,IAAI,EAAE;IAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,IAAA,qCAAsB,GAAE,CAAC;AAC3B,CAAC,CAAC,EAAE,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 * as fs from \"fs\";\nimport * as path from \"path\";\n// Sets up certa to allow a method on the frontend to get an access token\nimport \"@itwin/oidc-signin-tool/lib/cjs/certa/certaBackend\";\nimport { exposeBackendCallbacks } from \"../common/SideChannels\";\n\n/** Loads the provided `.env` file into process.env */\nfunction loadEnv(envFile: string) {\n if (!fs.existsSync(envFile))\n return;\n\n const dotenv = require(\"dotenv\"); // eslint-disable-line @typescript-eslint/no-var-requires\n const dotenvExpand = require(\"dotenv-expand\"); // eslint-disable-line @typescript-eslint/no-var-requires\n const envResult = dotenv.config({ path: envFile });\n if (envResult.error) {\n throw envResult.error;\n }\n\n dotenvExpand(envResult);\n}\n\nmodule.exports = (async () => {\n loadEnv(path.join(__dirname, \"..\", \"..\", \".env\"));\n exposeBackendCallbacks();\n})();\n"]}
@@ -1,40 +1,40 @@
1
- /// <reference types="node" />
2
- import { IModelReadRpcInterface } from "@itwin/core-common";
3
- import { TestUserCredentials } from "@itwin/oidc-signin-tool";
4
- import { ECSchemaRpcInterface } from "@itwin/ecschema-rpcinterface-common";
5
- export interface Backend {
6
- version: string;
7
- location: string;
8
- name: string;
9
- path: string;
10
- }
11
- export interface IModelData {
12
- useName: boolean;
13
- id?: string;
14
- name?: string;
15
- useITwinName: boolean;
16
- iTwinId?: string;
17
- iTwinName?: string;
18
- changesetId?: string;
19
- }
20
- export declare function getRpcInterfaces(): (typeof IModelReadRpcInterface | typeof ECSchemaRpcInterface)[];
21
- export declare class Settings {
22
- private _backend;
23
- oidcClientId: string;
24
- oidcScopes: string;
25
- oidcRedirect: string;
26
- oidcAuthority?: string;
27
- discovery: string;
28
- gprid?: string;
29
- logLevel?: number;
30
- users: TestUserCredentials[];
31
- get Backend(): Backend;
32
- get user(): TestUserCredentials;
33
- iModel: IModelData;
34
- constructor(env: NodeJS.ProcessEnv);
35
- /** Loads the necessary variables from `process.env`.
36
- */
37
- private load;
38
- toString(): string;
39
- }
1
+ /// <reference types="node" />
2
+ import { IModelReadRpcInterface } from "@itwin/core-common";
3
+ import { TestUserCredentials } from "@itwin/oidc-signin-tool";
4
+ import { ECSchemaRpcInterface } from "@itwin/ecschema-rpcinterface-common";
5
+ export interface Backend {
6
+ version: string;
7
+ location: string;
8
+ name: string;
9
+ path: string;
10
+ }
11
+ export interface IModelData {
12
+ useName: boolean;
13
+ id?: string;
14
+ name?: string;
15
+ useITwinName: boolean;
16
+ iTwinId?: string;
17
+ iTwinName?: string;
18
+ changesetId?: string;
19
+ }
20
+ export declare function getRpcInterfaces(): (typeof IModelReadRpcInterface | typeof ECSchemaRpcInterface)[];
21
+ export declare class Settings {
22
+ private _backend;
23
+ oidcClientId: string;
24
+ oidcScopes: string;
25
+ oidcRedirect: string;
26
+ oidcAuthority?: string;
27
+ discovery: string;
28
+ gprid?: string;
29
+ logLevel?: number;
30
+ users: TestUserCredentials[];
31
+ get Backend(): Backend;
32
+ get user(): TestUserCredentials;
33
+ iModel: IModelData;
34
+ constructor(env: NodeJS.ProcessEnv);
35
+ /** Loads the necessary variables from `process.env`.
36
+ */
37
+ private load;
38
+ toString(): string;
39
+ }
40
40
  //# sourceMappingURL=Settings.d.ts.map
@@ -1,107 +1,107 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Settings = exports.getRpcInterfaces = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const core_bentley_1 = require("@itwin/core-bentley");
9
- const core_common_1 = require("@itwin/core-common");
10
- const ecschema_rpcinterface_common_1 = require("@itwin/ecschema-rpcinterface-common");
11
- function getRpcInterfaces() {
12
- const rpcInterfaces = [];
13
- rpcInterfaces.push(core_common_1.IModelReadRpcInterface);
14
- rpcInterfaces.push(ecschema_rpcinterface_common_1.ECSchemaRpcInterface);
15
- return rpcInterfaces;
16
- }
17
- exports.getRpcInterfaces = getRpcInterfaces;
18
- class Settings {
19
- constructor(env) {
20
- this._backend = {};
21
- this.users = [];
22
- this.iModel = {};
23
- const isFrontend = (typeof (process) === "undefined");
24
- if (!isFrontend && undefined === env.TF_BUILD) {
25
- const path = require("path"); // eslint-disable-line @typescript-eslint/no-var-requires
26
- const dotenv = require("dotenv"); // eslint-disable-line @typescript-eslint/no-var-requires
27
- const dotenvExpand = require("dotenv-expand"); // eslint-disable-line @typescript-eslint/no-var-requires
28
- // First check in process.cwd() for the config
29
- let result = dotenv.config();
30
- if (result.error) {
31
- const potential = path.resolve(process.cwd(), "..", "..", "..", "imodeljs-config", ".env");
32
- result = dotenv.config({ path: potential });
33
- if (result.error)
34
- throw result.error;
35
- }
36
- dotenvExpand(result);
37
- }
38
- if (isFrontend)
39
- globalThis.process = { browser: true, env };
40
- // Loads the config out of the environment.
41
- this.load();
42
- }
43
- // eslint-disable-next-line @typescript-eslint/naming-convention
44
- get Backend() { return this._backend; }
45
- get user() { return this.users[0]; }
46
- /** Loads the necessary variables from `process.env`.
47
- */
48
- load() {
49
- // Parse OIDC
50
- if (undefined === process.env.OIDC_CLIENT_ID)
51
- throw new Error("Missing the 'OIDC_CLIENT_ID' setting.");
52
- this.oidcClientId = process.env.OIDC_CLIENT_ID;
53
- if (undefined === process.env.OIDC_SCOPES)
54
- throw new Error("Missing the 'OIDC_SCOPES' setting");
55
- this.oidcScopes = process.env.OIDC_SCOPES;
56
- if (process.env.OIDC_AUTHORITY)
57
- this.oidcAuthority = process.env.OIDC_AUTHORITY;
58
- this.oidcRedirect = (undefined === process.env.OIDC_REDIRECT) ? "http://localhost:5000" : process.env.OIDC_REDIRECT;
59
- // Parse GPRId
60
- if (undefined !== process.env.GPRID)
61
- this.gprid = process.env.GPRID;
62
- // Parse the iModel variables
63
- if (!process.env.IMODEL_PROJECTID && !process.env.IMODEL_PROJECTNAME)
64
- throw new Error("Missing the 'IMODEL_PROJECTID' or 'IMODEL_PROJECTNAME' setting.");
65
- if (!process.env.IMODEL_IMODELID && !process.env.IMODEL_IMODELNAME)
66
- throw new Error("Missing the 'IMODEL_IMODELID' or 'IMODEL_IMODELNAME' setting.");
67
- this.iModel = {
68
- useName: !process.env.IMODEL_IMODELID,
69
- id: process.env.IMODEL_IMODELID,
70
- name: process.env.IMODEL_IMODELNAME,
71
- useITwinName: !process.env.IMODEL_PROJECTID,
72
- iTwinId: process.env.IMODEL_PROJECTID,
73
- iTwinName: process.env.IMODEL_PROJECTNAME,
74
- changesetId: process.env.IMODEL_CHANGESETID,
75
- };
76
- // Parse logging level
77
- if (undefined !== process.env.LOG_LEVEL) {
78
- const level = parseInt(process.env.LOG_LEVEL, 10);
79
- if (!isNaN(level) && undefined !== core_bentley_1.LogLevel[level])
80
- this.logLevel = level;
81
- }
82
- // Get backend data
83
- if (undefined === process.env.BACKEND_LOCATION)
84
- throw new Error("Missing the 'BACKEND_LOCATION' setting.");
85
- this._backend.location = process.env.BACKEND_LOCATION;
86
- if (undefined === process.env.BACKEND_VERSION)
87
- throw new Error("Missing the 'BACKEND_VERSION' setting.");
88
- this._backend.version = process.env.BACKEND_VERSION;
89
- if (undefined === process.env.BACKEND_NAME)
90
- throw new Error("Missing the 'BACKEND_NAME' setting.");
91
- this._backend.name = process.env.BACKEND_NAME;
92
- // Get users
93
- this.users.push({
94
- email: process.env.USER_WITH_ACCESS_USERNAME || "",
95
- password: process.env.USER_WITH_ACCESS_PASSWORD || "",
96
- });
97
- }
98
- toString() {
99
- return `Configurations:
100
- oidc client id: ${this.oidcClientId},
101
- oidc scopes: ${this.oidcScopes},
102
- applicationId: ${this.gprid},
103
- log level: ${this.logLevel}`;
104
- }
105
- }
106
- exports.Settings = Settings;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Settings = exports.getRpcInterfaces = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ const core_bentley_1 = require("@itwin/core-bentley");
9
+ const core_common_1 = require("@itwin/core-common");
10
+ const ecschema_rpcinterface_common_1 = require("@itwin/ecschema-rpcinterface-common");
11
+ function getRpcInterfaces() {
12
+ const rpcInterfaces = [];
13
+ rpcInterfaces.push(core_common_1.IModelReadRpcInterface);
14
+ rpcInterfaces.push(ecschema_rpcinterface_common_1.ECSchemaRpcInterface);
15
+ return rpcInterfaces;
16
+ }
17
+ exports.getRpcInterfaces = getRpcInterfaces;
18
+ class Settings {
19
+ constructor(env) {
20
+ this._backend = {};
21
+ this.users = [];
22
+ this.iModel = {};
23
+ const isFrontend = (typeof (process) === "undefined");
24
+ if (!isFrontend && undefined === env.TF_BUILD) {
25
+ const path = require("path"); // eslint-disable-line @typescript-eslint/no-var-requires
26
+ const dotenv = require("dotenv"); // eslint-disable-line @typescript-eslint/no-var-requires
27
+ const dotenvExpand = require("dotenv-expand"); // eslint-disable-line @typescript-eslint/no-var-requires
28
+ // First check in process.cwd() for the config
29
+ let result = dotenv.config();
30
+ if (result.error) {
31
+ const potential = path.resolve(process.cwd(), "..", "..", "..", "imodeljs-config", ".env");
32
+ result = dotenv.config({ path: potential });
33
+ if (result.error)
34
+ throw result.error;
35
+ }
36
+ dotenvExpand(result);
37
+ }
38
+ if (isFrontend)
39
+ globalThis.process = { browser: true, env };
40
+ // Loads the config out of the environment.
41
+ this.load();
42
+ }
43
+ // eslint-disable-next-line @typescript-eslint/naming-convention
44
+ get Backend() { return this._backend; }
45
+ get user() { return this.users[0]; }
46
+ /** Loads the necessary variables from `process.env`.
47
+ */
48
+ load() {
49
+ // Parse OIDC
50
+ if (undefined === process.env.OIDC_CLIENT_ID)
51
+ throw new Error("Missing the 'OIDC_CLIENT_ID' setting.");
52
+ this.oidcClientId = process.env.OIDC_CLIENT_ID;
53
+ if (undefined === process.env.OIDC_SCOPES)
54
+ throw new Error("Missing the 'OIDC_SCOPES' setting");
55
+ this.oidcScopes = process.env.OIDC_SCOPES;
56
+ if (process.env.OIDC_AUTHORITY)
57
+ this.oidcAuthority = process.env.OIDC_AUTHORITY;
58
+ this.oidcRedirect = (undefined === process.env.OIDC_REDIRECT) ? "http://localhost:5000" : process.env.OIDC_REDIRECT;
59
+ // Parse GPRId
60
+ if (undefined !== process.env.GPRID)
61
+ this.gprid = process.env.GPRID;
62
+ // Parse the iModel variables
63
+ if (!process.env.IMODEL_PROJECTID && !process.env.IMODEL_PROJECTNAME)
64
+ throw new Error("Missing the 'IMODEL_PROJECTID' or 'IMODEL_PROJECTNAME' setting.");
65
+ if (!process.env.IMODEL_IMODELID && !process.env.IMODEL_IMODELNAME)
66
+ throw new Error("Missing the 'IMODEL_IMODELID' or 'IMODEL_IMODELNAME' setting.");
67
+ this.iModel = {
68
+ useName: !process.env.IMODEL_IMODELID,
69
+ id: process.env.IMODEL_IMODELID,
70
+ name: process.env.IMODEL_IMODELNAME,
71
+ useITwinName: !process.env.IMODEL_PROJECTID,
72
+ iTwinId: process.env.IMODEL_PROJECTID,
73
+ iTwinName: process.env.IMODEL_PROJECTNAME,
74
+ changesetId: process.env.IMODEL_CHANGESETID,
75
+ };
76
+ // Parse logging level
77
+ if (undefined !== process.env.LOG_LEVEL) {
78
+ const level = parseInt(process.env.LOG_LEVEL, 10);
79
+ if (!isNaN(level) && undefined !== core_bentley_1.LogLevel[level])
80
+ this.logLevel = level;
81
+ }
82
+ // Get backend data
83
+ if (undefined === process.env.BACKEND_LOCATION)
84
+ throw new Error("Missing the 'BACKEND_LOCATION' setting.");
85
+ this._backend.location = process.env.BACKEND_LOCATION;
86
+ if (undefined === process.env.BACKEND_VERSION)
87
+ throw new Error("Missing the 'BACKEND_VERSION' setting.");
88
+ this._backend.version = process.env.BACKEND_VERSION;
89
+ if (undefined === process.env.BACKEND_NAME)
90
+ throw new Error("Missing the 'BACKEND_NAME' setting.");
91
+ this._backend.name = process.env.BACKEND_NAME;
92
+ // Get users
93
+ this.users.push({
94
+ email: process.env.USER_WITH_ACCESS_USERNAME || "",
95
+ password: process.env.USER_WITH_ACCESS_PASSWORD || "",
96
+ });
97
+ }
98
+ toString() {
99
+ return `Configurations:
100
+ oidc client id: ${this.oidcClientId},
101
+ oidc scopes: ${this.oidcScopes},
102
+ applicationId: ${this.gprid},
103
+ log level: ${this.logLevel}`;
104
+ }
105
+ }
106
+ exports.Settings = Settings;
107
107
  //# sourceMappingURL=Settings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../src/common/Settings.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAA+C;AAC/C,oDAA4D;AAE5D,sFAA2E;AAmB3E,SAAgB,gBAAgB;IAC9B,MAAM,aAAa,GAAG,EAAE,CAAC;IACzB,aAAa,CAAC,IAAI,CAAC,oCAAsB,CAAC,CAAC;IAC3C,aAAa,CAAC,IAAI,CAAC,mDAAoB,CAAC,CAAC;IAEzC,OAAO,aAAa,CAAC;AACvB,CAAC;AAND,4CAMC;AAED,MAAa,QAAQ;IAiBnB,YAAY,GAAsB;QAhB1B,aAAQ,GAAY,EAAa,CAAC;QAQnC,UAAK,GAA0B,EAAE,CAA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O,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE;SACtD,CAAC,CAAC;IACL,CAAC;IAEM,QAAQ;QACb,OAAO;wBACa,IAAI,CAAC,YAAY;qBACpB,IAAI,CAAC,UAAU;uBACb,IAAI,CAAC,KAAK;mBACd,IAAI,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;CACF;AAlHD,4BAkHC","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 { LogLevel } from \"@itwin/core-bentley\";\r\nimport { IModelReadRpcInterface } from \"@itwin/core-common\";\r\nimport { TestUserCredentials } from \"@itwin/oidc-signin-tool\";\r\nimport { ECSchemaRpcInterface } from \"@itwin/ecschema-rpcinterface-common\";\r\n\r\nexport interface Backend {\r\n version: string;\r\n location: string;\r\n name: string;\r\n path: string;\r\n}\r\n\r\nexport interface IModelData {\r\n useName: boolean; // Defines whether or not to use the name of the iModel\r\n id?: string; // The iModel Id - This is not required\r\n name?: string; // The name is not required to actually get the iModel, only the id.\r\n useITwinName: boolean;\r\n iTwinId?: string;\r\n iTwinName?: string;\r\n changesetId?: string;\r\n}\r\n\r\nexport function getRpcInterfaces() {\r\n const rpcInterfaces = [];\r\n rpcInterfaces.push(IModelReadRpcInterface);\r\n rpcInterfaces.push(ECSchemaRpcInterface);\r\n\r\n return rpcInterfaces;\r\n}\r\n\r\nexport class Settings {\r\n private _backend: Backend = {} as Backend;\r\n public oidcClientId!: string;\r\n public oidcScopes!: string;\r\n public oidcRedirect!: string;\r\n public oidcAuthority?: string;\r\n public discovery!: string;\r\n public gprid?: string;\r\n public logLevel?: number;\r\n public users: TestUserCredentials[] = [];\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public get Backend(): Backend { return this._backend; }\r\n public get user(): TestUserCredentials { return this.users[0]; }\r\n\r\n public iModel: IModelData = {} as IModelData;\r\n\r\n constructor(env: NodeJS.ProcessEnv) {\r\n const isFrontend = (typeof (process) === \"undefined\");\r\n if (!isFrontend && undefined === env.TF_BUILD) {\r\n const path = require(\"path\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n const dotenv = require(\"dotenv\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n const dotenvExpand = require(\"dotenv-expand\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n // First check in process.cwd() for the config\r\n let result = dotenv.config();\r\n if (result.error) {\r\n const potential = path.resolve(process.cwd(), \"..\", \"..\", \"..\", \"imodeljs-config\", \".env\");\r\n result = dotenv.config({ path: potential });\r\n if (result.error)\r\n throw result.error;\r\n }\r\n\r\n dotenvExpand(result);\r\n }\r\n\r\n if (isFrontend)\r\n globalThis.process = { browser: true, env } as any;\r\n\r\n // Loads the config out of the environment.\r\n this.load();\r\n }\r\n\r\n /** Loads the necessary variables from `process.env`.\r\n */\r\n private load() {\r\n // Parse OIDC\r\n if (undefined === process.env.OIDC_CLIENT_ID)\r\n throw new Error(\"Missing the 'OIDC_CLIENT_ID' setting.\");\r\n this.oidcClientId = process.env.OIDC_CLIENT_ID!;\r\n\r\n if (undefined === process.env.OIDC_SCOPES)\r\n throw new Error(\"Missing the 'OIDC_SCOPES' setting\");\r\n this.oidcScopes = process.env.OIDC_SCOPES;\r\n\r\n if (process.env.OIDC_AUTHORITY)\r\n this.oidcAuthority = process.env.OIDC_AUTHORITY;\r\n\r\n this.oidcRedirect = (undefined === process.env.OIDC_REDIRECT) ? \"http://localhost:5000\" : process.env.OIDC_REDIRECT;\r\n\r\n // Parse GPRId\r\n if (undefined !== process.env.GPRID)\r\n this.gprid = process.env.GPRID;\r\n\r\n // Parse the iModel variables\r\n if (!process.env.IMODEL_PROJECTID && !process.env.IMODEL_PROJECTNAME)\r\n throw new Error(\"Missing the 'IMODEL_PROJECTID' or 'IMODEL_PROJECTNAME' setting.\");\r\n\r\n if (!process.env.IMODEL_IMODELID && !process.env.IMODEL_IMODELNAME)\r\n throw new Error(\"Missing the 'IMODEL_IMODELID' or 'IMODEL_IMODELNAME' setting.\");\r\n\r\n this.iModel = {\r\n useName: !process.env.IMODEL_IMODELID,\r\n id: process.env.IMODEL_IMODELID,\r\n name: process.env.IMODEL_IMODELNAME,\r\n useITwinName: !process.env.IMODEL_PROJECTID,\r\n iTwinId: process.env.IMODEL_PROJECTID,\r\n iTwinName: process.env.IMODEL_PROJECTNAME,\r\n changesetId: process.env.IMODEL_CHANGESETID,\r\n };\r\n\r\n // Parse logging level\r\n if (undefined !== process.env.LOG_LEVEL) {\r\n const level = parseInt(process.env.LOG_LEVEL, 10);\r\n if (!isNaN(level) && undefined !== LogLevel[level])\r\n this.logLevel = level;\r\n }\r\n\r\n // Get backend data\r\n if (undefined === process.env.BACKEND_LOCATION)\r\n throw new Error(\"Missing the 'BACKEND_LOCATION' setting.\");\r\n this._backend.location = process.env.BACKEND_LOCATION;\r\n\r\n if (undefined === process.env.BACKEND_VERSION)\r\n throw new Error(\"Missing the 'BACKEND_VERSION' setting.\");\r\n this._backend.version = process.env.BACKEND_VERSION;\r\n\r\n if (undefined === process.env.BACKEND_NAME)\r\n throw new Error(\"Missing the 'BACKEND_NAME' setting.\");\r\n this._backend.name = process.env.BACKEND_NAME;\r\n\r\n // Get users\r\n this.users.push({\r\n email: process.env.USER_WITH_ACCESS_USERNAME || \"\",\r\n password: process.env.USER_WITH_ACCESS_PASSWORD || \"\",\r\n });\r\n }\r\n\r\n public toString(): string {\r\n return `Configurations:\r\n oidc client id: ${this.oidcClientId},\r\n oidc scopes: ${this.oidcScopes},\r\n applicationId: ${this.gprid},\r\n log level: ${this.logLevel}`;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../src/common/Settings.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAA+C;AAC/C,oDAA4D;AAE5D,sFAA2E;AAmB3E,SAAgB,gBAAgB;IAC9B,MAAM,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AC,YAAY;YACxC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;QAE9C,YAAY;QACZ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACd,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE;YAClD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE;SACtD,CAAC,CAAC;IACL,CAAC;IAEM,QAAQ;QACb,OAAO;wBACa,IAAI,CAAC,YAAY;qBACpB,IAAI,CAAC,UAAU;uBACb,IAAI,CAAC,KAAK;mBACd,IAAI,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;CACF;AAlHD,4BAkHC","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 { LogLevel } from \"@itwin/core-bentley\";\nimport { IModelReadRpcInterface } from \"@itwin/core-common\";\nimport { TestUserCredentials } from \"@itwin/oidc-signin-tool\";\nimport { ECSchemaRpcInterface } from \"@itwin/ecschema-rpcinterface-common\";\n\nexport interface Backend {\n version: string;\n location: string;\n name: string;\n path: string;\n}\n\nexport interface IModelData {\n useName: boolean; // Defines whether or not to use the name of the iModel\n id?: string; // The iModel Id - This is not required\n name?: string; // The name is not required to actually get the iModel, only the id.\n useITwinName: boolean;\n iTwinId?: string;\n iTwinName?: string;\n changesetId?: string;\n}\n\nexport function getRpcInterfaces() {\n const rpcInterfaces = [];\n rpcInterfaces.push(IModelReadRpcInterface);\n rpcInterfaces.push(ECSchemaRpcInterface);\n\n return rpcInterfaces;\n}\n\nexport class Settings {\n private _backend: Backend = {} as Backend;\n public oidcClientId!: string;\n public oidcScopes!: string;\n public oidcRedirect!: string;\n public oidcAuthority?: string;\n public discovery!: string;\n public gprid?: string;\n public logLevel?: number;\n public users: TestUserCredentials[] = [];\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public get Backend(): Backend { return this._backend; }\n public get user(): TestUserCredentials { return this.users[0]; }\n\n public iModel: IModelData = {} as IModelData;\n\n constructor(env: NodeJS.ProcessEnv) {\n const isFrontend = (typeof (process) === \"undefined\");\n if (!isFrontend && undefined === env.TF_BUILD) {\n const path = require(\"path\"); // eslint-disable-line @typescript-eslint/no-var-requires\n const dotenv = require(\"dotenv\"); // eslint-disable-line @typescript-eslint/no-var-requires\n const dotenvExpand = require(\"dotenv-expand\"); // eslint-disable-line @typescript-eslint/no-var-requires\n // First check in process.cwd() for the config\n let result = dotenv.config();\n if (result.error) {\n const potential = path.resolve(process.cwd(), \"..\", \"..\", \"..\", \"imodeljs-config\", \".env\");\n result = dotenv.config({ path: potential });\n if (result.error)\n throw result.error;\n }\n\n dotenvExpand(result);\n }\n\n if (isFrontend)\n globalThis.process = { browser: true, env } as any;\n\n // Loads the config out of the environment.\n this.load();\n }\n\n /** Loads the necessary variables from `process.env`.\n */\n private load() {\n // Parse OIDC\n if (undefined === process.env.OIDC_CLIENT_ID)\n throw new Error(\"Missing the 'OIDC_CLIENT_ID' setting.\");\n this.oidcClientId = process.env.OIDC_CLIENT_ID!;\n\n if (undefined === process.env.OIDC_SCOPES)\n throw new Error(\"Missing the 'OIDC_SCOPES' setting\");\n this.oidcScopes = process.env.OIDC_SCOPES;\n\n if (process.env.OIDC_AUTHORITY)\n this.oidcAuthority = process.env.OIDC_AUTHORITY;\n\n this.oidcRedirect = (undefined === process.env.OIDC_REDIRECT) ? \"http://localhost:5000\" : process.env.OIDC_REDIRECT;\n\n // Parse GPRId\n if (undefined !== process.env.GPRID)\n this.gprid = process.env.GPRID;\n\n // Parse the iModel variables\n if (!process.env.IMODEL_PROJECTID && !process.env.IMODEL_PROJECTNAME)\n throw new Error(\"Missing the 'IMODEL_PROJECTID' or 'IMODEL_PROJECTNAME' setting.\");\n\n if (!process.env.IMODEL_IMODELID && !process.env.IMODEL_IMODELNAME)\n throw new Error(\"Missing the 'IMODEL_IMODELID' or 'IMODEL_IMODELNAME' setting.\");\n\n this.iModel = {\n useName: !process.env.IMODEL_IMODELID,\n id: process.env.IMODEL_IMODELID,\n name: process.env.IMODEL_IMODELNAME,\n useITwinName: !process.env.IMODEL_PROJECTID,\n iTwinId: process.env.IMODEL_PROJECTID,\n iTwinName: process.env.IMODEL_PROJECTNAME,\n changesetId: process.env.IMODEL_CHANGESETID,\n };\n\n // Parse logging level\n if (undefined !== process.env.LOG_LEVEL) {\n const level = parseInt(process.env.LOG_LEVEL, 10);\n if (!isNaN(level) && undefined !== LogLevel[level])\n this.logLevel = level;\n }\n\n // Get backend data\n if (undefined === process.env.BACKEND_LOCATION)\n throw new Error(\"Missing the 'BACKEND_LOCATION' setting.\");\n this._backend.location = process.env.BACKEND_LOCATION;\n\n if (undefined === process.env.BACKEND_VERSION)\n throw new Error(\"Missing the 'BACKEND_VERSION' setting.\");\n this._backend.version = process.env.BACKEND_VERSION;\n\n if (undefined === process.env.BACKEND_NAME)\n throw new Error(\"Missing the 'BACKEND_NAME' setting.\");\n this._backend.name = process.env.BACKEND_NAME;\n\n // Get users\n this.users.push({\n email: process.env.USER_WITH_ACCESS_USERNAME || \"\",\n password: process.env.USER_WITH_ACCESS_PASSWORD || \"\",\n });\n }\n\n public toString(): string {\n return `Configurations:\n oidc client id: ${this.oidcClientId},\n oidc scopes: ${this.oidcScopes},\n applicationId: ${this.gprid},\n log level: ${this.logLevel}`;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
2
- export declare function exposeBackendCallbacks(): void;
3
- export declare function getProcessEnvFromBackend(): Promise<NodeJS.ProcessEnv>;
1
+ /// <reference types="node" />
2
+ export declare function exposeBackendCallbacks(): void;
3
+ export declare function getProcessEnvFromBackend(): Promise<NodeJS.ProcessEnv>;
4
4
  //# sourceMappingURL=SideChannels.d.ts.map
@@ -1,20 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProcessEnvFromBackend = exports.exposeBackendCallbacks = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const CallbackUtils_1 = require("@itwin/certa/lib/utils/CallbackUtils");
9
- const getEnvCallbackName = "getEnv";
10
- function exposeBackendCallbacks() {
11
- (0, CallbackUtils_1.registerBackendCallback)(getEnvCallbackName, () => {
12
- return JSON.stringify(process.env);
13
- });
14
- }
15
- exports.exposeBackendCallbacks = exposeBackendCallbacks;
16
- async function getProcessEnvFromBackend() {
17
- return JSON.parse(await (0, CallbackUtils_1.executeBackendCallback)(getEnvCallbackName));
18
- }
19
- exports.getProcessEnvFromBackend = getProcessEnvFromBackend;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProcessEnvFromBackend = exports.exposeBackendCallbacks = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ const CallbackUtils_1 = require("@itwin/certa/lib/utils/CallbackUtils");
9
+ const getEnvCallbackName = "getEnv";
10
+ function exposeBackendCallbacks() {
11
+ (0, CallbackUtils_1.registerBackendCallback)(getEnvCallbackName, () => {
12
+ return JSON.stringify(process.env);
13
+ });
14
+ }
15
+ exports.exposeBackendCallbacks = exposeBackendCallbacks;
16
+ async function getProcessEnvFromBackend() {
17
+ return JSON.parse(await (0, CallbackUtils_1.executeBackendCallback)(getEnvCallbackName));
18
+ }
19
+ exports.getProcessEnvFromBackend = getProcessEnvFromBackend;
20
20
  //# sourceMappingURL=SideChannels.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SideChannels.js","sourceRoot":"","sources":["../../src/common/SideChannels.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,wEAAuG;AAEvG,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAEpC,SAAgB,sBAAsB;IACpC,IAAA,uCAAuB,EAAC,kBAAkB,EAAE,GAAG,EAAE;QAC/C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,wDAIC;AAEM,KAAK,UAAU,wBAAwB;IAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,sCAAsB,EAAC,kBAAkB,CAAC,CAAC,CAAC;AACtE,CAAC;AAFD,4DAEC","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 { executeBackendCallback, registerBackendCallback } from \"@itwin/certa/lib/utils/CallbackUtils\";\r\n\r\nconst getEnvCallbackName = \"getEnv\";\r\n\r\nexport function exposeBackendCallbacks() {\r\n registerBackendCallback(getEnvCallbackName, () => {\r\n return JSON.stringify(process.env);\r\n });\r\n}\r\n\r\nexport async function getProcessEnvFromBackend(): Promise<NodeJS.ProcessEnv> {\r\n return JSON.parse(await executeBackendCallback(getEnvCallbackName));\r\n}\r\n"]}
1
+ {"version":3,"file":"SideChannels.js","sourceRoot":"","sources":["../../src/common/SideChannels.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,wEAAuG;AAEvG,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAEpC,SAAgB,sBAAsB;IACpC,IAAA,uCAAuB,EAAC,kBAAkB,EAAE,GAAG,EAAE;QAC/C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,wDAIC;AAEM,KAAK,UAAU,wBAAwB;IAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,sCAAsB,EAAC,kBAAkB,CAAC,CAAC,CAAC;AACtE,CAAC;AAFD,4DAEC","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 { executeBackendCallback, registerBackendCallback } from \"@itwin/certa/lib/utils/CallbackUtils\";\n\nconst getEnvCallbackName = \"getEnv\";\n\nexport function exposeBackendCallbacks() {\n registerBackendCallback(getEnvCallbackName, () => {\n return JSON.stringify(process.env);\n });\n}\n\nexport async function getProcessEnvFromBackend(): Promise<NodeJS.ProcessEnv> {\n return JSON.parse(await executeBackendCallback(getEnvCallbackName));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"_d48c.bundled-tests.js","mappings":";;;;;;;;AAAA","sources":["file:///ignored|D:\\vsts_a\\7\\s\\common\\temp\\node_modules\\.pnpm\\@loaders.gl+worker-utils@3.3.1\\node_modules\\@loaders.gl\\worker-utils\\dist\\esm\\lib\\library-utils|../node/require-utils.node"],"names":[],"sourceRoot":""}
1
+ {"version":3,"file":"_d48c.bundled-tests.js","mappings":";;;;;;;;AAAA","sources":["file:///ignored|D:\\vsts_a\\4\\s\\common\\temp\\node_modules\\.pnpm\\@loaders.gl+worker-utils@3.3.1\\node_modules\\@loaders.gl\\worker-utils\\dist\\esm\\lib\\library-utils|../node/require-utils.node"],"names":[],"sourceRoot":""}