UNPKG

@itwin/object-storage-google

Version:

Object storage implementation using Google Cloud Storage

41 lines 2.2 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.GoogleServerStorageBindings = void 0; const internal_1 = require("@itwin/cloud-agnostic-core/lib/internal"); const object_storage_core_1 = require("@itwin/object-storage-core"); const common_1 = require("../common"); const wrappers_1 = require("../server/wrappers"); const GoogleServerStorage_1 = require("./GoogleServerStorage"); const StorageControlClientWrapper_1 = require("./wrappers/StorageControlClientWrapper"); class GoogleServerStorageBindings extends object_storage_core_1.ServerStorageDependency { constructor() { super(...arguments); this.dependencyName = "google"; } register(container, config) { if (!config.projectId) throw new internal_1.ConfigError("projectId"); if (!config.bucketName) throw new internal_1.ConfigError("bucketName"); container .bind(common_1.Types.GoogleServer.config) .toConstantValue(config); container.bind(object_storage_core_1.ServerStorage).to(GoogleServerStorage_1.GoogleServerStorage).inSingletonScope(); container.bind(StorageControlClientWrapper_1.StorageControlClientWrapper).toSelf().inSingletonScope(); container.bind(wrappers_1.StorageWrapperFactory).toSelf().inSingletonScope(); container .bind(wrappers_1.StorageWrapper) .toDynamicValue((context) => { const factory = context.container.get(wrappers_1.StorageWrapperFactory); const config = context.container.get(common_1.Types.GoogleServer.config); return factory.createDefaultApplication(config); }) .inSingletonScope(); } } exports.GoogleServerStorageBindings = GoogleServerStorageBindings; //# sourceMappingURL=GoogleServerStorageBindings.js.map