@medusajs/utils 3.0.0-snapshot-20251211180009 → 3.0.0-snapshot-20251212092246
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Readable } from "stream";
|
|
2
1
|
import { FileTypes, IFileProvider } from "@medusajs/types";
|
|
2
|
+
import type { Readable, Writable } from "stream";
|
|
3
3
|
/**
|
|
4
4
|
* ### constructor
|
|
5
5
|
*
|
|
@@ -208,5 +208,32 @@ export declare class AbstractFileProviderService implements IFileProvider {
|
|
|
208
208
|
* }
|
|
209
209
|
*/
|
|
210
210
|
getAsBuffer(fileData: FileTypes.ProviderGetFileDTO): Promise<Buffer>;
|
|
211
|
+
/**
|
|
212
|
+
* This method returns a writeable stream to upload a file.
|
|
213
|
+
*
|
|
214
|
+
* @param {FileTypes.ProviderUploadStreamDTO} fileData - The details of the file to upload.
|
|
215
|
+
* @returns {Promise<{ writeStream: Writable, promise: Promise<FileTypes.ProviderFileResultDTO>, url: string, fileKey: string }>} The writeable stream and upload promise.
|
|
216
|
+
*
|
|
217
|
+
* @since 2.8.0
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* class MyFileProviderService extends AbstractFileProviderService {
|
|
221
|
+
* // ...
|
|
222
|
+
* async getUploadStream(fileData: FileTypes.ProviderUploadStreamDTO): Promise<{
|
|
223
|
+
* writeStream: Writable
|
|
224
|
+
* promise: Promise<FileTypes.ProviderFileResultDTO>
|
|
225
|
+
* url: string
|
|
226
|
+
* fileKey: string
|
|
227
|
+
* }> {
|
|
228
|
+
* // TODO logic to get the writeable stream
|
|
229
|
+
* }
|
|
230
|
+
* }
|
|
231
|
+
*/
|
|
232
|
+
getUploadStream(fileData: FileTypes.ProviderUploadStreamDTO): Promise<{
|
|
233
|
+
writeStream: Writable;
|
|
234
|
+
promise: Promise<FileTypes.ProviderFileResultDTO>;
|
|
235
|
+
url: string;
|
|
236
|
+
fileKey: string;
|
|
237
|
+
}>;
|
|
211
238
|
}
|
|
212
239
|
//# sourceMappingURL=abstract-file-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-file-provider.d.ts","sourceRoot":"","sources":["../../src/file/abstract-file-provider.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"abstract-file-provider.d.ts","sourceRoot":"","sources":["../../src/file/abstract-file-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qBAAa,2BAA4B,YAAW,aAAa;IAC/D;;;;;;;;;;OAUG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,CAAA;IAEzB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,KAAK;IAE/D;;OAEG;IACH,aAAa;IAIb;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,qBAAqB,GACpC,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC;IAI3C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,MAAM,CACV,KAAK,EAAE,SAAS,CAAC,qBAAqB,GAAG,SAAS,CAAC,qBAAqB,EAAE,GACzE,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,uBAAuB,CAC3B,QAAQ,EAAE,SAAS,CAAC,kBAAkB,GACrC,OAAO,CAAC,MAAM,CAAC;IAIlB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI5E;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,WAAW,CAAC,QAAQ,EAAE,SAAS,CAAC,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIpE;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,eAAe,CAAC,QAAQ,EAAE,SAAS,CAAC,uBAAuB,GAAG,OAAO,CAAC;QACpE,WAAW,EAAE,QAAQ,CAAA;QACrB,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAA;QACjD,GAAG,EAAE,MAAM,CAAA;QACX,OAAO,EAAE,MAAM,CAAA;KAChB,CAAC;CAGH"}
|
|
@@ -209,6 +209,30 @@ class AbstractFileProviderService {
|
|
|
209
209
|
getAsBuffer(fileData) {
|
|
210
210
|
throw Error("getAsBuffer must be overridden by the child class");
|
|
211
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* This method returns a writeable stream to upload a file.
|
|
214
|
+
*
|
|
215
|
+
* @param {FileTypes.ProviderUploadStreamDTO} fileData - The details of the file to upload.
|
|
216
|
+
* @returns {Promise<{ writeStream: Writable, promise: Promise<FileTypes.ProviderFileResultDTO>, url: string, fileKey: string }>} The writeable stream and upload promise.
|
|
217
|
+
*
|
|
218
|
+
* @since 2.8.0
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* class MyFileProviderService extends AbstractFileProviderService {
|
|
222
|
+
* // ...
|
|
223
|
+
* async getUploadStream(fileData: FileTypes.ProviderUploadStreamDTO): Promise<{
|
|
224
|
+
* writeStream: Writable
|
|
225
|
+
* promise: Promise<FileTypes.ProviderFileResultDTO>
|
|
226
|
+
* url: string
|
|
227
|
+
* fileKey: string
|
|
228
|
+
* }> {
|
|
229
|
+
* // TODO logic to get the writeable stream
|
|
230
|
+
* }
|
|
231
|
+
* }
|
|
232
|
+
*/
|
|
233
|
+
getUploadStream(fileData) {
|
|
234
|
+
throw Error("getUploadStream must be overridden by the child class");
|
|
235
|
+
}
|
|
212
236
|
}
|
|
213
237
|
exports.AbstractFileProviderService = AbstractFileProviderService;
|
|
214
238
|
//# sourceMappingURL=abstract-file-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-file-provider.js","sourceRoot":"","sources":["../../src/file/abstract-file-provider.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAa,2BAA2B;IActC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,eAAe,CAAC,OAAyB,IAAiB,CAAC;IAElE;;OAEG;IACH,aAAa;QACX,OAAQ,IAAI,CAAC,WAAmB,CAAC,UAAU,CAAA;IAC7C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,KAAK,CAAC,MAAM,CACV,IAAqC;QAErC,MAAM,KAAK,CAAC,8CAA8C,CAAC,CAAA;IAC7D,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,MAAM,CACV,KAA0E;QAE1E,MAAM,KAAK,CAAC,8CAA8C,CAAC,CAAA;IAC7D,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,KAAK,CAAC,uBAAuB,CAC3B,QAAsC;QAEtC,MAAM,KAAK,CAAC,+DAA+D,CAAC,CAAA;IAC9E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iBAAiB,CAAC,QAAsC;QACtD,MAAM,KAAK,CAAC,yDAAyD,CAAC,CAAA;IACxE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,WAAW,CAAC,QAAsC;QAChD,MAAM,KAAK,CAAC,mDAAmD,CAAC,CAAA;IAClE,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"abstract-file-provider.js","sourceRoot":"","sources":["../../src/file/abstract-file-provider.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAa,2BAA2B;IActC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,eAAe,CAAC,OAAyB,IAAiB,CAAC;IAElE;;OAEG;IACH,aAAa;QACX,OAAQ,IAAI,CAAC,WAAmB,CAAC,UAAU,CAAA;IAC7C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,KAAK,CAAC,MAAM,CACV,IAAqC;QAErC,MAAM,KAAK,CAAC,8CAA8C,CAAC,CAAA;IAC7D,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,MAAM,CACV,KAA0E;QAE1E,MAAM,KAAK,CAAC,8CAA8C,CAAC,CAAA;IAC7D,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,KAAK,CAAC,uBAAuB,CAC3B,QAAsC;QAEtC,MAAM,KAAK,CAAC,+DAA+D,CAAC,CAAA;IAC9E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iBAAiB,CAAC,QAAsC;QACtD,MAAM,KAAK,CAAC,yDAAyD,CAAC,CAAA;IACxE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,WAAW,CAAC,QAAsC;QAChD,MAAM,KAAK,CAAC,mDAAmD,CAAC,CAAA;IAClE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,eAAe,CAAC,QAA2C;QAMzD,MAAM,KAAK,CAAC,uDAAuD,CAAC,CAAA;IACtE,CAAC;CACF;AAzND,kEAyNC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/utils",
|
|
3
|
-
"version": "3.0.0-snapshot-
|
|
3
|
+
"version": "3.0.0-snapshot-20251212092246",
|
|
4
4
|
"description": "Medusa utilities functions shared by Medusa core and Modules",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"author": "Medusa",
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@medusajs/types": "3.0.0-snapshot-
|
|
29
|
+
"@medusajs/types": "3.0.0-snapshot-20251212092246",
|
|
30
30
|
"express": "^4.21.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@graphql-codegen/typescript": "^4.0.9",
|
|
35
35
|
"@graphql-tools/merge": "^9.0.7",
|
|
36
36
|
"@graphql-tools/schema": "^10.0.6",
|
|
37
|
-
"@medusajs/deps": "3.0.0-snapshot-
|
|
37
|
+
"@medusajs/deps": "3.0.0-snapshot-20251212092246",
|
|
38
38
|
"@types/pluralize": "^0.0.33",
|
|
39
39
|
"bignumber.js": "^9.1.2",
|
|
40
40
|
"dotenv": "^16.4.5",
|