@mantiq/filesystem 0.1.3 → 0.2.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -3
- package/src/FilesystemServiceProvider.ts +1 -1
- package/src/contracts/FilesystemConfig.ts +26 -26
- package/src/drivers/AzureBlobDriver.ts +7 -7
- package/src/drivers/FTPDriver.ts +8 -8
- package/src/drivers/GCSDriver.ts +6 -6
- package/src/drivers/S3Driver.ts +9 -9
- package/src/drivers/SFTPDriver.ts +8 -8
- package/src/types.d.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantiq/filesystem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-rc.2",
|
|
4
4
|
"description": "Filesystem abstraction — local, S3, GCS, R2, Azure, FTP, SFTP drivers with uniform API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,14 +40,15 @@
|
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
42
|
"scripts": {
|
|
43
|
-
"build": "bun build ./src/index.ts --outdir ./dist --target bun",
|
|
43
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target bun --packages=external",
|
|
44
44
|
"test": "bun test",
|
|
45
45
|
"typecheck": "tsc --noEmit",
|
|
46
46
|
"clean": "rm -rf dist"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"bun-types": "latest",
|
|
50
|
-
"typescript": "^5.7.0"
|
|
50
|
+
"typescript": "^5.7.0",
|
|
51
|
+
"@mantiq/core": "workspace:*"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
53
54
|
"@mantiq/core": "^0.1.0",
|
|
@@ -77,5 +78,8 @@
|
|
|
77
78
|
"ssh2-sftp-client": {
|
|
78
79
|
"optional": true
|
|
79
80
|
}
|
|
81
|
+
},
|
|
82
|
+
"mantiq": {
|
|
83
|
+
"provider": "FilesystemServiceProvider"
|
|
80
84
|
}
|
|
81
85
|
}
|
|
@@ -14,7 +14,7 @@ export class FilesystemServiceProvider extends ServiceProvider {
|
|
|
14
14
|
override register(): void {
|
|
15
15
|
this.app.singleton(FilesystemManager, (c) => {
|
|
16
16
|
const config = c.make(ConfigRepository).get<FilesystemConfig>('filesystem', DEFAULT_CONFIG)
|
|
17
|
-
const app = c.make(Application)
|
|
17
|
+
const app = c.make(Application as any) as Application
|
|
18
18
|
|
|
19
19
|
// Normalize relative root paths to absolute using the app base path
|
|
20
20
|
for (const disk of Object.values(config.disks)) {
|
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
export interface DiskConfig {
|
|
2
2
|
driver: string
|
|
3
|
-
root?: string
|
|
4
|
-
url?: string
|
|
5
|
-
visibility?: 'public' | 'private'
|
|
3
|
+
root?: string | undefined
|
|
4
|
+
url?: string | undefined
|
|
5
|
+
visibility?: 'public' | 'private' | undefined
|
|
6
6
|
[key: string]: unknown
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export interface S3DiskConfig extends DiskConfig {
|
|
10
10
|
driver: 's3'
|
|
11
11
|
bucket: string
|
|
12
|
-
region?: string
|
|
13
|
-
key?: string
|
|
14
|
-
secret?: string
|
|
15
|
-
token?: string
|
|
16
|
-
endpoint?: string
|
|
17
|
-
forcePathStyle?: boolean
|
|
12
|
+
region?: string | undefined
|
|
13
|
+
key?: string | undefined
|
|
14
|
+
secret?: string | undefined
|
|
15
|
+
token?: string | undefined
|
|
16
|
+
endpoint?: string | undefined
|
|
17
|
+
forcePathStyle?: boolean | undefined
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface GCSDiskConfig extends DiskConfig {
|
|
21
21
|
driver: 'gcs'
|
|
22
22
|
bucket: string
|
|
23
|
-
projectId?: string
|
|
24
|
-
keyFilename?: string
|
|
25
|
-
credentials?: Record<string, any>
|
|
23
|
+
projectId?: string | undefined
|
|
24
|
+
keyFilename?: string | undefined
|
|
25
|
+
credentials?: Record<string, any> | undefined
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export interface AzureDiskConfig extends DiskConfig {
|
|
29
29
|
driver: 'azure'
|
|
30
30
|
container: string
|
|
31
|
-
connectionString?: string
|
|
32
|
-
accountName?: string
|
|
33
|
-
accountKey?: string
|
|
34
|
-
sasToken?: string
|
|
31
|
+
connectionString?: string | undefined
|
|
32
|
+
accountName?: string | undefined
|
|
33
|
+
accountKey?: string | undefined
|
|
34
|
+
sasToken?: string | undefined
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export interface FTPDiskConfig extends DiskConfig {
|
|
38
38
|
driver: 'ftp'
|
|
39
39
|
host: string
|
|
40
|
-
port?: number
|
|
41
|
-
username?: string
|
|
42
|
-
password?: string
|
|
43
|
-
secure?: boolean | 'implicit'
|
|
44
|
-
timeout?: number
|
|
40
|
+
port?: number | undefined
|
|
41
|
+
username?: string | undefined
|
|
42
|
+
password?: string | undefined
|
|
43
|
+
secure?: boolean | 'implicit' | undefined
|
|
44
|
+
timeout?: number | undefined
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export interface SFTPDiskConfig extends DiskConfig {
|
|
48
48
|
driver: 'sftp'
|
|
49
49
|
host: string
|
|
50
|
-
port?: number
|
|
51
|
-
username?: string
|
|
52
|
-
password?: string
|
|
53
|
-
privateKey?: string
|
|
54
|
-
passphrase?: string
|
|
50
|
+
port?: number | undefined
|
|
51
|
+
username?: string | undefined
|
|
52
|
+
password?: string | undefined
|
|
53
|
+
privateKey?: string | undefined
|
|
54
|
+
passphrase?: string | undefined
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export interface FilesystemConfig {
|
|
@@ -5,13 +5,13 @@ import { guessMimeType } from '../helpers/mime.ts'
|
|
|
5
5
|
|
|
6
6
|
export interface AzureConfig {
|
|
7
7
|
container: string
|
|
8
|
-
connectionString?: string
|
|
9
|
-
accountName?: string
|
|
10
|
-
accountKey?: string
|
|
11
|
-
sasToken?: string
|
|
12
|
-
root?: string
|
|
13
|
-
url?: string
|
|
14
|
-
visibility?: 'public' | 'private'
|
|
8
|
+
connectionString?: string | undefined
|
|
9
|
+
accountName?: string | undefined
|
|
10
|
+
accountKey?: string | undefined
|
|
11
|
+
sasToken?: string | undefined
|
|
12
|
+
root?: string | undefined
|
|
13
|
+
url?: string | undefined
|
|
14
|
+
visibility?: 'public' | 'private' | undefined
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
package/src/drivers/FTPDriver.ts
CHANGED
|
@@ -6,14 +6,14 @@ import { guessMimeType } from '../helpers/mime.ts'
|
|
|
6
6
|
|
|
7
7
|
export interface FTPConfig {
|
|
8
8
|
host: string
|
|
9
|
-
port?: number
|
|
10
|
-
username?: string
|
|
11
|
-
password?: string
|
|
12
|
-
secure?: boolean | 'implicit'
|
|
13
|
-
root?: string
|
|
14
|
-
url?: string
|
|
15
|
-
visibility?: 'public' | 'private'
|
|
16
|
-
timeout?: number
|
|
9
|
+
port?: number | undefined
|
|
10
|
+
username?: string | undefined
|
|
11
|
+
password?: string | undefined
|
|
12
|
+
secure?: boolean | 'implicit' | undefined
|
|
13
|
+
root?: string | undefined
|
|
14
|
+
url?: string | undefined
|
|
15
|
+
visibility?: 'public' | 'private' | undefined
|
|
16
|
+
timeout?: number | undefined
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
package/src/drivers/GCSDriver.ts
CHANGED
|
@@ -5,12 +5,12 @@ import { guessMimeType } from '../helpers/mime.ts'
|
|
|
5
5
|
|
|
6
6
|
export interface GCSConfig {
|
|
7
7
|
bucket: string
|
|
8
|
-
projectId?: string
|
|
9
|
-
keyFilename?: string
|
|
10
|
-
credentials?: Record<string, any>
|
|
11
|
-
root?: string
|
|
12
|
-
url?: string
|
|
13
|
-
visibility?: 'public' | 'private'
|
|
8
|
+
projectId?: string | undefined
|
|
9
|
+
keyFilename?: string | undefined
|
|
10
|
+
credentials?: Record<string, any> | undefined
|
|
11
|
+
root?: string | undefined
|
|
12
|
+
url?: string | undefined
|
|
13
|
+
visibility?: 'public' | 'private' | undefined
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
package/src/drivers/S3Driver.ts
CHANGED
|
@@ -5,15 +5,15 @@ import { guessMimeType } from '../helpers/mime.ts'
|
|
|
5
5
|
|
|
6
6
|
export interface S3Config {
|
|
7
7
|
bucket: string
|
|
8
|
-
region?: string
|
|
9
|
-
key?: string
|
|
10
|
-
secret?: string
|
|
11
|
-
token?: string
|
|
12
|
-
endpoint?: string
|
|
13
|
-
forcePathStyle?: boolean
|
|
14
|
-
root?: string
|
|
15
|
-
url?: string
|
|
16
|
-
visibility?: 'public' | 'private'
|
|
8
|
+
region?: string | undefined
|
|
9
|
+
key?: string | undefined
|
|
10
|
+
secret?: string | undefined
|
|
11
|
+
token?: string | undefined
|
|
12
|
+
endpoint?: string | undefined
|
|
13
|
+
forcePathStyle?: boolean | undefined
|
|
14
|
+
root?: string | undefined
|
|
15
|
+
url?: string | undefined
|
|
16
|
+
visibility?: 'public' | 'private' | undefined
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -5,14 +5,14 @@ import { guessMimeType } from '../helpers/mime.ts'
|
|
|
5
5
|
|
|
6
6
|
export interface SFTPConfig {
|
|
7
7
|
host: string
|
|
8
|
-
port?: number
|
|
9
|
-
username?: string
|
|
10
|
-
password?: string
|
|
11
|
-
privateKey?: string | Buffer
|
|
12
|
-
passphrase?: string
|
|
13
|
-
root?: string
|
|
14
|
-
url?: string
|
|
15
|
-
visibility?: 'public' | 'private'
|
|
8
|
+
port?: number | undefined
|
|
9
|
+
username?: string | undefined
|
|
10
|
+
password?: string | undefined
|
|
11
|
+
privateKey?: string | Buffer | undefined
|
|
12
|
+
passphrase?: string | undefined
|
|
13
|
+
root?: string | undefined
|
|
14
|
+
url?: string | undefined
|
|
15
|
+
visibility?: 'public' | 'private' | undefined
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Optional peer dependencies — declared as modules so TypeScript doesn't error
|
|
2
|
+
// when they're dynamically imported but not installed.
|
|
3
|
+
declare module '@aws-sdk/client-s3' { const x: any; export = x; export default x; }
|
|
4
|
+
declare module '@aws-sdk/s3-request-presigner' { const x: any; export = x; export default x; }
|
|
5
|
+
declare module '@google-cloud/storage' { const x: any; export = x; export default x; }
|
|
6
|
+
declare module '@azure/storage-blob' { const x: any; export = x; export default x; }
|
|
7
|
+
declare module 'basic-ftp' { const x: any; export = x; export default x; }
|
|
8
|
+
declare module 'ssh2-sftp-client' { const x: any; export = x; export default x; }
|