@medusajs/file-local-next 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 CHANGED
@@ -1,3 +1,4 @@
1
- import { ModuleProviderExports } from "@medusajs/types";
1
+ import { ModuleProviderExports } from "@medusajs/framework/types";
2
2
  declare const providerExport: ModuleProviderExports;
3
3
  export default providerExport;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -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
- var local_file_1 = require("./services/local-file");
4
- var services = [local_file_1.LocalFileService];
5
- var providerExport = {
6
- services: services,
3
+ const local_file_1 = require("./services/local-file");
4
+ const services = [local_file_1.LocalFileService];
5
+ const providerExport = {
6
+ services,
7
7
  };
8
8
  exports.default = providerExport;
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSxvREFBd0Q7QUFFeEQsSUFBTSxRQUFRLEdBQUcsQ0FBQyw2QkFBZ0IsQ0FBQyxDQUFBO0FBRW5DLElBQU0sY0FBYyxHQUEwQjtJQUM1QyxRQUFRLFVBQUE7Q0FDVCxDQUFBO0FBRUQsa0JBQWUsY0FBYyxDQUFBIn0=
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,sDAAwD;AAExD,MAAM,QAAQ,GAAG,CAAC,6BAAgB,CAAC,CAAA;AAEnC,MAAM,cAAc,GAA0B;IAC5C,QAAQ;CACT,CAAA;AAED,kBAAe,cAAc,CAAA"}
@@ -1,14 +1,16 @@
1
- import { FileTypes, LocalFileServiceOptions } from "@medusajs/types";
2
- import { AbstractFileProviderService } from "@medusajs/utils";
1
+ import { FileTypes, LocalFileServiceOptions } from "@medusajs/framework/types";
2
+ import { AbstractFileProviderService } from "@medusajs/framework/utils";
3
3
  export declare class LocalFileService extends AbstractFileProviderService {
4
4
  static identifier: string;
5
5
  protected uploadDir_: string;
6
+ protected privateUploadDir_: string;
6
7
  protected backendUrl_: string;
7
8
  constructor(_: any, options: LocalFileServiceOptions);
8
9
  upload(file: FileTypes.ProviderUploadFileDTO): Promise<FileTypes.ProviderFileResultDTO>;
9
10
  delete(file: FileTypes.ProviderDeleteFileDTO): Promise<void>;
10
- getPresignedDownloadUrl(fileData: FileTypes.ProviderGetFileDTO): Promise<string>;
11
+ getPresignedDownloadUrl(file: FileTypes.ProviderGetFileDTO): Promise<string>;
11
12
  private getUploadFilePath;
12
13
  private getUploadFileUrl;
13
14
  private ensureDirExists;
14
15
  }
16
+ //# sourceMappingURL=local-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-file.d.ts","sourceRoot":"","sources":["../../src/services/local-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAC9E,OAAO,EACL,2BAA2B,EAE5B,MAAM,2BAA2B,CAAA;AAIlC,qBAAa,gBAAiB,SAAQ,2BAA2B;IAC/D,MAAM,CAAC,UAAU,SAAY;IAC7B,SAAS,CAAC,UAAU,EAAE,MAAM,CAAA;IAC5B,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAA;IACnC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAA;gBAEjB,CAAC,KAAA,EAAE,OAAO,EAAE,uBAAuB;IAazC,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,qBAAqB,GACpC,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC;IAqCrC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB5D,uBAAuB,CAC3B,IAAI,EAAE,SAAS,CAAC,kBAAkB,GACjC,OAAO,CAAC,MAAM,CAAC;IAkBlB,OAAO,CAAC,iBAAiB,CAExB;IAED,OAAO,CAAC,gBAAgB,CAIvB;YAEa,eAAe;CAU9B"}
@@ -1,179 +1,92 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
54
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
55
4
  };
56
5
  Object.defineProperty(exports, "__esModule", { value: true });
57
6
  exports.LocalFileService = void 0;
