@medusajs/file-s3 0.0.3-snapshot-20240718073308 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import { ModuleProviderExports } from "@medusajs/types";
2
2
  declare const providerExport: ModuleProviderExports;
3
3
  export default providerExport;
4
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const s3_file_1 = require("./services/s3-file");
4
- const services = [s3_file_1.S3FileService];
5
- const providerExport = {
6
- services,
3
+ var s3_file_1 = require("./services/s3-file");
4
+ var services = [s3_file_1.S3FileService];
5
+ var providerExport = {
6
+ services: services,
7
7
  };
8
8
  exports.default = providerExport;
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSxnREFBa0Q7QUFFbEQsTUFBTSxRQUFRLEdBQUcsQ0FBQyx1QkFBYSxDQUFDLENBQUE7QUFFaEMsTUFBTSxjQUFjLEdBQTBCO0lBQzVDLFFBQVE7Q0FDVCxDQUFBO0FBRUQsa0JBQWUsY0FBYyxDQUFBIn0=
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSw4Q0FBa0Q7QUFFbEQsSUFBTSxRQUFRLEdBQUcsQ0FBQyx1QkFBYSxDQUFDLENBQUE7QUFFaEMsSUFBTSxjQUFjLEdBQTBCO0lBQzVDLFFBQVEsVUFBQTtDQUNULENBQUE7QUFFRCxrQkFBZSxjQUFjLENBQUEifQ==
@@ -28,4 +28,3 @@ 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
@@ -1,111 +1,206 @@
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
+ };
2
64
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
65
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
66
  };
5
67
  Object.defineProperty(exports, "__esModule", { value: true });
6
68
  exports.S3FileService = void 0;
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/utils");
10
- const path_1 = __importDefault(require("path"));
11
- const ulid_1 = require("ulid");
69
+ var client_s3_1 = require("@aws-sdk/client-s3");
70
+ var s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
71
+ var utils_1 = require("@medusajs/utils");
72
+ var path_1 = __importDefault(require("path"));
73
+ var ulid_1 = require("ulid");
12
74
  // FUTURE: At one point we will probably need to support authenticating with IAM roles instead.
