@medusajs/file-s3 0.0.3 → 1.0.0-rc-20241001083650
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -0
- package/dist/services/s3-file.d.ts +3 -2
- package/dist/services/s3-file.d.ts.map +1 -0
- package/dist/services/s3-file.js +87 -184
- package/dist/services/s3-file.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +15 -9
package/dist/index.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAKjE,QAAA,MAAM,cAAc,EAAE,qBAErB,CAAA;AAED,eAAe,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
services
|
3
|
+
const s3_file_1 = require("./services/s3-file");
|
4
|
+
const services = [s3_file_1.S3FileService];
|
5
|
+
const providerExport = {
|
6
|
+
services,
|
7
7
|
};
|
8
8
|
exports.default = providerExport;
|
9
|
-
//# sourceMappingURL=
|
9
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,gDAAkD;AAElD,MAAM,QAAQ,GAAG,CAAC,uBAAa,CAAC,CAAA;AAEhC,MAAM,cAAc,GAA0B;IAC5C,QAAQ;CACT,CAAA;AAED,kBAAe,cAAc,CAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { S3Client } from "@aws-sdk/client-s3";
|
2
|
-
import { FileTypes, Logger, S3FileServiceOptions } from "@medusajs/types";
|
3
|
-
import { AbstractFileProviderService } from "@medusajs/utils";
|
2
|
+
import { FileTypes, Logger, S3FileServiceOptions } from "@medusajs/framework/types";
|
3
|
+
import { AbstractFileProviderService } from "@medusajs/framework/utils";
|
4
4
|
type InjectedDependencies = {
|
5
5
|
logger: Logger;
|
6
6
|
};
|
@@ -28,3 +28,4 @@ export declare class S3FileService extends AbstractFileProviderService {
|
|
28
28
|
getPresignedDownloadUrl(fileData: FileTypes.ProviderGetFileDTO): Promise<string>;
|
29
29
|
}
|
30
30
|
export {};
|
31
|
+
//# sourceMappingURL=s3-file.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"s3-file.d.ts","sourceRoot":"","sources":["../../src/services/s3-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,QAAQ,EAET,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,SAAS,EACT,MAAM,EACN,oBAAoB,EACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,2BAA2B,EAE5B,MAAM,2BAA2B,CAAA;AAIlC,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,UAAU,mBAAmB;IAE3B,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC7C;AAGD,qBAAa,aAAc,SAAQ,2BAA2B;IAC5D,MAAM,CAAC,UAAU,SAAO;IACxB,SAAS,CAAC,OAAO,EAAE,mBAAmB,CAAA;IACtC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAA;gBAEf,EAAE,MAAM,EAAE,EAAE,oBAAoB,EAAE,OAAO,EAAE,oBAAoB;IAmB3E,SAAS,CAAC,SAAS;IAcb,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,qBAAqB,GACpC,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC;IAoDrC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAc5D,uBAAuB,CAC3B,QAAQ,EAAE,SAAS,CAAC,kBAAkB,GACrC,OAAO,CAAC,MAAM,CAAC;CAWnB"}
|
package/dist/services/s3-file.js
CHANGED
@@ -1,206 +1,109 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
3
|
-
var extendStatics = function (d, b) {
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
-
return extendStatics(d, b);
|
8
|
-
};
|
9
|
-
return function (d, b) {
|
10
|
-
if (typeof b !== "function" && b !== null)
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
-
extendStatics(d, b);
|
13
|
-
function __() { this.constructor = d; }
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
-
};
|
16
|
-
})();
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
18
|
-
__assign = Object.assign || function(t) {
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20
|
-
s = arguments[i];
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22
|
-
t[p] = s[p];
|
23
|
-
}
|
24
|
-
return t;
|
25
|
-
};
|
26
|
-
return __assign.apply(this, arguments);
|
27
|
-
};
|
28
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
29
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
30
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
31
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
32
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
33
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
34
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
35
|
-
});
|
36
|
-
};
|
37
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
38
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
39
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
40
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
41
|
-
function step(op) {
|
42
|
-
if (f) throw new TypeError("Generator is already executing.");
|
43
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
44
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
45
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
46
|
-
switch (op[0]) {
|
47
|
-
case 0: case 1: t = op; break;
|
48
|
-
case 4: _.label++; return { value: op[1], done: false };
|
49
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
50
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
51
|
-
default:
|
52
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
53
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
54
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
55
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
56
|
-
if (t[2]) _.ops.pop();
|
57
|
-
_.trys.pop(); continue;
|
58
|
-
}
|
59
|
-
op = body.call(thisArg, _);
|
60
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
61
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
62
|
-
}
|
63
|
-
};
|
64
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
65
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
66
4
|
};
|
67
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
68
6
|
exports.S3FileService = void 0;
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
7
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
8
|
+
const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
|
9
|
+
const utils_1 = require("@medusajs/framework/utils");
|
10
|
+
const path_1 = __importDefault(require("path"));
|
11
|
+
const ulid_1 = require("ulid");
|
74
12
|
// FUTURE: At one point we will probably need to support authenticating with IAM roles instead.
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
var _this = this;
|
80
|
-
var _b, _c, _d, _e;
|
81
|
-
_this = _super.call(this) || this;
|
82
|
-
_this.config_ = {
|
13
|
+
class S3FileService extends utils_1.AbstractFileProviderService {
|
14
|
+
constructor({ logger }, options) {
|
15
|
+
super();
|
16
|
+
this.config_ = {
|
83
17
|
fileUrl: options.file_url,
|
84
18
|
accessKeyId: options.access_key_id,
|
85
19
|
secretAccessKey: options.secret_access_key,
|
86
20
|
region: options.region,
|
87
21
|
bucket: options.bucket,
|
88
|
-
prefix:
|
22
|
+
prefix: options.prefix ?? "",
|
89
23
|
endpoint: options.endpoint,
|
90
|
-
cacheControl:
|
91
|
-
downloadFileDuration:
|
92
|
-
additionalClientConfig:
|
24
|
+
cacheControl: options.cache_control ?? "public, max-age=31536000",
|
25
|
+
downloadFileDuration: options.download_file_duration ?? 60 * 60,
|
26
|
+
additionalClientConfig: options.additional_client_config ?? {},
|
93
27
|
};
|
94
|
-
|
95
|
-
|
96
|
-
return _this;
|
28
|
+
this.logger_ = logger;
|
29
|
+
this.client_ = this.getClient();
|
97
30
|
}
|
98
|
-
|
99
|
-
|
31
|
+
getClient() {
|
32
|
+
const config = {
|
33
|
+
credentials: {
|
100
34
|
accessKeyId: this.config_.accessKeyId,
|
101
35
|
secretAccessKey: this.config_.secretAccessKey,
|
102
|
-
},
|
36
|
+
},
|
37
|
+
region: this.config_.region,
|
38
|
+
endpoint: this.config_.endpoint,
|
39
|
+
...this.config_.additionalClientConfig,
|
40
|
+
};
|
103
41
|
return new client_s3_1.S3Client(config);
|
104
|
-
}
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
// Note: We could potentially set the content disposition when uploading,
|
133
|
-
// but storing the original filename as metadata should suffice.
|
134
|
-
Metadata: {
|
135
|
-
"x-amz-meta-original-filename": file.filename,
|
136
|
-
},
|
137
|
-
});
|
138
|
-
_a.label = 1;
|
139
|
-
case 1:
|
140
|
-
_a.trys.push([1, 3, , 4]);
|
141
|
-
return [4 /*yield*/, this.client_.send(command)];
|
142
|
-
case 2:
|
143
|
-
_a.sent();
|
144
|
-
return [3 /*break*/, 4];
|
145
|
-
case 3:
|
146
|
-
e_1 = _a.sent();
|
147
|
-
this.logger_.error(e_1);
|
148
|
-
throw e_1;
|
149
|
-
case 4: return [2 /*return*/, {
|
150
|
-
url: "".concat(this.config_.fileUrl, "/").concat(fileKey),
|
151
|
-
key: fileKey,
|
152
|
-
}];
|
153
|
-
}
|
154
|
-
});
|
42
|
+
}
|
43
|
+
async upload(file) {
|
44
|
+
if (!file) {
|
45
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `No file provided`);
|
46
|
+
}
|
47
|
+
if (!file.filename) {
|
48
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `No filename provided`);
|
49
|
+
}
|
50
|
+
const parsedFilename = path_1.default.parse(file.filename);
|
51
|
+
// TODO: Allow passing a full path for storage per request, not as a global config.
|
52
|
+
const fileKey = `${this.config_.prefix}${parsedFilename.name}-${(0, ulid_1.ulid)()}${parsedFilename.ext}`;
|
53
|
+
const content = Buffer.from(file.content, "binary");
|
54
|
+
const command = new client_s3_1.PutObjectCommand({
|
55
|
+
// We probably also want to support a separate bucket altogether for private files
|
56
|
+
// protected private_bucket_: string
|
57
|
+
// protected private_access_key_id_: string
|
58
|
+
// protected private_secret_access_key_: string
|
59
|
+
ACL: file.access === "public" ? "public-read" : "private",
|
60
|
+
Bucket: this.config_.bucket,
|
61
|
+
Body: content,
|
62
|
+
Key: fileKey,
|
63
|
+
ContentType: file.mimeType,
|
64
|
+
CacheControl: this.config_.cacheControl,
|
65
|
+
// Note: We could potentially set the content disposition when uploading,
|
66
|
+
// but storing the original filename as metadata should suffice.
|
67
|
+
Metadata: {
|
68
|
+
"x-amz-meta-original-filename": file.filename,
|
69
|
+
},
|
155
70
|
});
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
_a.sent();
|
173
|
-
return [3 /*break*/, 4];
|
174
|
-
case 3:
|
175
|
-
e_2 = _a.sent();
|
176
|
-
// TODO: Rethrow depending on the error (eg. a file not found error is fine, but a failed request should be rethrown)
|
177
|
-
this.logger_.error(e_2);
|
178
|
-
return [3 /*break*/, 4];
|
179
|
-
case 4: return [2 /*return*/];
|
180
|
-
}
|
181
|
-
});
|
71
|
+
try {
|
72
|
+
await this.client_.send(command);
|
73
|
+
}
|
74
|
+
catch (e) {
|
75
|
+
this.logger_.error(e);
|
76
|
+
throw e;
|
77
|
+
}
|
78
|
+
return {
|
79
|
+
url: `${this.config_.fileUrl}/${fileKey}`,
|
80
|
+
key: fileKey,
|
81
|
+
};
|
82
|
+
}
|
83
|
+
async delete(file) {
|
84
|
+
const command = new client_s3_1.DeleteObjectCommand({
|
85
|
+
Bucket: this.config_.bucket,
|
86
|
+
Key: file.fileKey,
|
182
87
|
});
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
})];
|
197
|
-
case 1: return [2 /*return*/, _a.sent()];
|
198
|
-
}
|
199
|
-
});
|
88
|
+
try {
|
89
|
+
await this.client_.send(command);
|
90
|
+
}
|
91
|
+
catch (e) {
|
92
|
+
// TODO: Rethrow depending on the error (eg. a file not found error is fine, but a failed request should be rethrown)
|
93
|
+
this.logger_.error(e);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
async getPresignedDownloadUrl(fileData) {
|
97
|
+
// TODO: Allow passing content disposition when getting a presigned URL
|
98
|
+
const command = new client_s3_1.GetObjectCommand({
|
99
|
+
Bucket: this.config_.bucket,
|
100
|
+
Key: `${fileData.fileKey}`,
|
200
101
|
});
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
}
|
102
|
+
return await (0, s3_request_presigner_1.getSignedUrl)(this.client_, command, {
|
103
|
+
expiresIn: this.config_.downloadFileDuration,
|
104
|
+
});
|
105
|
+
}
|
106
|
+
}
|
205
107
|
exports.S3FileService = S3FileService;
|
206
|
-
|
108
|
+
S3FileService.ident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src/services/s3-file.ts"],"version":"5.6.2"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@medusajs/file-s3",
|
3
|
-
"version": "0.0
|
3
|
+
"version": "1.0.0-rc-20241001083650",
|
4
4
|
"description": "S3 protocol file storage for Medusa. Supports any S3-compatible storage provider",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"repository": {
|
@@ -9,33 +9,39 @@
|
|
9
9
|
"directory": "packages/file-local"
|
10
10
|
},
|
11
11
|
"files": [
|
12
|
-
"dist"
|
12
|
+
"dist",
|
13
|
+
"!dist/**/__tests__",
|
14
|
+
"!dist/**/__mocks__",
|
15
|
+
"!dist/**/__fixtures__"
|
13
16
|
],
|
14
17
|
"engines": {
|
15
|
-
"node": ">=
|
18
|
+
"node": ">=20"
|
16
19
|
},
|
17
20
|
"author": "Medusa",
|
18
21
|
"license": "MIT",
|
19
22
|
"scripts": {
|
20
|
-
"prepublishOnly": "cross-env NODE_ENV=production tsc --build",
|
21
23
|
"test": "jest --passWithNoTests src",
|
22
24
|
"test:integration": "jest --forceExit -- integration-tests/**/__tests__/**/*.spec.ts",
|
23
|
-
"build": "rimraf dist && tsc
|
25
|
+
"build": "rimraf dist && tsc --build ./tsconfig.json",
|
24
26
|
"watch": "tsc --watch"
|
25
27
|
},
|
26
28
|
"devDependencies": {
|
29
|
+
"@medusajs/framework": "1.0.0-rc-20241001083650",
|
30
|
+
"@swc/core": "^1.7.28",
|
31
|
+
"@swc/jest": "^0.2.36",
|
27
32
|
"axios": "^1.6.8",
|
28
|
-
"
|
29
|
-
"jest": "^25.5.4",
|
33
|
+
"jest": "^29.7.0",
|
30
34
|
"rimraf": "^5.0.1",
|
31
|
-
"typescript": "^
|
35
|
+
"typescript": "^5.6.2"
|
32
36
|
},
|
33
37
|
"dependencies": {
|
34
38
|
"@aws-sdk/client-s3": "^3.556.0",
|
35
39
|
"@aws-sdk/s3-request-presigner": "^3.556.0",
|
36
|
-
"@medusajs/utils": "^1.11.10",
|
37
40
|
"ulid": "^2.3.0"
|
38
41
|
},
|
42
|
+
"peerDependencies": {
|
43
|
+
"@medusajs/framework": "1.0.0-rc-20241001083650"
|
44
|
+
},
|
39
45
|
"keywords": [
|
40
46
|
"medusa-plugin",
|
41
47
|
"medusa-plugin-s3"
|