58
- var utils_1 = require("@medusajs/utils");
59
- var promises_1 = __importDefault(require("fs/promises"));
60
- var path_1 = __importDefault(require("path"));
61
- var LocalFileService = /** @class */ (function (_super) {
62
- __extends(LocalFileService, _super);
63
- function LocalFileService(_, options) {
64
- var _this = _super.call(this) || this;
65
- _this.getUploadFilePath = function (fileKey) {
66
- return path_1.default.join(_this.uploadDir_, fileKey);
7
+ const utils_1 = require("@medusajs/framework/utils");
8
+ const promises_1 = __importDefault(require("fs/promises"));
9
+ const path_1 = __importDefault(require("path"));
10
+ class LocalFileService extends utils_1.AbstractFileProviderService {
11
+ constructor(_, options) {
12
+ super();
13
+ this.getUploadFilePath = (baseDir, fileKey) => {
14
+ return path_1.default.join(baseDir, fileKey);
15
+ };
16
+ this.getUploadFileUrl = (fileKey) => {
17
+ const baseUrl = new URL(this.backendUrl_);
18
+ baseUrl.pathname = path_1.default.join(baseUrl.pathname, fileKey);
19
+ return baseUrl.href;
67
20
  };
68
- _this.getUploadFileUrl = function (fileKey) {
69
- return path_1.default.join(_this.backendUrl_, _this.getUploadFilePath(fileKey));
21
+ this.uploadDir_ = options?.upload_dir || path_1.default.join(process.cwd(), "static");
22
+ // Since there is no way to serve private files through a static server, we simply place them in `static`.
23
+ // This means that the files will be available publicly if the filename is known. Since the local file provider
24
+ // is for development only, this shouldn't be an issue. If you really want to use it in production (and you shouldn't)
25
+ // You can change the private upload dir to `/private` but none of the functionalities where you use a presigned URL will work.
26
+ this.privateUploadDir_ =
27
+ options?.private_upload_dir || path_1.default.join(process.cwd(), "static");
28
+ this.backendUrl_ = options?.backend_url || "http://localhost:9000/static";
29
+ }
30
+ async upload(file) {
31
+ if (!file) {
32
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `No file provided`);
33
+ }
34
+ if (!file.filename) {
35
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `No filename provided`);
36
+ }
37
+ const parsedFilename = path_1.default.parse(file.filename);
38
+ const baseDir = file.access === "public" ? this.uploadDir_ : this.privateUploadDir_;
39
+ await this.ensureDirExists(baseDir, parsedFilename.dir);
40
+ const fileKey = path_1.default.join(parsedFilename.dir,
41
+ // We prepend "private" to the file key so deletions and presigned URLs can know which folder to look into
42
+ `${file.access === "public" ? "" : "private-"}${Date.now()}-${parsedFilename.base}`);
43
+ const filePath = this.getUploadFilePath(baseDir, fileKey);
44
+ const fileUrl = this.getUploadFileUrl(fileKey);
45
+ const content = Buffer.from(file.content, "binary");
46
+ await promises_1.default.writeFile(filePath, content);
47
+ return {
48
+ key: fileKey,
49
+ url: fileUrl,
70
50
  };
71
- _this.uploadDir_ = (options === null || options === void 0 ? void 0 : options.upload_dir) || "uploads";
72
- _this.backendUrl_ = (options === null || options === void 0 ? void 0 : options.backend_url) || "http://localhost:9000";
73
- return _this;
74
51
  }
75
- LocalFileService.prototype.upload = function (file) {
76
- return __awaiter(this, void 0, void 0, function () {
77
- var parsedFilename, fileKey, filePath, fileUrl, content;
78
- return __generator(this, function (_a) {
79
- switch (_a.label) {
80
- case 0:
81
- if (!file) {
82
- throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "No file provided");
83
- }
84
- if (!file.filename) {
85
- throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "No filename provided");
86
- }
87
- parsedFilename = path_1.default.parse(file.filename);
88
- if (parsedFilename.dir) {
89
- this.ensureDirExists(parsedFilename.dir);
90
- }
91
- fileKey = path_1.default.join(parsedFilename.dir, "".concat(Date.now(), "-").concat(parsedFilename.base));
92
- filePath = this.getUploadFilePath(fileKey);
93
- fileUrl = this.getUploadFileUrl(fileKey);
94
- content = Buffer.from(file.content, "binary");
95
- return [4 /*yield*/, promises_1.default.writeFile(filePath, content)];
96
- case 1:
97
- _a.sent();
98
- return [2 /*return*/, {
99
- key: fileKey,
100
- url: fileUrl,
101
- }];
102
- }
103
- });
104
- });
105
- };
106
- LocalFileService.prototype.delete = function (file) {
107
- return __awaiter(this, void 0, void 0, function () {
108
- var filePath, e_1;
109
- return __generator(this, function (_a) {
110
- switch (_a.label) {
111
- case 0:
112
- filePath = this.getUploadFilePath(file.fileKey);
113
- _a.label = 1;
114
- case 1:
115
- _a.trys.push([1, 4, , 5]);
116
- return [4 /*yield*/, promises_1.default.access(filePath, promises_1.default.constants.F_OK)];
117
- case 2:
118
- _a.sent();
119
- return [4 /*yield*/, promises_1.default.unlink(filePath)];
120
- case 3:
121
- _a.sent();
122
- return [3 /*break*/, 5];
123
- case 4:
124
- e_1 = _a.sent();
125
- return [3 /*break*/, 5];
126
- case 5: return [2 /*return*/];
127
- }
128
- });
129
- });
130
- };
131
- LocalFileService.prototype.getPresignedDownloadUrl = function (fileData) {
132
- return __awaiter(this, void 0, void 0, function () {
133
- var _a;
134
- return __generator(this, function (_b) {
135
- switch (_b.label) {
136
- case 0:
137
- _b.trys.push([0, 2, , 3]);
138
- return [4 /*yield*/, promises_1.default.access(this.getUploadFilePath(fileData.fileKey), promises_1.default.constants.F_OK)];
139
- case 1:
140
- _b.sent();
141
- return [3 /*break*/, 3];
142
- case 2:
143
- _a = _b.sent();
144
- throw new utils_1.MedusaError(utils_1.MedusaError.Types.NOT_FOUND, "File with key ".concat(fileData.fileKey, " not found"));
145
- case 3: return [2 /*return*/, this.getUploadFileUrl(fileData.fileKey)];
146
- }
147
- });
148
- });
149
- };
150
- LocalFileService.prototype.ensureDirExists = function (dirPath) {
151
- return __awaiter(this, void 0, void 0, function () {
152
- var relativePath, e_2;
153
- return __generator(this, function (_a) {
154
- switch (_a.label) {
155
- case 0:
156
- relativePath = path_1.default.join(this.uploadDir_, dirPath);
157
- _a.label = 1;
158
- case 1:
159
- _a.trys.push([1, 3, , 5]);
160
- return [4 /*yield*/, promises_1.default.access(relativePath, promises_1.default.constants.F_OK)];
161
- case 2:
162
- _a.sent();
163
- return [3 /*break*/, 5];
164
- case 3:
165
- e_2 = _a.sent();
166
- return [4 /*yield*/, promises_1.default.mkdir(relativePath, { recursive: true })];
167
- case 4:
168
- _a.sent();
169
- return [3 /*break*/, 5];
170
- case 5: return [2 /*return*/];
171
- }
172
- });
173
- });
174
- };
175
- LocalFileService.identifier = "localfs";
176
- return LocalFileService;
177
- }(utils_1.AbstractFileProviderService));
52
+ async delete(file) {
53
+ const baseDir = file.fileKey.startsWith("private-")
54
+ ? this.privateUploadDir_
55
+ : this.uploadDir_;
56
+ const filePath = this.getUploadFilePath(baseDir, file.fileKey);
57
+ try {
58
+ await promises_1.default.access(filePath, promises_1.default.constants.F_OK);
59
+ await promises_1.default.unlink(filePath);
60
+ }
61
+ catch (e) {
62
+ // The file does not exist, so it's a noop.
63
+ }
64
+ return;
65
+ }
66
+ // The local file provider doesn't support presigned URLs for private files (i.e files not placed in /static).
67
+ async getPresignedDownloadUrl(file) {
68
+ const isPrivate = file.fileKey.startsWith("private-");
69
+ const baseDir = isPrivate ? this.privateUploadDir_ : this.uploadDir_;
70
+ const filePath = this.getUploadFilePath(baseDir, file.fileKey);
71
+ try {
72
+ await promises_1.default.access(filePath, promises_1.default.constants.F_OK);
73
+ }
74
+ catch {
75
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.NOT_FOUND, `File with key ${file.fileKey} not found`);
76
+ }
77
+ return this.getUploadFileUrl(file.fileKey);
78
+ }
79
+ async ensureDirExists(baseDir, dirPath) {
80
+ const relativePath = path_1.default.join(baseDir, dirPath);
81
+ try {
82
+ await promises_1.default.access(relativePath, promises_1.default.constants.F_OK);
83
+ }
84
+ catch (e) {
85
+ await promises_1.default.mkdir(relativePath, { recursive: true });
86
+ }
87
+ return relativePath;
88
+ }
89
+ }
178
90
  exports.LocalFileService = LocalFileService;
