Copyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.
This repository contains packages that expose a unified cloud-agnostic object storage interface.
@itwin/cloud-agnostic-coreis a base package that allows to load different components into an application usinginversifybased on the configuration.@itwin/object-storage-corepackage defines main interfaces for object storage.- The following packages provide implementations of interfaces defined in
@itwin/object-storage-corefor specific cloud object storage providers:@itwin/object-storage-azurecontains an implementation for Microsoft Azure.@itwin/object-storage-s3contains base implementation for S3-compatible storage providers. The following packages extend this package and adapt it to specific providers:@itwin/object-storage-osscontains an implementation for OSS.@itwin/object-storage-miniocontains an implementation for MinIO.
This repository also contains packages that are relevant only for development:
@itwin/object-storage-tests-backend-unitcontains unit tests for different object storage implementations.@itwin/object-storage-tests-backend,
@itwin/object-storage-tests-frontendcontain integration tests that can be run using different storage implementations.@itwin/object-storage-common-configis a collection of various configuration files shared across the packages in this monorepo.
Local development workflows mostly utilize rush commands which run a specific npm script for each package. For exact script definitions in each package see the corresponding package.json files.
- Clone repository (first time) with
git cloneor pull updates to the repository (subsequent times) withgit pull - Install dependencies:
rush install - Clean:
rush clean - Rebuild source:
rush rebuild
rush test:unitcommand runs unit tests for all packages that have unit tests. The tests should pass with no additional setup.rush test:integration:backendandrush test:integration:frontendcommands run integration tests for packages that have them. Please see theIntegrationTests.mdfiles for instructions specific to each package.
There are two main ways how to consume the storage packages in applications:
- Using the provided classes/interfaces directly and managing their creation manually.
- Loading them using the provided dependency injection configuration utilities. This option utilizes
inversifyframework and allows injecting configured storage classes into other application components.
There are two samples of minimal applications that achieve the same thing (download a file using ClientStorage) and each demonstrate a different method for managing application components:
- Without
inversify- App.ts, Run.ts (launch using "Client file download with DI sample" VS Code configuration). The application constructs classes directly. - With
inversify- App.ts, Run.ts (launch using "Client file download without DI sample" VS Code configuration). The application usesinversify`sContainerto manage component lifetime. Note that the advantages of dependency injection become more apparent when working with larger applications. This method is also used in integration test setup.