UNPKG

@itwin/insights-client

Version:

Insights client for the iTwin platform

43 lines 2.36 kB
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; }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ import { inject, injectable } from "inversify"; import { TestAuthorizationProvider } from "../auth/TestAuthorizationProvider"; import { TestITwinsClient } from "./TestITwinsClient"; import { TestITwinProviderConfig } from "./TestITwinProviderConfig"; let TestITwinProvider = class TestITwinProvider { constructor(_testProjectProviderConfig, _iTwinsClient, _testAuthorizationProvider) { this._testProjectProviderConfig = _testProjectProviderConfig; this._iTwinsClient = _iTwinsClient; this._testAuthorizationProvider = _testAuthorizationProvider; } async getOrCreate() { return this._iTwinId ?? await this.initialize(); } async initialize() { const authorization = this._testAuthorizationProvider.getAdmin1Authorization(); this._iTwinId = await this._iTwinsClient.getOrCreateITwin({ authorization, iTwinName: this._testProjectProviderConfig.testITwinName, }); return this._iTwinId; } }; TestITwinProvider = __decorate([ injectable(), __param(0, inject(TestITwinProviderConfig)), __param(1, inject(TestITwinsClient)), __param(2, inject(TestAuthorizationProvider)) ], TestITwinProvider); export { TestITwinProvider }; //# sourceMappingURL=TestITwinProvider.js.map