179
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZXJ2aWNlcy9sb2NhbC1maWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUNBLHlDQUEwRTtBQUMxRSx5REFBNEI7QUFDNUIsOENBQXVCO0FBRXZCO0lBQXNDLG9DQUEyQj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EFBOUZELENBQXNDLG1DQUEyQixHQThGaEU7QUE5RlksNENBQWdCIn0=
91
+ LocalFileService.identifier = "localfs";
92
+ //# sourceMappingURL=local-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-file.js","sourceRoot":"","sources":["../../src/services/local-file.ts"],"names":[],"mappings":";;;;;;AACA,qDAGkC;AAClC,2DAA4B;AAC5B,gDAAuB;AAEvB,MAAa,gBAAiB,SAAQ,mCAA2B;IAM/D,YAAY,CAAC,EAAE,OAAgC;QAC7C,KAAK,EAAE,CAAA;QAwFD,sBAAiB,GAAG,CAAC,OAAe,EAAE,OAAe,EAAE,EAAE;YAC/D,OAAO,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACpC,CAAC,CAAA;QAEO,qBAAgB,GAAG,CAAC,OAAe,EAAE,EAAE;YAC7C,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;YACzC,OAAO,CAAC,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YACvD,OAAO,OAAO,CAAC,IAAI,CAAA;QACrB,CAAC,CAAA;QA/FC,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAA;QAE3E,0GAA0G;QAC1G,+GAA+G;QAC/G,sHAAsH;QACtH,+HAA+H;QAC/H,IAAI,CAAC,iBAAiB;YACpB,OAAO,EAAE,kBAAkB,IAAI,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAA;QACnE,IAAI,CAAC,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,8BAA8B,CAAA;IAC3E,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAAqC;QAErC,IAAI,CAAC,IAAI,EAAE,CAA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QAC5D,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAChD,IAAI,CAAC;YACH,MAAM,kBAAE,CAAC,MAAM,CAAC,YAAY,EAAE,kBAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QAClD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,kBAAE,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACnD,CAAC;QAED,OAAO,YAAY,CAAA;IACrB,CAAC;;AAlHH,4CAmHC;AAlHQ,2BAAU,GAAG,SAAS,AAAZ,CAAY"}
@@ -0,0 +1 @@
1
+ {"root":["../src/index.ts","../src/services/local-file.ts"],"version":"5.6.2"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/file-local-next",
3
- "version": "0.0.3",
3
+ "version": "1.0.0-rc-20241001083650",
4
4
  "description": "Local filesystem file storage for Medusa",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -9,27 +9,31 @@
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": ">=16"
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
- "build": "rimraf dist && tsc -p ./tsconfig.json",
24
+ "build": "rimraf dist && tsc --build ./tsconfig.json",
23
25
  "watch": "tsc --watch"
24
26
  },
25
27
  "devDependencies": {
26
- "cross-env": "^5.2.1",
27
- "jest": "^25.5.4",
28
+ "@medusajs/framework": "1.0.0-rc-20241001083650",
29
+ "@swc/core": "^1.7.28",
30
+ "@swc/jest": "^0.2.36",
31
+ "jest": "^29.7.0",
28
32
  "rimraf": "^5.0.1",
29
- "typescript": "^4.9.5"
33
+ "typescript": "^5.6.2"
30
34
  },
31
- "dependencies": {
32
- "@medusajs/utils": "^1.11.10"
35
+ "peerDependencies": {
36
+ "@medusajs/framework": "1.0.0-rc-20241001083650"
33
37
  },
34
38
  "keywords": [
35
39
  "medusa-plugin",