UNPKG

@tmlmobilidade/interfaces

Version:

This package provides SDK-style connectors for interacting with databases (e.g., stops, plans, rides, alerts) and external providers (e.g., authentication, storage). It simplifies data access and integration across projects.

23 lines (22 loc) 756 B
/* eslint-disable @typescript-eslint/no-extraneous-class */ /* * */ import { S3StorageProvider } from './s3-storage.js'; /* * */ export class StorageFactory { /** * Creates and returns an instance of a storage service based on the provided configuration. * * @param config - The storage configuration object. * @returns An instance of a class that implements IStorageProvider. */ static create(config) { switch (config.type) { case 'aws': return new S3StorageProvider(config.aws_config); case 'cloudflare': return new S3StorageProvider(config.cloudflare_config); default: throw new Error(`Invalid storage type`); } } }