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
11
11
.DS_Store
12
12
13
13
# tests
14
+ tests /data /*
14
15
! tests /data /.gitkeep
15
16
17
+
16
18
/coverage
17
19
/.nyc_output
18
20
Original file line number Diff line number Diff line change 1
1
export * from './storage.module' ;
2
2
export * from './storage.service' ;
3
3
export * 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' ;
5
3
6
4
export interface StorageModuleOptions extends StorageManagerConfig {
7
5
isGlobal ?: boolean ;
8
6
default : string ;
9
- disks : StorageManagerDiskConfig ;
7
+ disks : Record < string , StorageDiskConfig > ;
8
+ }
9
+
10
+ export interface StorageDiskConfig {
11
+ driver : DriverType | string ;
12
+ config : DiskConfigType ;
10
13
}
Original file line number Diff line number Diff line change @@ -15,4 +15,8 @@ export class StorageService {
15
15
getDisk < T extends Storage > ( name ?: string ) : T {
16
16
return this . storageManager . disk < T > ( name ) ;
17
17
}
18
+
19
+ registerDriver ( name : string , driver : new ( ...args : any [ ] ) => Storage ) : void {
20
+ this . storageManager . registerDriver ( name , driver ) ;
21
+ }
18
22
}
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