13
- class S3FileService extends utils_1.AbstractFileProviderService {
14
- constructor({ logger }, options) {
15
- super();
16
- this.config_ = {
75
+ var S3FileService = /** @class */ (function (_super) {
76
+ __extends(S3FileService, _super);
77
+ function S3FileService(_a, options) {
78
+ var logger = _a.logger;
79
+ var _this = this;
80
+ var _b, _c, _d, _e;
81
+ _this = _super.call(this) || this;
82
+ _this.config_ = {
17
83
  fileUrl: options.file_url,
18
84
  accessKeyId: options.access_key_id,
19
85
  secretAccessKey: options.secret_access_key,
20
86
  region: options.region,
21
87
  bucket: options.bucket,
22
- prefix: options.prefix ?? "",
88
+ prefix: (_b = options.prefix) !== null && _b !== void 0 ? _b : "",
23
89
  endpoint: options.endpoint,
24
- cacheControl: options.cache_control ?? "public, max-age=31536000",
25
- downloadFileDuration: options.download_file_duration ?? 60 * 60,
26
- additionalClientConfig: options.additional_client_config ?? {},
90
+ cacheControl: (_c = options.cache_control) !== null && _c !== void 0 ? _c : "public, max-age=31536000",
91
+ downloadFileDuration: (_d = options.download_file_duration) !== null && _d !== void 0 ? _d : 60 * 60,
92
+ additionalClientConfig: (_e = options.additional_client_config) !== null && _e !== void 0 ? _e : {},
27
93
  };
28
- this.logger_ = logger;
29
- this.client_ = this.getClient();
94
+ _this.logger_ = logger;
95
+ _this.client_ = _this.getClient();
96
+ return _this;
30
97
  }
31
- getClient() {
32
- const config = {
33
- credentials: {
98
+ S3FileService.prototype.getClient = function () {
99
+ var config = __assign({ credentials: {
34
100
  accessKeyId: this.config_.accessKeyId,
35
101
  secretAccessKey: this.config_.secretAccessKey,
36
- },
37
- region: this.config_.region,
38
- endpoint: this.config_.endpoint,
39
- ...this.config_.additionalClientConfig,
40
- };
102
+ }, region: this.config_.region, endpoint: this.config_.endpoint }, this.config_.additionalClientConfig);
41
103
  return new client_s3_1.S3Client(config);
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
- // TODO: Add support for private files
56
- // We probably also want to support a separate bucket altogether for private files
57
- // protected private_bucket_: string
58
- // protected private_access_key_id_: string
59
- // protected private_secret_access_key_: string
60
- // ACL: options.acl ?? (options.isProtected ? "private" : "public-read"),
61
- ACL: "public-read",
62
- Bucket: this.config_.bucket,
63
- Body: content,
64
- Key: fileKey,
65
- ContentType: file.mimeType,
66
- CacheControl: this.config_.cacheControl,
67
- // Note: We could potentially set the content disposition when uploading,
68
- // but storing the original filename as metadata should suffice.
69
- Metadata: {
70
- "x-amz-meta-original-filename": file.filename,
71
- },
104
+ };
105
+ S3FileService.prototype.upload = function (file) {
106
+ return __awaiter(this, void 0, void 0, function () {
107
+ var parsedFilename, fileKey, content, command, e_1;
108
+ return __generator(this, function (_a) {
109
+ switch (_a.label) {
110
+ case 0:
111
+ if (!file) {
112
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "No file provided");
113
+ }
114
+ if (!file.filename) {
115
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "No filename provided");
116
+ }
117
+ parsedFilename = path_1.default.parse(file.filename);
118
+ fileKey = "".concat(this.config_.prefix).concat(parsedFilename.name, "-").concat((0, ulid_1.ulid)()).concat(parsedFilename.ext);
119
+ content = Buffer.from(file.content, "binary");
120
+ command = new client_s3_1.PutObjectCommand({
121
+ // TODO: Add support for private files
122
+ // We probably also want to support a separate bucket altogether for private files
123
+ // protected private_bucket_: string
124
+ // protected private_access_key_id_: string
125
+ // protected private_secret_access_key_: string
126
+ // ACL: options.acl ?? (options.isProtected ? "private" : "public-read"),
127
+ Bucket: this.config_.bucket,
128
+ Body: content,
129
+ Key: fileKey,
130
+ ContentType: file.mimeType,
131
+ CacheControl: this.config_.cacheControl,
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
+ });
72
155
  });
73
- try {
74
- await this.client_.send(command);
75
- }
76
- catch (e) {
77
- this.logger_.error(e);
78
- throw e;
79
- }
80
- return {
81
- url: `${this.config_.fileUrl}/${fileKey}`,
82
- key: fileKey,
83
- };
84
- }
85
- async delete(file) {
86
- const command = new client_s3_1.DeleteObjectCommand({
87
- Bucket: this.config_.bucket,
88
- Key: file.fileKey,
156
+ };
157
+ S3FileService.prototype.delete = function (file) {
158
+ return __awaiter(this, void 0, void 0, function () {
159
+ var command, e_2;
160
+ return __generator(this, function (_a) {
161
+ switch (_a.label) {
162
+ case 0:
163
+ command = new client_s3_1.DeleteObjectCommand({
164
+ Bucket: this.config_.bucket,
165
+ Key: file.fileKey,
166
+ });
167
+ _a.label = 1;
168
+ case 1:
169
+ _a.trys.push([1, 3, , 4]);
170
+ return [4 /*yield*/, this.client_.send(command)];
171
+ case 2:
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
+ });
89
182
  });
90
- try {
91
- await this.client_.send(command);
92
- }
93
- catch (e) {
94
- // TODO: Rethrow depending on the error (eg. a file not found error is fine, but a failed request should be rethrown)
95
- this.logger_.error(e);
96
- }
97
- }
98
- async getPresignedDownloadUrl(fileData) {
99
- // TODO: Allow passing content disposition when getting a presigned URL
100
- const command = new client_s3_1.GetObjectCommand({
101
- Bucket: this.config_.bucket,
102
- Key: `${fileData.fileKey}`,
183
+ };
184
+ S3FileService.prototype.getPresignedDownloadUrl = function (fileData) {
185
+ return __awaiter(this, void 0, void 0, function () {
186
+ var command;
187
+ return __generator(this, function (_a) {
188
+ switch (_a.label) {
189
+ case 0:
190
+ command = new client_s3_1.GetObjectCommand({
191
+ Bucket: this.config_.bucket,
192
+ Key: "".concat(fileData.fileKey),
193
+ });
194
+ return [4 /*yield*/, (0, s3_request_presigner_1.getSignedUrl)(this.client_, command, {
195
+ expiresIn: this.config_.downloadFileDuration,
196
+ })];
197
+ case 1: return [2 /*return*/, _a.sent()];
198
+ }
199
+ });
103
200
  });
104
- return await (0, s3_request_presigner_1.getSignedUrl)(this.client_, command, {
105
- expiresIn: this.config_.downloadFileDuration,
106
- });
107
- }
108
- }
201
+ };
202
+ S3FileService.identifier = "s3";
203
+ return S3FileService;
204
+ }(utils_1.AbstractFileProviderService));
109
205
  exports.S3FileService = S3FileService;
110
- S3FileService.identifier = "s3";
111
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiczMtZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLC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yxHQUFHLElBQUksK0JBQW1CLENBQUM7NEJBQ3RDLE1BQU0sRUFBRSxJQUFJLENBQUMsT0FBTyxDQUFDLE1BQU07NEJBQzNCLEdBQUcsRUFBRSxJQUFJLENBQUMsT0FBTzt5QkFDbEIsQ0FBQyxDQUFBOzs7O3dCQUdBLHFCQUFNLElBQUksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxFQUFBOzt3QkFBaEMsU0FBZ0MsQ0FBQTs7Ozt3QkFFaEMscUhBQXFIO3dCQUNySCxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxHQUFDLENBQUMsQ0FBQTs7Ozs7O0tBRXhCO0lBRUssK0NBQXVCLEdBQTdCLFVBQ0UsUUFBc0M7Ozs7Ozt3QkFHaEMsT0FBTyxHQUFHLElBQUksNEJBQWdCLENBQUM7NEJBQ25DLE1BQU0sRUFBRSxJQUFJLENBQUMsT0FBTyxDQUFDLE1BQU07NEJBQzNCLEdBQUcsRUFBRSxVQUFHLFFBQVEsQ0FBQyxPQUFPLENBQUU7eUJBQzNCLENBQUMsQ0FBQTt3QkFFSyxxQkFBTSxJQUFBLG1DQUFZLEVBQUMsSUFBSSxDQUFDLE9BQU8sRUFBRSxPQUFPLEVBQUU7Z0NBQy9DLFNBQVMsRUFBRSxJQUFJLENBQUMsT0FBTyxDQUFDLG9CQUFvQjs2QkFDN0MsQ0FBQyxFQUFBOzRCQUZGLHNCQUFPLFNBRUwsRUFBQTs7OztLQUNIO0lBdkhNLHdCQUFVLEdBQUcsSUFBSSxDQUFBO0lBd0gxQixvQkFBQztDQUFBLEFBekhELENBQW1DLG1DQUEyQixHQXlIN0Q7QUF6SFksc0NBQWEifQ==
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/file-s3",
3
- "version": "0.0.3-snapshot-20240718073308",
3
+ "version": "0.0.3",
4
4
  "description": "S3 protocol file storage for Medusa. Supports any S3-compatible storage provider",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -12,7 +12,7 @@
12
12
  "dist"
13
13
  ],
14
14
  "engines": {
15
- "node": ">=20"
15
+ "node": ">=16"
16
16
  },
17
17
  "author": "Medusa",
18
18
  "license": "MIT",
@@ -26,14 +26,14 @@
26
26
  "devDependencies": {
27
27
  "axios": "^1.6.8",
28
28
  "cross-env": "^5.2.1",
29
- "jest": "^29.7.0",
29
+ "jest": "^25.5.4",
30
30
  "rimraf": "^5.0.1",
31
- "typescript": "^5.3.3"
31
+ "typescript": "^4.9.5"
32
32
  },
33
33
  "dependencies": {
34
34
  "@aws-sdk/client-s3": "^3.556.0",
35
35
  "@aws-sdk/s3-request-presigner": "^3.556.0",
36
- "@medusajs/utils": "1.12.0-snapshot-20240718073308",
36
+ "@medusajs/utils": "^1.11.10",
37
37
  "ulid": "^2.3.0"
38
38
  },
39
39
  "keywords": [
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAKvD,QAAA,MAAM,cAAc,EAAE,qBAErB,CAAA;AAED,eAAe,cAAc,CAAA"}
@@ -1 +0,0 @@
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,EAAE,SAAS,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,2BAA2B,EAAe,MAAM,iBAAiB,CAAA;AAI1E,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,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