UNPKG

@itwin/insights-client

Version:

Insights client for the iTwin platform

90 lines 4.59 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.IModelsClientsTestsConfig = void 0; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ const dotenv = require("dotenv"); const inversify_1 = require("inversify"); const CommonTestUtils_1 = require("../utils/imodels-client-test-utils/CommonTestUtils"); const OperationsBase_1 = require("../../common/OperationsBase"); let IModelsClientsTestsConfig = class IModelsClientsTestsConfig { constructor() { dotenv.config(); this.validateAllValuesPresent(); this.testITwinName = process.env.TEST_ITWIN_NAME ?? ""; this.testIModelName = process.env.TEST_IMODEL_NAME ?? ""; this.auth = { authority: process.env.AUTH_AUTHORITY ?? "", clientId: process.env.AUTH_CLIENT_ID ?? "", clientSecret: process.env.AUTH_CLIENT_SECRET ?? "", redirectUrl: process.env.AUTH_REDIRECT_URL ?? "", scopes: process.env.AUTH_SCOPES ?? "", }; this.apis = { iModels: { baseUrl: process.env.APIS_IMODELS_BASE_URL ?? "", version: process.env.APIS_IMODELS_VERSION ?? "", }, iTwins: { baseUrl: process.env.APIS_ITWINS_BASE_URL ?? "", }, reporting: { baseUrl: process.env.APIS_REPORTING_BASE_URL ?? OperationsBase_1.REPORTING_BASE_PATH, }, carbonCalculation: { baseUrl: process.env.APIS_CARBONCALCULATION_BASE_URL ?? OperationsBase_1.CARBON_CALCULATION_BASE_PATH, }, groupingAndMapping: { baseUrl: process.env.APIS_GROUPING_AND_MAPPING_BASE_URL ?? OperationsBase_1.GROUPING_AND_MAPPING_BASE_PATH, }, namedGroups: { baseUrl: process.env.APIS_NAMED_GROUPS_BASE_URL ?? OperationsBase_1.NAMED_GROUPS_BASE_PATH, }, }; this.testUsers = { admin1: { email: process.env.TEST_USERS_ADMIN1_EMAIL ?? "", password: process.env.TEST_USERS_ADMIN1_PASSWORD ?? "", }, }; this.behaviorOptions = { recreateReusableIModel: process.env?.TEST_BEHAVIOR_OPTIONS_RECREATE_IMODEL === "1", }; } validateAllValuesPresent() { this.validateConfigValue("TEST_ITWIN_NAME"); this.validateConfigValue("TEST_IMODEL_NAME"); this.validateConfigValue("AUTH_AUTHORITY"); this.validateConfigValue("AUTH_CLIENT_ID"); this.validateConfigValue("AUTH_CLIENT_SECRET"); this.validateConfigValue("AUTH_REDIRECT_URL"); this.validateConfigValue("AUTH_SCOPES"); this.validateConfigValue("APIS_IMODELS_BASE_URL"); this.validateConfigValue("APIS_IMODELS_VERSION"); this.validateConfigValue("APIS_ITWINS_BASE_URL"); this.validateConfigValue("APIS_REPORTING_BASE_URL"); this.validateConfigValue("APIS_CARBONCALCULATION_BASE_URL"); this.validateConfigValue("APIS_GROUPING_AND_MAPPING_BASE_URL"); this.validateConfigValue("APIS_NAMED_GROUPS_BASE_URL"); this.validateConfigValue("TEST_USERS_ADMIN1_EMAIL"); this.validateConfigValue("TEST_USERS_ADMIN1_PASSWORD"); } validateConfigValue(key) { if (!process.env[key]) { throw new CommonTestUtils_1.TestSetupError(`Invalid configuration: missing ${key} value.`); } } }; exports.IModelsClientsTestsConfig = IModelsClientsTestsConfig; exports.IModelsClientsTestsConfig = IModelsClientsTestsConfig = __decorate([ (0, inversify_1.injectable)() ], IModelsClientsTestsConfig); //# sourceMappingURL=IModelsClientsTestsConfig.js.map