File tree Expand file tree Collapse file tree 7 files changed +44
-5
lines changed Expand file tree Collapse file tree 7 files changed +44
-5
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,10 @@ npm-debug.log
1111.DS_Store
1212
1313# tests
14+ tests /data /*
1415! tests /data /.gitkeep
1516
17+
1618/coverage
1719/.nyc_output
1820
Original file line number Diff line number Diff line change 11export * from './storage.module' ;
22export * from './storage.service' ;
33export * from './interfaces' ;
4+ export * from './types' ;
Original file line number Diff line number Diff line change 1- import {
2- StorageManagerConfig ,
3- StorageManagerDiskConfig ,
4- } from '@slynova/flydrive' ;
1+ import { StorageManagerConfig } from '@slynova/flydrive' ;
2+ import { DiskConfigType , DriverType } from '../types' ;
53
64export interface StorageModuleOptions extends StorageManagerConfig {
75 isGlobal ?: boolean ;
86 default : string ;
9- disks : StorageManagerDiskConfig ;
7+ disks : Record < string , StorageDiskConfig > ;
8+ }
9+
10+ export interface StorageDiskConfig {
11+ driver : DriverType | string ;
12+ config : DiskConfigType ;
1013}
Original file line number Diff line number Diff line change @@ -15,4 +15,8 @@ export class StorageService {
1515 getDisk < T extends Storage > ( name ?: string ) : T {
1616 return this . storageManager . disk < T > ( name ) ;
1717 }
18+
19+ registerDriver ( name : string , driver : new ( ...args : any [ ] ) => Storage ) : void {
20+ this . storageManager . registerDriver ( name , driver ) ;
21+ }
1822}
Original file line number Diff line number Diff line change 1+ export type DiskConfigType =
2+ | DiskLocalConfigType
3+ | DiskS3ConfigType
4+ | DiskGCSConfigType
5+ | Record < string , any > ;
6+
7+ export type DiskLocalConfigType = {
8+ root : string ;
9+ } ;
10+
11+ export type DiskS3ConfigType = {
12+ key : string ;
13+ endpoint : string ;
14+ secret : string ;
15+ bucket : string ;
16+ region : string ;
17+ } ;
18+
19+ export type DiskGCSConfigType = {
20+ keyFilename : string ;
21+ bucket : string ;
22+ } ;
Original file line number Diff line number Diff line change 1+ export enum DriverType {
2+ LOCAL = 'local' ,
3+ S3 = 's3' ,
4+ GCS = 'gcs' ,
5+ }
Original file line number Diff line number Diff line change 1+ export * from './driver.type' ;
2+ export * from './disk-config.type' ;
You can’t perform that action at this time.
0 commit comments