@superfunctions/storage-minio 0.1.0
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/dist/adapter.d.ts +12 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +31 -0
- package/dist/adapter.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StorageAdapter } from '@superfunctions/storage';
|
|
2
|
+
export interface MinIOStorageConfig {
|
|
3
|
+
endpoint: string;
|
|
4
|
+
bucket: string;
|
|
5
|
+
accessKeyId: string;
|
|
6
|
+
secretAccessKey: string;
|
|
7
|
+
region?: string;
|
|
8
|
+
useSSL?: boolean;
|
|
9
|
+
port?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function createMinIOStorageAdapter(config: MinIOStorageConfig): StorageAdapter;
|
|
12
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAsCpF"}
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
import { createS3CompatibleStorageAdapter } from '@superfunctions/storage/internal/s3-compatible';
|
|
3
|
+
export function createMinIOStorageAdapter(config) {
|
|
4
|
+
const { endpoint, bucket, accessKeyId, secretAccessKey, region = 'us-east-1', useSSL = true, port, } = config;
|
|
5
|
+
const protocol = useSSL ? 'https' : 'http';
|
|
6
|
+
const endpointWithScheme = endpoint.startsWith('http://') || endpoint.startsWith('https://')
|
|
7
|
+
? endpoint
|
|
8
|
+
: `${protocol}://${endpoint}`;
|
|
9
|
+
const endpointUrl = new URL(endpointWithScheme);
|
|
10
|
+
if (port !== undefined) {
|
|
11
|
+
endpointUrl.port = String(port);
|
|
12
|
+
}
|
|
13
|
+
const fullEndpoint = endpointUrl.toString().replace(/\/$/, '');
|
|
14
|
+
const client = new S3Client({
|
|
15
|
+
region,
|
|
16
|
+
endpoint: fullEndpoint,
|
|
17
|
+
forcePathStyle: true,
|
|
18
|
+
credentials: {
|
|
19
|
+
accessKeyId,
|
|
20
|
+
secretAccessKey,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return createS3CompatibleStorageAdapter({
|
|
24
|
+
name: 'minio',
|
|
25
|
+
bucket,
|
|
26
|
+
client,
|
|
27
|
+
statNotFoundErrorNames: ['NotFound', 'NoSuchKey'],
|
|
28
|
+
downloadNotFoundErrorNames: ['NoSuchKey'],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AAalG,MAAM,UAAU,yBAAyB,CAAC,MAA0B;IAClE,MAAM,EACJ,QAAQ,EACR,MAAM,EACN,WAAW,EACX,eAAe,EACf,MAAM,GAAG,WAAW,EACpB,MAAM,GAAG,IAAI,EACb,IAAI,GACL,GAAG,MAAM,CAAC;IAEX,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,kBAAkB,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC;QAC1F,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,GAAG,QAAQ,MAAM,QAAQ,EAAE,CAAC;IAChC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAChD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,WAAW,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IACD,MAAM,YAAY,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAE/D,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC;QAC1B,MAAM;QACN,QAAQ,EAAE,YAAY;QACtB,cAAc,EAAE,IAAI;QACpB,WAAW,EAAE;YACX,WAAW;YACX,eAAe;SAChB;KACF,CAAC,CAAC;IAEH,OAAO,gCAAgC,CAAC;QACtC,IAAI,EAAE,OAAO;QACb,MAAM;QACN,MAAM;QACN,sBAAsB,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;QACjD,0BAA0B,EAAE,CAAC,WAAW,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAA2B,MAAM,cAAc,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@superfunctions/storage-minio",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MinIO storage adapter for @superfunctions/storage",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": ["dist"],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"test": "vitest",
|
|
18
|
+
"typecheck": "tsc --noEmit",
|
|
19
|
+
"clean": "rm -rf dist"
|
|
20
|
+
},
|
|
21
|
+
"keywords": ["storage", "minio", "s3", "superfunctions"],
|
|
22
|
+
"author": "21n",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"bugs": { "url": "https://github.com/21nCo/super-functions/issues" },
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/21nCo/super-functions.git",
|
|
28
|
+
"directory": "packages/storage-minio"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": { "access": "public" },
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@aws-sdk/client-s3": "^3.600.0",
|
|
33
|
+
"@aws-sdk/s3-request-presigner": "^3.600.0",
|
|
34
|
+
"@superfunctions/storage": "0.1.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.0.0",
|
|
38
|
+
"typescript": "^5.6.0",
|
|
39
|
+
"vitest": "^3.2.4"
|
|
40
|
+
}
|
|
41
|
+
}
|